]> git.nbdom.net Git - nb.git/commitdiff
dump
authorNicolas Boisselier <nicolas.boisselier@semantico.com>
Mon, 4 Jul 2016 14:49:46 +0000 (15:49 +0100)
committerNicolas Boisselier <nicolas.boisselier@semantico.com>
Mon, 4 Jul 2016 14:49:46 +0000 (15:49 +0100)
lib/php/db.php
lib/php/db/types/mysql.php

index e9685303d5c31e450b0ecbab006f1e4de0dced31..ce3753d16ed60da60df797a389ac036e791b1e7f 100644 (file)
@@ -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;
     }
index fcbe8b2a45aaf1052b0e4a7818ce5f38bd9b5de4..e155064e921b8f637a8d792cac7f042cd4c5fce4 100644 (file)
@@ -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<user>\\S+)|password=(?P<password>\\S+))'),