Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Disable ID generation during duplicate database
- Loading branch information
Showing
with
14 additions
and
0 deletions.
-
+14
−0
Source/SPTableCopy.m
|
@@ -98,6 +98,13 @@ - (BOOL)copyTables:(NSArray *)tablesArray from:(NSString *)sourceDB to:(NSString |
|
|
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 @@ - (BOOL)copyTables:(NSArray *)tablesArray from:(NSString *)sourceDB to:(NSString |
|
|
success = NO; |
|
|
} |
|
|
|
|
|
// re-enable id creation |
|
|
[connection queryString:@"/*!40101 SET SQL_MODE=@OLD_SQL_MODE */"]; |
|
|
|
|
|
if ([connection queryErrored]) { |
|
|
success = NO; |
|
|
} |
|
|
|
|
|
return success; |
|
|
} |
|
|
|
|
|