Voting starts in March for the Drupal Association Board election.
MergeQuery_mysql breaks the MergeQuery contract, described in MergeQuery::key():
If the record does not yet exist, they will be inserted into the table along with the values set in the fields() method. If the record does exist, these fields will be used in the WHERE clause to select the record to update.
MergeQuery_mysql completely ignore the keys specified by MergeQuery::key(), and simply executes a
INSERT ... ON DUPLICATE KEY UPDATE .... The behavior of this query is completely different: the update query is only executed if there is a duplicate key error, regardless of the values of MergeQuery::key().
You could believe the difference is not that big, because MergeQuery::key() will typically contain a unique or primary key of the table. But even this case can result in an unexpected behavior. For example, _drupal_session_write() executes the following query when in HTTPs mode:
db_merge('session') ->key(array('sid', 'ssid')) ->fields(array( 'uid' => $user->uid, 'cache' => ... )) ->execute();
... here both sid and ssid are unique keys.
On MySQL this will fail on a collision from *either* sid or ssid. On any other engine it will fail on a collision from *both* sid and ssid.
|#108||715108-sqlite.patch||3.52 KB||Damien Tournoud|
PASSED: [[SimpleTest]]: [MySQL] 21,944 pass(es). View
|#106||715108-sqlite.patch||3.52 KB||Damien Tournoud|
PASSED: [[SimpleTest]]: [MySQL] 21,937 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 21,942 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 21,240 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 20,933 pass(es). View