]> git.nbdom.net Git - nb.git/commitdiff
exec
authorNicolas Boisselier <nicolas.boisselier@semantico.com>
Wed, 29 Jun 2016 13:30:32 +0000 (14:30 +0100)
committerNicolas Boisselier <nicolas.boisselier@semantico.com>
Wed, 29 Jun 2016 13:30:32 +0000 (14:30 +0100)
lib/php/db.php
lib/php/db/types/mysql.php

index 95da7c9b3de224569deaa6a3c9e7bb44cb867bc6..c12a3635deb22c7bf269829ce06f9c8d68e001d9 100644 (file)
@@ -620,7 +620,7 @@ class Db extends nb {
 
     if ($sql = $this->type('exec')) {
       foreach ((is_array($sql) ? $sql : array($sql)) as $sql) {
-        echo rtrim($sql,';').";\n";
+        if ($sql) echo rtrim($sql,';').";\n";
       }
     }
 
index 563b447f4edcdc6c342b9da4fb3ee2878dd7c4ed..9dd85f6a77baa460e7050029701f00d4c252d6a2 100644 (file)
@@ -3,7 +3,11 @@ $DB_TYPES['mysql'] = array (
 
 'quote_name' => '`',
 #'select_count' => array('SQL_CALC_FOUND_ROWS','SELECT FOUND_ROWS()'),
-'exec' => 'SET NAMES '.str_replace('utf-8','utf8',strtolower(Db::$encoding)),
+
+'exec' => [
+  'SET NAMES '.str_replace('utf-8','utf8',strtolower(Db::$encoding)),
+  (Db::p('db.type') ? 'SET sql_mode=PIPES_AS_CONCAT' : null),
+],
 'extra_where' => 'having',
 
 'localFile' => array (getenv('HOME').'/.my.cnf','^(?:user(?:name)?=(?P<user>\\S+)|password=(?P<password>\\S+))'),