From 8d2fc4f007c50fd8afb1a4c676cdd13e599c5ec0 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Mon, 4 Jul 2016 15:49:46 +0100 Subject: [PATCH] dump --- lib/php/db.php | 2 +- lib/php/db/types/mysql.php | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/php/db.php b/lib/php/db.php index e9685303..ce3753d1 100644 --- a/lib/php/db.php +++ b/lib/php/db.php @@ -637,7 +637,7 @@ class Db extends nb { } #echo 'DROP TABLE IF EXISTS '.$t->sql_name().';'.NB_EOL; echo 'DROP '.strtoupper($t->type).' IF EXISTS '.$t->sql_name().';'.NB_EOL; - echo rtrim($t->create(),';').';'.NB_EOL; + echo str_replace(';CREATE',";\nCREATE",rtrim($t->create(),';')).';'.NB_EOL; if ($insert and $t->type == 'table') $t->rows(); #break; } diff --git a/lib/php/db/types/mysql.php b/lib/php/db/types/mysql.php index fcbe8b2a..e155064e 100644 --- a/lib/php/db/types/mysql.php +++ b/lib/php/db/types/mysql.php @@ -8,10 +8,18 @@ $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)), - (Db::p('db.type') ? 'SET SESSION sql_mode=PIPES_AS_CONCAT' : null), -], +'exec' => array_merge( + [ + 'SET NAMES '.str_replace('utf-8','utf8',strtolower(Db::$encoding)), + ], + (Db::p('db.type') ? [ + 'SET SESSION sql_mode=PIPES_AS_CONCAT', + "/*!40103 SET TIME_ZONE='+00:00' */", + '/*!40014 SET @@UNIQUE_CHECKS=0 */', + '/*!40014 SET @@FOREIGN_KEY_CHECKS=0 */', + "/*!40101 SET @SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */", + ] : []) +), 'extra_where' => 'having', 'localFile' => array (getenv('HOME').'/.my.cnf','^(?:user(?:name)?=(?P\\S+)|password=(?P\\S+))'), -- 2.47.3