I'm a little concerned by the possibilty of a malformed query
accidentally destroying a whole databse.   For example, a badly
constructed boolean, intended to select exactly one row, but which
actually modifies all rows.

 update mytables set data='who' where row='1234';

 (updates 1 row)

verses

 update mytables set data='who where row=1234';

 (damages all rows)

 The obvious answer is to use a LIMIT clause to limit the damage,
but (1) there is still damagage (2) the LIMIT clause is as
likely to be damaged as the WHERE.

 update mytables set data='who where row=1234' LIMIT 1;

 (damages 1 row, gives no indication of error.  Better I suppose.)

So my proposal is a "FAIL IF rows>1" type clause, which would be
syntactically FIRST in the string, and so unlikely to be damaged
by errors constructing a complex query.

 FAIL IF rows>1 update mytables set data='who where row=1234';

 (fails, damaging no rows.)




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to