aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2014-09-18 22:43:40 +0200
committerMax <post@wickenrode.com>2014-09-18 22:43:40 +0200
commita86bed3db5f1f5528b9ce38052373286719c2313 (patch)
tree99738efeec35920e9487679e72db6c06775882f8
parentd1425fb1442d9594285dd3abf4aa19b9946e95c9 (diff)
downloadsequelpro-a86bed3db5f1f5528b9ce38052373286719c2313.tar.gz
sequelpro-a86bed3db5f1f5528b9ce38052373286719c2313.tar.bz2
sequelpro-a86bed3db5f1f5528b9ce38052373286719c2313.zip
Disable ID generation during duplicate database
Should fix #1978
-rw-r--r--Source/SPTableCopy.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m
index bc2474ba..cd3fc42e 100644
--- a/Source/SPTableCopy.m
+++ b/Source/SPTableCopy.m
@@ -98,6 +98,13 @@
success = NO;
}
+ // Disable auto-id creation for '0' values
+ [connection queryString:@"/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */"];
+
+ if([connection queryErrored]) {
+ success = NO;
+ }
+
for (NSString *tableName in tablesArray)
{
if (![self copyTable:tableName from:sourceDB to:targetDB withContent:copyWithContent]) {
@@ -112,6 +119,13 @@
success = NO;
}
+ // re-enable id creation
+ [connection queryString:@"/*!40101 SET SQL_MODE=@OLD_SQL_MODE */"];
+
+ if ([connection queryErrored]) {
+ success = NO;
+ }
+
return success;
}