From: Sam Reed Date: Thu, 26 Aug 2010 22:31:49 +0000 (+0000) Subject: Drop $options from insertOrUpdate - r71662 X-Git-Tag: 1.31.0-rc.0~35307 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/recherche.php?a=commitdiff_plain;h=d5e9d8d99760667180069d392f9cea7304571354;p=lhc%2Fweb%2Fwiklou.git Drop $options from insertOrUpdate - r71662 --- diff --git a/includes/db/Database.php b/includes/db/Database.php index 0154f8b422..0dffcdb09a 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -1164,12 +1164,11 @@ abstract class DatabaseBase { * @param $table String: table name (prefix auto-added) * @param $a Array: Array of rows to insert * @param $fname String: Calling function name (use __METHOD__) for logs/profiling - * @param $options Mixed: Associative array of options (ignored in this implementation) * @param $onDupeUpdate Array: Associative array of fields to update on duplicate * * @return bool */ - function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $options = array(), $onDupeUpdate = array() ) { + function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $onDupeUpdate = array() ) { if ( isset( $a[0] ) && is_array( $a[0] ) ) { $keys = array_keys( $a[0] ); diff --git a/includes/db/DatabaseMysql.php b/includes/db/DatabaseMysql.php index 9154c203ae..37480202b4 100644 --- a/includes/db/DatabaseMysql.php +++ b/includes/db/DatabaseMysql.php @@ -364,21 +364,18 @@ class DatabaseMysql extends DatabaseBase { * @param $table String: table name (prefix auto-added) * @param $a Array: Array of rows to insert * @param $fname String: Calling function name (use __METHOD__) for logs/profiling - * @param $options Mixed: Associative array of options * @param $onDupeUpdate Array: Associative array of fields to update on duplicate * * @return bool */ - function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $options = array(), $onDupeUpdate = array() ) { + function insertOrUpdate( $table, $a, $fname = 'DatabaseBase::insertOrUpdate', $onDupeUpdate = array() ) { # No rows to insert, easy just return now if ( !count( $a ) ) { return true; } $table = $this->tableName( $table ); - if ( !is_array( $options ) ) { - $options = array( $options ); - } + if ( isset( $a[0] ) && is_array( $a[0] ) ) { $multi = true; $keys = array_keys( $a[0] ); @@ -387,8 +384,7 @@ class DatabaseMysql extends DatabaseBase { $keys = array_keys( $a ); } - $sql = 'INSERT ' . implode( ' ', $options ) . - " INTO $table (" . implode( ',', $keys ) . ') VALUES '; + $sql = "INSERT INTO $table (" . implode( ',', $keys ) . ') VALUES '; if ( $multi ) { $first = true;