Skip to content

Commit

Permalink
Fixed SQLite Update statement that had LIMIT 1 in it
Browse files Browse the repository at this point in the history
  • Loading branch information
magik committed Mar 9, 2011
1 parent 4098fd1 commit 19cd027
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -385,7 +385,7 @@ public boolean removeStock(ItemClump thisItem, String shopLabel)
//if (this.databaseType.equals(Type.SQLITE))
// myQuery.prepareStatement("UPDATE " + tableName + " SET stock = max(stock - ?, stockfloor) WHERE (item = ? AND subtype = ? AND shoplabel = ?))");
//else
myQuery.prepareStatement("UPDATE " + tableName + " SET stock = GREATEST(stock - ?, stockfloor) WHERE (item = ? AND subtype = ? AND shoplabel = ?) LIMIT 1");
myQuery.prepareStatement("UPDATE " + tableName + " SET stock = GREATEST(stock - ?, stockfloor) WHERE (item = ? AND subtype = ? AND shoplabel = ?)" + ((this.databaseType.equals(Type.SQLITE)) ? "" : " LIMIT 1" ));

myQuery.executeUpdates();

Expand Down

0 comments on commit 19cd027

Please sign in to comment.