TableEditor: don't use REPLACE to update the content of a row.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 1 Oct 2010 11:43:51 +0000 (13:43 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 1 Oct 2010 11:43:51 +0000 (13:43 +0200)
commit4c603b95edc398a28dd8ea01d756ca14f01f95e5
treedf644140163f92a2a4fc59a1e1a4a0d148408b85
parent792e4607bafa557ff5bde3b4e4da9406cfbc3111
TableEditor: don't use REPLACE to update the content of a row.

REPLACE deletes the row and then insert the new value. If the content of
the row is used as a foreign key by another table, this leads to a full
cleanup of all the entries that point to the deleted row... and when you
update the 'x' account_type, this removes all the accounts.

This also fix some minor programming errors:
 * let XDB perform the escaping, don't use addslashes manually.
 * don't call XDB('machin = {?} AND ' . $someStringContainingUserInput, $myvalue)
  (this is not critical since the placeholder is before the
  'random' string, but this can lead to errors if the 'random' string
  contain a placeholder {?}).

Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
classes/pltableeditor.php