Saturday 15 March 2014

sql - UPDATE IF condition before committing -



sql - UPDATE IF condition before committing -

is there update if statement in sql allows me validate subset of client supplied attributes against row needs updated?

e.g. update posts set body = $body post_id = $post_id if author_id = $author_id

find, check, , update wrapped in transaction isn't elegant like. neither validating client supplied fields way of where clause.

adding attributes where clause increment number of indexes need created no benefit outside of validation.

are looking this?

update posts set body = $body post_id = $post_id , author_id = $author_id;

sql postgresql

No comments:

Post a Comment