diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTableCopy.m | 14 |
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; } |