From 4ee865ac6d5f463ff1eace451bec001ef3505ca2 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Thu, 2 May 2013 12:51:53 -0400 Subject: [PATCH] Remove insert batch, as it only works for MySQL and Postgres --- classes/iquery_builder.php | 11 - classes/query_builder.php | 56 ----- docs/classes/BadConnectionException.html | 2 +- docs/classes/BadDBDriverException.html | 2 +- docs/classes/DB_PDO.html | 2 +- docs/classes/DB_Util.html | 2 +- docs/classes/Firebird.html | 2 +- docs/classes/Firebird_Result.html | 2 +- docs/classes/Firebird_SQL.html | 2 +- docs/classes/Firebird_Util.html | 2 +- docs/classes/MySQL.html | 2 +- docs/classes/MySQL_SQL.html | 2 +- docs/classes/MySQL_Util.html | 2 +- docs/classes/ODBC.html | 2 +- docs/classes/ODBC_SQL.html | 2 +- docs/classes/ODBC_Util.html | 2 +- docs/classes/PgSQL.html | 2 +- docs/classes/PgSQL_SQL.html | 2 +- docs/classes/PgSQL_Util.html | 2 +- docs/classes/Query_Builder.html | 22 +- docs/classes/Query_Parser.html | 2 +- docs/classes/SQLite.html | 2 +- docs/classes/SQLite_SQL.html | 2 +- docs/classes/SQLite_Util.html | 2 +- docs/classes/iDB_SQL.html | 2 +- docs/classes/iQuery_Builder.html | 22 +- docs/deprecated.html | 2 +- docs/errors.html | 2 +- docs/graph_class.html | 2 +- docs/markers.html | 2 +- docs/namespaces/default.html | 2 +- docs/packages/.html | 2 +- docs/packages/Default.html | 2 +- docs/packages/Query.Drivers.html | 2 +- docs/packages/Query.Query.html | 2 +- docs/packages/Query.html | 2 +- docs/structure.xml | 288 +++++++++-------------- tests/core/db_qb_test.php | 29 --- tests/db_files/FB_TEST_DB.FDB | Bin 802816 -> 802816 bytes 39 files changed, 151 insertions(+), 341 deletions(-) diff --git a/classes/iquery_builder.php b/classes/iquery_builder.php index cd5f2f8..2c32793 100644 --- a/classes/iquery_builder.php +++ b/classes/iquery_builder.php @@ -399,17 +399,6 @@ interface iQuery_Builder { // -------------------------------------------------------------------------- - /** - * Creates a batch insert clause, and executes it - * - * @param string $table - * @param mixed $data - * @return mixed - */ - public function insert_batch($table, $data=array()); - - // -------------------------------------------------------------------------- - /** * Creates an update clause, and executes it * diff --git a/classes/query_builder.php b/classes/query_builder.php index d397a8f..735d0da 100644 --- a/classes/query_builder.php +++ b/classes/query_builder.php @@ -1019,43 +1019,6 @@ class Query_Builder implements iQuery_Builder { // -------------------------------------------------------------------------- - /** - * Creates a batch insert clause and executes it - * - * @param string $table - * @param mixed $data - * @return mixed - */ - public function insert_batch($table, $data=array()) - { - // Bail out on Firebird and ODBC - $driver = str_replace('_sql', '', mb_strtolower(get_class($this->sql))); - - if ($driver == 'firebird' || $driver == 'odbc') - { - return NULL; - } - - // Can't use normal set, because it doesn't handle multidimensional arrays - foreach($data as $key => $arr) - { - $this->set_array_keys[$key] = array(); - - foreach($arr as $k => $v) - { - array_push($this->set_array_keys[$key], $k); - $this->values[] = $v; - } - - // Escape the field names - $this->set_array_keys[$key] = $this->db->quote_ident($this->set_array_keys[$key]); - } - - return $this->_run("insert_batch", $table); - } - - // -------------------------------------------------------------------------- - /** * Creates an update clause, and executes it * @@ -1324,25 +1287,6 @@ class Query_Builder implements iQuery_Builder { . implode(',', $this->set_array_keys) . ') VALUES ('.implode(',', $params).')'; break; - - case "insert_batch": - $param_count = count($this->set_array_keys[0]); - $params = array_fill(0, $param_count, '?'); - $sql = "INSERT INTO {$table} (" - . implode(',', $this->set_array_keys[0]) - . ') VALUES ( ' - . implode(',', $params) . ')'; - - // Remove the first set from the array - array_shift($this->set_array_keys); - - // Add another set of placeholders for each batch group - foreach($this->set_array_keys as $group) - { - $sql .= ',('.implode(',', $params).')'; - } - - break; case "update": $sql = "UPDATE {$table} SET {$this->set_string}"; diff --git a/docs/classes/BadConnectionException.html b/docs/classes/BadConnectionException.html index fc4f633..b7abc69 100644 --- a/docs/classes/BadConnectionException.html +++ b/docs/classes/BadConnectionException.html @@ -219,7 +219,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/BadDBDriverException.html b/docs/classes/BadDBDriverException.html index 6b5352e..09bae6c 100644 --- a/docs/classes/BadDBDriverException.html +++ b/docs/classes/BadDBDriverException.html @@ -219,7 +219,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/DB_PDO.html b/docs/classes/DB_PDO.html index dc01b1c..3d3ea1d 100644 --- a/docs/classes/DB_PDO.html +++ b/docs/classes/DB_PDO.html @@ -743,7 +743,7 @@ the connection/database
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/DB_Util.html b/docs/classes/DB_Util.html index 3c5b58e..1becc56 100644 --- a/docs/classes/DB_Util.html +++ b/docs/classes/DB_Util.html @@ -210,7 +210,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/Firebird.html b/docs/classes/Firebird.html index 8be6a18..4de197b 100644 --- a/docs/classes/Firebird.html +++ b/docs/classes/Firebird.html @@ -925,7 +925,7 @@ the last query executed
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/Firebird_Result.html b/docs/classes/Firebird_Result.html index 928bc85..7139097 100644 --- a/docs/classes/Firebird_Result.html +++ b/docs/classes/Firebird_Result.html @@ -505,7 +505,7 @@ the query
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/Firebird_SQL.html b/docs/classes/Firebird_SQL.html index 0c5dc03..5c9c204 100644 --- a/docs/classes/Firebird_SQL.html +++ b/docs/classes/Firebird_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/Firebird_Util.html b/docs/classes/Firebird_Util.html index 02458dc..777dd4c 100644 --- a/docs/classes/Firebird_Util.html +++ b/docs/classes/Firebird_Util.html @@ -213,7 +213,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/MySQL.html b/docs/classes/MySQL.html index 337b089..bb95ad8 100644 --- a/docs/classes/MySQL.html +++ b/docs/classes/MySQL.html @@ -963,7 +963,7 @@ the connection/database
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/MySQL_SQL.html b/docs/classes/MySQL_SQL.html index 3359add..9519292 100644 --- a/docs/classes/MySQL_SQL.html +++ b/docs/classes/MySQL_SQL.html @@ -239,7 +239,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/MySQL_Util.html b/docs/classes/MySQL_Util.html index 92cd38c..e5d4d7c 100644 --- a/docs/classes/MySQL_Util.html +++ b/docs/classes/MySQL_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/ODBC.html b/docs/classes/ODBC.html index f0e4812..6365cad 100644 --- a/docs/classes/ODBC.html +++ b/docs/classes/ODBC.html @@ -963,7 +963,7 @@ the connection/database
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/ODBC_SQL.html b/docs/classes/ODBC_SQL.html index ba7f925..321297f 100644 --- a/docs/classes/ODBC_SQL.html +++ b/docs/classes/ODBC_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/ODBC_Util.html b/docs/classes/ODBC_Util.html index bf37b6b..d3af245 100644 --- a/docs/classes/ODBC_Util.html +++ b/docs/classes/ODBC_Util.html @@ -204,7 +204,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/PgSQL.html b/docs/classes/PgSQL.html index 0f355b9..6756a67 100644 --- a/docs/classes/PgSQL.html +++ b/docs/classes/PgSQL.html @@ -965,7 +965,7 @@ the connection/database
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/PgSQL_SQL.html b/docs/classes/PgSQL_SQL.html index 0bf628d..f7a759b 100644 --- a/docs/classes/PgSQL_SQL.html +++ b/docs/classes/PgSQL_SQL.html @@ -234,7 +234,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/PgSQL_Util.html b/docs/classes/PgSQL_Util.html index ba90759..b81e2c5 100644 --- a/docs/classes/PgSQL_Util.html +++ b/docs/classes/PgSQL_Util.html @@ -209,7 +209,7 @@
+ generated on 2013-05-02T12:51:15-04:00.
diff --git a/docs/classes/Query_Builder.html b/docs/classes/Query_Builder.html index bedfecb..2219a4a 100644 --- a/docs/classes/Query_Builder.html +++ b/docs/classes/Query_Builder.html @@ -80,7 +80,6 @@ execute current compiled query
get()
  • Adds a paren to the current query for query grouping
    group_start()
  • Generates a 'Having' clause
    having()
  • Creates an insert clause, and executes it
    insert()
  • -
  • Creates a batch insert clause and executes it
    insert_batch()
  • Creates a join phrase in a compiled query
    join()
  • Creates a Like clause in the sql statement
    like()
  • Set a limit on the current sql statement
    limit()
  • @@ -500,25 +499,6 @@ execute current compiled query
    mixed
    -
    -

    Creates a batch insert clause and executes it

    -
    insert_batch(string $table, mixed $data) : mixed
    -
    -
    -

    -

    Parameters

    -
    -

    $table

    -string -
    -
    -

    $data

    -mixed -
    -

    Returns

    -
    mixed
    -
    -

    Creates a join phrase in a compiled query

    join(string $table, string $condition, string $type) : \Query_Builder
    @@ -1381,7 +1361,7 @@ passed array with key / value pairs
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/classes/Query_Parser.html b/docs/classes/Query_Parser.html index 4320347..db9a6e5 100644 --- a/docs/classes/Query_Parser.html +++ b/docs/classes/Query_Parser.html @@ -145,7 +145,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/classes/SQLite.html b/docs/classes/SQLite.html index 2d707df..39bc6c7 100644 --- a/docs/classes/SQLite.html +++ b/docs/classes/SQLite.html @@ -980,7 +980,7 @@ method if the database does not support 'TRUNCATE';
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/classes/SQLite_SQL.html b/docs/classes/SQLite_SQL.html index a5a33b6..83962d4 100644 --- a/docs/classes/SQLite_SQL.html +++ b/docs/classes/SQLite_SQL.html @@ -234,7 +234,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/classes/SQLite_Util.html b/docs/classes/SQLite_Util.html index d2fa0c4..6733ec2 100644 --- a/docs/classes/SQLite_Util.html +++ b/docs/classes/SQLite_Util.html @@ -209,7 +209,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/classes/iDB_SQL.html b/docs/classes/iDB_SQL.html index 0a34525..505e278 100644 --- a/docs/classes/iDB_SQL.html +++ b/docs/classes/iDB_SQL.html @@ -244,7 +244,7 @@ specified table
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/classes/iQuery_Builder.html b/docs/classes/iQuery_Builder.html index abe1215..db86fb4 100644 --- a/docs/classes/iQuery_Builder.html +++ b/docs/classes/iQuery_Builder.html @@ -78,7 +78,6 @@ execute current compiled query
    get()
  • Adds a paren to the current query for query grouping
    group_start()
  • Generates a 'Having' clause
    having()
  • Creates an insert clause, and executes it
    insert()
  • -
  • Creates a batch insert clause, and executes it
    insert_batch()
  • Creates a join phrase in a compiled query
    join()
  • Creates a Like clause in the sql statement
    like()
  • Set a limit on the current sql statement
    limit()
  • @@ -429,25 +428,6 @@ execute current compiled query
    mixed
    -
    -

    Creates a batch insert clause, and executes it

    -
    insert_batch(string $table, mixed $data) : mixed
    -
    -
    -

    -

    Parameters

    -
    -

    $table

    -string -
    -
    -

    $data

    -mixed -
    -

    Returns

    -
    mixed
    -
    -

    Creates a join phrase in a compiled query

    join(string $table, string $condition, string $type) : \iQuery_Builder
    @@ -984,7 +964,7 @@ passed array with key / value pairs
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/deprecated.html b/docs/deprecated.html index 3482422..7fcbe86 100644 --- a/docs/deprecated.html +++ b/docs/deprecated.html @@ -68,7 +68,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/errors.html b/docs/errors.html index 1178440..82de262 100644 --- a/docs/errors.html +++ b/docs/errors.html @@ -237,7 +237,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/graph_class.html b/docs/graph_class.html index 6eb2ed8..7b949bd 100644 --- a/docs/graph_class.html +++ b/docs/graph_class.html @@ -65,7 +65,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/markers.html b/docs/markers.html index c8f37fa..f9463ea 100644 --- a/docs/markers.html +++ b/docs/markers.html @@ -110,7 +110,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/namespaces/default.html b/docs/namespaces/default.html index 1e8acf7..90a0784 100644 --- a/docs/namespaces/default.html +++ b/docs/namespaces/default.html @@ -340,7 +340,7 @@ instantiates the specific db driver

    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/packages/.html b/docs/packages/.html index 8935945..6eeef33 100644 --- a/docs/packages/.html +++ b/docs/packages/.html @@ -68,7 +68,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/packages/Default.html b/docs/packages/Default.html index 7f750df..a227b0f 100644 --- a/docs/packages/Default.html +++ b/docs/packages/Default.html @@ -95,7 +95,7 @@
    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/packages/Query.Drivers.html b/docs/packages/Query.Drivers.html index 6cf43eb..9009e42 100644 --- a/docs/packages/Query.Drivers.html +++ b/docs/packages/Query.Drivers.html @@ -212,7 +212,7 @@ data-fetching methods

    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/packages/Query.Query.html b/docs/packages/Query.Query.html index 4ac3948..27374c1 100644 --- a/docs/packages/Query.Query.html +++ b/docs/packages/Query.Query.html @@ -150,7 +150,7 @@ instantiates the specific db driver

    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/packages/Query.html b/docs/packages/Query.html index 33fe0a1..88fd9ca 100644 --- a/docs/packages/Query.html +++ b/docs/packages/Query.html @@ -362,7 +362,7 @@ instantiates the specific db driver

    + generated on 2013-05-02T12:51:15-04:00.
    diff --git a/docs/structure.xml b/docs/structure.xml index babc019..bafed20 100644 --- a/docs/structure.xml +++ b/docs/structure.xml @@ -579,7 +579,7 @@ the connection/database]]> - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -1766,10 +1766,10 @@ in place of the get() method]]> - insert_batch + update function - + string @@ -1792,294 +1792,267 @@ in place of the get() method]]> - - update - function - - - - - string - - - mixed - - - mixed - - - - $table - - - - - $data - - - - - + delete function - + - + string - + mixed - + mixed - + $table - + $where - + get_compiled_select function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_insert function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_update function - + - + string - + bool - + string - + $table - + $reset - + get_compiled_delete function - + - + string - + bool - + string - + $table - + $reset - + _get_compile function - + - + string - + string - - + + - + $type - + $table - + $reset - + reset_query function - + - + void - + _run function - + - + string - + string - + bool - + mixed - + $type - + $table - + $simple - + __call function - + - + string - + array - + mixed - + $name - + $params - + _compile function - + - + string - + string - + \$string - + $type - + $table @@ -2274,7 +2247,7 @@ specified table]]>
    - + Free Query Builder / Database Abstraction Layer

    ]]>
    @@ -3134,10 +3107,10 @@ in place of the get() method]]> - insert_batch + update function - + string @@ -3161,15 +3134,15 @@ in place of the get() method]]> - update + delete function - + string - + mixed @@ -3182,44 +3155,44 @@ in place of the get() method]]> - $data - - - - - - delete - function - - - - - string - - - mixed - - - mixed - - - - $table - - - - $where - + get_compiled_select function - + + + string + + + bool + + + string + + + + $table + + + + + $reset + + + + + + get_compiled_insert + function + + + string @@ -3232,7 +3205,7 @@ in place of the get() method]]> $table - + @@ -3242,10 +3215,10 @@ in place of the get() method]]> - get_compiled_insert + get_compiled_update function - + string @@ -3259,7 +3232,7 @@ in place of the get() method]]> $table - + @@ -3269,10 +3242,10 @@ in place of the get() method]]> - get_compiled_update + get_compiled_delete function - + string @@ -3286,7 +3259,7 @@ in place of the get() method]]> $table - + @@ -3296,39 +3269,12 @@ in place of the get() method]]> - get_compiled_delete - function - - - - - string - - - bool - - - string - - - - $table - - - - - $reset - - - - - reset_query function - + - + void diff --git a/tests/core/db_qb_test.php b/tests/core/db_qb_test.php index 95e94ed..750df45 100644 --- a/tests/core/db_qb_test.php +++ b/tests/core/db_qb_test.php @@ -456,35 +456,6 @@ abstract class QBTest extends UnitTestCase { $this->assertIsA($query, 'PDOStatement'); } - - // -------------------------------------------------------------------------- - - public function TestInsertBatch() - { - if (empty($this->db)) return; - - $insert_array = array( - array( - 'id' => 11, - 'key' => 2, - 'val' => 3 - ), - array( - 'id' => 12, - 'key' => 6, - 'val' => 7 - ), - array( - 'id' => 13, - 'key' => 1, - 'val' => 2 - ) - ); - - $query = $this->db->insert_batch('test', $insert_array); - - $this->assertIsA($query, 'PDOStatement'); - } // -------------------------------------------------------------------------- diff --git a/tests/db_files/FB_TEST_DB.FDB b/tests/db_files/FB_TEST_DB.FDB index bf1e5696a6bd1c99a14d7844e455934f86d31877..2db3e914e6636bad01332f3e418ade9ad29a524d 100755 GIT binary patch delta 449 zcmYk2Jxc>Y5Qb+jiAi=YI$|s|B9||7eiR7=M6k3L!BjS$;Gu$cBHEZuh+E_WDYvlD z#==evINHwl}HZax(P*Yz$0d%rW-&!1&2HaAJH^CL`_)M z)3ELF7pCFT>m5h4Q1aLhOHV;D5`+DSsk#m(+*5(=@TmW-yPkl7pSC)wU{Q7Im|(V= zsQo)vaYkKKaCmTeUqeG(Ihgi@9S4(4SMLs*+PAH)1!mO28RpoI+G^l5)0AjnW`5un y=y_3ZsJ?sOyFX-~37A{1<2qCADkjvYg9UZe^!#50PARK_T)j1M+$}e-()s~Tj$gt6 delta 421 zcmYL^Jxc>Y5Qb+jIb(J%$wCzJfszlyohgg~MFcww8)G6`*?0jhENsNuY|gNf7_bqx zu(i}Ck(`C4g^ehd{sb!vTZx-o)ERbWo_B^9mh&R##SH?>^Eb2b9}Kx~M1x+n0QS@a z(8$$0!1mIM`I_(!7-%Z(ArMuoRyS>TA`TOb2&M_<6U;A|F4&l00l~%v3-%cGGqUgM zDQZ!7E>GX|vwnfP{Q~NhU8Z@?zjcR1;gXsVi)0`c&cSimf`*ZT^+*bABLj~{2)@Eu zSTV9NVOa2qS-4YLMQKl%gKISpqCrFOKrLBoV$wa~*b6L@;5TflkKL=a4~Rsuja!GoRQBQO;VQCHcrcE9dm(^pId9; h7LiU9WAfu17i5QHQcj(sDeX2=nP}mpTWe#z`vV`uRqg-)