Method: Zena::DbHelper::Mysql.next_zip
- Defined in:
- lib/zena/db_helper/mysql.rb
.next_zip(site_id) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/zena/db_helper/mysql.rb', line 70 def next_zip(site_id) res = update "UPDATE zips SET zip=@zip:=zip+1 WHERE site_id = '#{site_id}'" if res == 0 # error raise Zena::BadConfiguration, "no zip entry for (#{site_id})" end rows = execute "SELECT @zip" rows.fetch_row[0].to_i end |