aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableCopy.m
diff options
context:
space:
mode:
authordrx777 <david.rekowski@gmx.de>2010-04-28 23:09:12 +0000
committerdrx777 <david.rekowski@gmx.de>2010-04-28 23:09:12 +0000
commitbc4c01b1c4729e3be448503e6ad2f6799834abca (patch)
tree26ad0baae641ecd91e2449f7f72652dd3bf9de0e /Source/SPTableCopy.m
parentd6bf18b27e7e6e744b24ff69ec8bc0cce134f8eb (diff)
downloadsequelpro-bc4c01b1c4729e3be448503e6ad2f6799834abca.tar.gz
sequelpro-bc4c01b1c4729e3be448503e6ad2f6799834abca.tar.bz2
sequelpro-bc4c01b1c4729e3be448503e6ad2f6799834abca.zip
* removed SPDatabaseCopyTest testCopyDatabaseTables which is out of place here
* minor restructuring of SPTableCopy for readability and debuggability * corrected wrong default copyright header on some files * SPCopyTableTest: removed testCopyTableFromTo since it is integrated in testCopyTableFromToWithData; * SPCopyTableTest: fixed test to reflect two queries table creation (show create and create) instead of create like (<4.1 compatibility)
Diffstat (limited to 'Source/SPTableCopy.m')
-rw-r--r--Source/SPTableCopy.m10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m
index acf03312..1e0a4d63 100644
--- a/Source/SPTableCopy.m
+++ b/Source/SPTableCopy.m
@@ -52,20 +52,21 @@
@"show create table error informative message"),
[connection getLastErrorMessage]]);
}
- NSLog(@"%i", [theResult numOfRows]);
if ([theResult numOfRows] != 0) {
- NSString *createTableStatment = [[theResult fetchRowAsArray] objectAtIndex:1];
- return createTableStatment;
+ return [[theResult fetchRowAsArray] objectAtIndex:1];
}
+ return @"";
}
- (BOOL)copyTable:(NSString *)tableName from: (NSString *)sourceDB to: (NSString *)targetDB {
- NSMutableString *createTableStatement = [[NSMutableString alloc] initWithString:[self getCreateTableStatementFor:tableName inDB:sourceDB]];
+ NSString *createTableResult = [self getCreateTableStatementFor:tableName inDB:sourceDB];
+ NSMutableString *createTableStatement = [[NSMutableString alloc] initWithString:createTableResult];
// adding the target DB name and the separator dot after "CREATE TABLE ".
[createTableStatement insertString:@"." atIndex:13];
[createTableStatement insertString:[targetDB backtickQuotedString] atIndex:13];
+ NSLog(@"%@", createTableStatement);
/*
// this only works with MySQL >= 4.1
NSString *copyStatement = [NSString stringWithFormat:@"CREATE TABLE %@.%@ LIKE %@.%@",
@@ -106,7 +107,6 @@
[sourceDB backtickQuotedString],
[tableName backtickQuotedString]
];
- DLog(@"Copying table data: %@", copyDataStatement);
[connection queryString:copyDataStatement];
if ([connection queryErrored]) {