[BUGFIX] exec_INSERTmultipleRows doesn't check alternative handlers
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 8 Apr 2013 21:41:15 +0000 (23:41 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 9 Apr 2013 14:31:43 +0000 (16:31 +0200)
The function just passes the function call to it's parents insert
function when the type of the current handler is "native".
When using an alternative handler than "_DEFAULT" for a table, wich
connection is also "native", it will directly forward the call without
respecting my mapping for the table to another handler.

Similar to the other methods, this is solved by first fetching
the handler for the current table and then feeding the created
SQL string to mysql_query on given handler link.

The patch additionaly fixes db errors in 6.1 after mysqli switch.

Change-Id: I0c984b355916a99603ed72f0606e173608e4de81
Fixes: #34327
Releases: 6.1, 6.0, 4.7, 4.5
Reviewed-on: https://review.typo3.org/9272
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/dbal/Classes/Database/DatabaseConnection.php

index 0279c54..9f236cd 100644 (file)
@@ -557,7 +557,11 @@ class DatabaseConnection extends \TYPO3\CMS\Core\Database\DatabaseConnection {
         */
        public function exec_INSERTmultipleRows($table, array $fields, array $rows, $no_quote_fields = FALSE) {
                if ((string) $this->handlerCfg[$this->lastHandlerKey]['type'] === 'native') {
-                       return parent::exec_INSERTmultipleRows($table, $fields, $rows, $no_quote_fields);
+                       $this->lastHandlerKey = $this->handler_getFromTableList($table);
+                       mysql_query(
+                               parent::INSERTmultipleRows($table, $fields, $rows, $no_quote_fields),
+                               $this->handlerInstance[$this->lastHandlerKey]['link']
+                       );
                }
                foreach ($rows as $row) {
                        $fields_values = array();