Skip to content

Instantly share code, notes, and snippets.

View pixeloution's full-sized avatar

Erik Wurzer pixeloution

  • Apple
  • Austin, TX
View GitHub Profile
@pixeloution
pixeloution / gist:3700016
Created September 11, 2012 17:26
a method to update rows and return the IDs of the updated rows
-- the #1 likely use-case for this is when using a mySQL table as queue, which is something
-- that should be avoided anyway ... but this allows you to mark items as "in process"
-- and return the ids of the items, without using a table lock (mySQL)
-- sets up the variable
SET @IDS := null;
-- should update all the rows and return a list of updated ids in @IDS. Assume:
-- status 1 means "to be processed"
-- status 2 means "being processed"