Fix IGNORE option for sqlite update
authoraude <aude.wiki@gmail.com>
Wed, 12 Mar 2014 12:25:20 +0000 (13:25 +0100)
committeraude <aude.wiki@gmail.com>
Wed, 12 Mar 2014 16:37:17 +0000 (17:37 +0100)
this fixes the issue of the normalized sqlite
IGNORE option being discarded and ignored in
DatabaseBase::makeUpdateOptions.

Change-Id: I01579dee0f939a56c086d13683a60f4400014f62

includes/db/Database.php
includes/db/DatabaseSqlite.php

index 21c868e..967d7a1 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+
 /**
  * @defgroup Database Database
  *
@@ -1921,12 +1922,12 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
        }
 
        /**
-        * Make UPDATE options for the DatabaseBase::update function
+        * Make UPDATE options array for DatabaseBase::makeUpdateOptions
         *
-        * @param array $options The options passed to DatabaseBase::update
-        * @return string
+        * @param array $options
+        * @return array
         */
-       protected function makeUpdateOptions( $options ) {
+       protected function makeUpdateOptionsArray( $options ) {
                if ( !is_array( $options ) ) {
                        $options = array( $options );
                }
@@ -1941,6 +1942,18 @@ abstract class DatabaseBase implements IDatabase, DatabaseType {
                        $opts[] = 'IGNORE';
                }
 
+               return $opts;
+       }
+
+    /**
+     * Make UPDATE options for the DatabaseBase::update function
+     *
+     * @param array $options The options passed to DatabaseBase::update
+     * @return string
+     */
+       protected function makeUpdateOptions( $options ) {
+               $opts = $this->makeUpdateOptionsArray( $options );
+
                return implode( ' ', $opts );
        }
 
index 0fa29a1..3313d25 100644 (file)
@@ -522,10 +522,11 @@ class DatabaseSqlite extends DatabaseBase {
         * @param array $options
         * @return string
         */
-       protected function makeUpdateOptions( $options ) {
+       protected function makeUpdateOptionsArray( $options ) {
+               $options = parent::makeUpdateOptionsArray( $options );
                $options = self::fixIgnore( $options );
 
-               return parent::makeUpdateOptions( $options );
+               return $options;
        }
 
        /**