From 299268f582887ffa2586bc7a834444406ae72dc1 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Wed, 29 Jun 2016 14:30:32 +0100 Subject: [PATCH] exec --- lib/php/db.php | 2 +- lib/php/db/types/mysql.php | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/php/db.php b/lib/php/db.php index 95da7c9b..c12a3635 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -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"; } } diff --git a/lib/php/db/types/mysql.php b/lib/php/db/types/mysql.php index 563b447f..9dd85f6a 100644 --- a/lib/php/db/types/mysql.php +++ b/lib/php/db/types/mysql.php @@ -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\\S+)|password=(?P\\S+))'), -- 2.47.3