aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseCopy.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-05-04 14:36:30 +0000
committerstuconnolly <stuart02@gmail.com>2012-05-04 14:36:30 +0000
commit5544489096885e4e4be1ab6e54160caaa44c03dc (patch)
tree52b2201bf491d1e3495d506e7c282b3509e33808 /Source/SPDatabaseCopy.m
parent830790b9251a36f3d1290a3f9ead62195d61f00a (diff)
downloadsequelpro-5544489096885e4e4be1ab6e54160caaa44c03dc.tar.gz
sequelpro-5544489096885e4e4be1ab6e54160caaa44c03dc.tar.bz2
sequelpro-5544489096885e4e4be1ab6e54160caaa44c03dc.zip
Add initial support of moving views when renaming a database. Currently not hooked up yet. Part of issue #1235.
Diffstat (limited to 'Source/SPDatabaseCopy.m')
-rw-r--r--Source/SPDatabaseCopy.m39
1 files changed, 7 insertions, 32 deletions
diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m
index ea45c4af..130f5d99 100644
--- a/Source/SPDatabaseCopy.m
+++ b/Source/SPDatabaseCopy.m
@@ -25,36 +25,18 @@
#import "SPDBActionCommons.h"
#import "SPDatabaseCopy.h"
#import "SPTableCopy.h"
+
#import <SPMySQL/SPMySQL.h>
@implementation SPDatabaseCopy
-@synthesize dbInfo;
-
-- (SPDatabaseInfo *)getDBInfoObject
-{
- if (dbInfo != nil) {
- return dbInfo;
- }
- else {
- dbInfo = [[SPDatabaseInfo alloc] init];
-
- [dbInfo setConnection:[self connection]];
- [dbInfo setMessageWindow:messageWindow];
- }
-
- return dbInfo;
-}
-
- (BOOL)copyDatabaseFrom:(NSString *)sourceDatabaseName to:(NSString *)targetDatabaseName withContent:(BOOL)copyWithContent
{
NSArray *tables = nil;
-
- SPDatabaseInfo *databaseInfo = [self getDBInfoObject];
-
- // Check, whether the source database exists and the target database doesn't.
- BOOL sourceExists = [databaseInfo databaseExists:sourceDatabaseName];
- BOOL targetExists = [databaseInfo databaseExists:targetDatabaseName];
+
+ // Check whether the source database exists and the target database doesn't.
+ BOOL sourceExists = [[connection databases] containsObject:sourceDatabaseName];
+ BOOL targetExists = [[connection databases] containsObject:targetDatabaseName];
if (sourceExists && !targetExists) {
@@ -65,9 +47,8 @@
return NO;
}
- //abort here if database creation failed
- if(![self createDatabase:targetDatabaseName])
- return NO;
+ // Abort if database creation failed
+ if (![self createDatabase:targetDatabaseName]) return NO;
SPTableCopy *dbActionTableCopy = [[SPTableCopy alloc] init];
@@ -91,10 +72,4 @@
return YES;
}
-- (void)dealloc
-{
- [dbInfo release], dbInfo = nil;
- [super dealloc];
-}
-
@end