summaryrefslogtreecommitdiff
path: root/includes/database/sqlite
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2013-02-27 18:13:58 -0500
committerDavid Rothstein <drothstein@gmail.com>2013-02-27 18:13:58 -0500
commitbfaa7b4fd0c0b16e38ba3475d0be24b1d5f9a5d1 (patch)
tree9d8535813b13185b6869278f32c6b0c6e619a931 /includes/database/sqlite
parent297665a47120ae533aa1bbde1de9cb1227e7c6bf (diff)
downloadbrdo-bfaa7b4fd0c0b16e38ba3475d0be24b1d5f9a5d1.tar.gz
brdo-bfaa7b4fd0c0b16e38ba3475d0be24b1d5f9a5d1.tar.bz2
Issue #1266572 by znerol, joshf: Fixed Workaround in UpdateQuery_sqlite() for affected rows count causes certain updates to be suppressed.
Diffstat (limited to 'includes/database/sqlite')
-rw-r--r--includes/database/sqlite/query.inc27
1 files changed, 3 insertions, 24 deletions
diff --git a/includes/database/sqlite/query.inc b/includes/database/sqlite/query.inc
index 74ff9ba20..1bf609db1 100644
--- a/includes/database/sqlite/query.inc
+++ b/includes/database/sqlite/query.inc
@@ -57,39 +57,18 @@ class InsertQuery_sqlite extends InsertQuery {
* we don't select those rows.
*
* A query like this one:
- * UPDATE test SET name = 'newname' WHERE tid = 1
+ * UPDATE test SET col1 = 'newcol1', col2 = 'newcol2' WHERE tid = 1
* will become:
- * UPDATE test SET name = 'newname' WHERE tid = 1 AND name <> 'newname'
+ * UPDATE test SET col1 = 'newcol1', col2 = 'newcol2' WHERE tid = 1 AND (col1 <> 'newcol1' OR col2 <> 'newcol2')
*/
class UpdateQuery_sqlite extends UpdateQuery {
- /**
- * Helper function that removes the fields that are already in a condition.
- *
- * @param $fields
- * The fields.
- * @param QueryConditionInterface $condition
- * A database condition.
- */
- protected function removeFieldsInCondition(&$fields, QueryConditionInterface $condition) {
- foreach ($condition->conditions() as $child_condition) {
- if ($child_condition['field'] instanceof QueryConditionInterface) {
- $this->removeFieldsInCondition($fields, $child_condition['field']);
- }
- else {
- unset($fields[$child_condition['field']]);
- }
- }
- }
-
public function execute() {
if (!empty($this->queryOptions['sqlite_return_matched_rows'])) {
return parent::execute();
}
- // Get the fields used in the update query, and remove those that are already
- // in the condition.
+ // Get the fields used in the update query.
$fields = $this->expressionFields + $this->fields;
- $this->removeFieldsInCondition($fields, $this->condition);
// Add the inverse of the fields to the condition.
$condition = new DatabaseCondition('OR');