Skip to content

Instantly share code, notes, and snippets.

@warmwaffles
Created May 30, 2013 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save warmwaffles/5681500 to your computer and use it in GitHub Desktop.
Save warmwaffles/5681500 to your computer and use it in GitHub Desktop.
p = lambda do
{:default => <<-DEFAULT_SQL, :mysql => <<-MYSQL}
UPDATE users SET item_count = item_count + 1
WHERE id IN (SELECT user_id FROM buckets WHERE id = NEW.bucket_id)
DEFAULT_SQL
UPDATE users, buckets SET item_count = item_count + 1
WHERE users.id = user_id AND buckets.id = NEW.bucket_id
MYSQL
end
p.call
@warmwaffles
Copy link
Author

http://i0.kym-cdn.com/photos/images/newsfeed/000/753/464/dc4.jpg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment