}
#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;
}
'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<user>\\S+)|password=(?P<password>\\S+))'),