Skip to content

Instantly share code, notes, and snippets.

@x8k2
Created September 16, 2011 18:00
Show Gist options
  • Select an option

  • Save x8k2/1222704 to your computer and use it in GitHub Desktop.

Select an option

Save x8k2/1222704 to your computer and use it in GitHub Desktop.
user_id = mysql.query('select id from users where dumper = 0 limit 1 for update').first #Sets the user_id to 5 for example
mysql.query("update users set dumper = 1 where id = #{user_id}") #Updates the found user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment