aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableCopy.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPTableCopy.m')
-rw-r--r--Source/SPTableCopy.m26
1 files changed, 14 insertions, 12 deletions
diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m
index 47c425a7..fd9b9055 100644
--- a/Source/SPTableCopy.m
+++ b/Source/SPTableCopy.m
@@ -91,23 +91,27 @@
{
BOOL success = YES;
- //disable foreign key checks
+ // Disable foreign key checks
[connection queryString:@"/*!32352 SET foreign_key_checks=0 */"];
- if([connection queryErrored])
+
+ if ([connection queryErrored]) {
success = NO;
+ }
- //copy tables
- for(NSString *tableName in tablesArray) {
- if(![self copyTable:tableName from:sourceDB to:targetDB withContent:copyWithContent])
+ for (NSString *tableName in tablesArray)
+ {
+ if (![self copyTable:tableName from:sourceDB to:targetDB withContent:copyWithContent]) {
success = NO;
+ }
}
- //enable foreign key checks
+ // Enable foreign key checks
[connection queryString:@"/*!32352 SET foreign_key_checks=1 */"];
- if([connection queryErrored])
+
+ if ([connection queryErrored]) {
success = NO;
+ }
- //done
return success;
}
@@ -119,12 +123,10 @@
[targetDB backtickQuotedString],
[tableName backtickQuotedString]
];
- // Move the table
+
[connection queryString:moveStatement];
- if ([connection queryErrored]) return NO;
-
- return YES;
+ return ![connection queryErrored];
}
@end