aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/SPDBActionCommons.h5
-rw-r--r--Source/SPDatabaseCopy.h4
-rw-r--r--Source/SPDatabaseCopy.m59
-rw-r--r--Source/SPDatabaseDocument.m45
-rw-r--r--Source/SPDatabaseInfo.m28
-rw-r--r--Source/SPDatabaseRename.h9
-rw-r--r--Source/SPDatabaseRename.m94
-rw-r--r--Source/SPTableCopy.m87
8 files changed, 156 insertions, 175 deletions
diff --git a/Source/SPDBActionCommons.h b/Source/SPDBActionCommons.h
index 1b7185bd..6ff6e11c 100644
--- a/Source/SPDBActionCommons.h
+++ b/Source/SPDBActionCommons.h
@@ -23,7 +23,6 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import <MCPKit/MCPKit.h>
-#import "SPAlertSheets.h"
@interface SPDBActionCommons : NSObject
{
@@ -32,12 +31,12 @@
}
/**
- * @property MCPConnection references the MCPKit connection to MySQL; it has to be set.
+ * @property connection References the MCPKit connection to MySQL; it has to be set.
*/
@property (retain) MCPConnection *connection;
/**
- * @property the NSWindow instance to send message sheets to
+ * @property messageWindow The NSWindow instance to send message sheets to.
*/
@property (assign) NSWindow *messageWindow;
diff --git a/Source/SPDatabaseCopy.h b/Source/SPDatabaseCopy.h
index a146bbf4..56a7e26a 100644
--- a/Source/SPDatabaseCopy.h
+++ b/Source/SPDatabaseCopy.h
@@ -53,7 +53,7 @@
* @param NSString targetDatabaseName the name of the target database
* @result BOOL success
*/
-- (BOOL)copyDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName withContent: (BOOL)copyWithContent;
+- (BOOL)copyDatabaseFrom:(NSString *)sourceDatabaseName to:(NSString *)targetDatabaseName withContent:(BOOL)copyWithContent;
/**
* This method creates a new database.
@@ -61,6 +61,6 @@
* @param NSString newDatabaseName name of the new database to be created
* @return BOOL YES on success, otherwise NO
*/
-- (BOOL) createDatabase: (NSString *)newDatabaseName;
+- (BOOL)createDatabase:(NSString *)newDatabaseName;
@end
diff --git a/Source/SPDatabaseCopy.m b/Source/SPDatabaseCopy.m
index 913554c2..8942dee1 100644
--- a/Source/SPDatabaseCopy.m
+++ b/Source/SPDatabaseCopy.m
@@ -30,41 +30,44 @@
@synthesize dbInfo;
-- (SPDatabaseInfo *)getDBInfoObject {
+- (SPDatabaseInfo *)getDBInfoObject
+{
if (dbInfo != nil) {
return dbInfo;
- } else {
+ }
+ else {
dbInfo = [[SPDatabaseInfo alloc] init];
+
[dbInfo setConnection:[self connection]];
[dbInfo setMessageWindow:messageWindow];
}
+
return dbInfo;
}
-- (BOOL)copyDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName withContent:(BOOL)copyWithContent {
-
+- (BOOL)copyDatabaseFrom:(NSString *)sourceDatabaseName to:(NSString *)targetDatabaseName withContent:(BOOL)copyWithContent
+{
SPDatabaseInfo *databaseInfo = [self getDBInfoObject];
- // check, whether the source database exists and the target database doesn't.
+
+ // Check, whether the source database exists and the target database doesn't.
NSArray *tables = [NSArray array];
+
BOOL sourceExists = [databaseInfo databaseExists:sourceDatabaseName];
BOOL targetExists = [databaseInfo databaseExists:targetDatabaseName];
+
if (sourceExists && !targetExists) {
- // retrieve the list of tables/views/funcs/triggers from the source database
-
- tables = [connection listTablesFromDB:sourceDatabaseName];
- } else {
- SPBeginAlertSheet(NSLocalizedString(@"Cannot create existing database", @"create database exists error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create the target database.\n\nDatabase %@ already exists.",
- @"create database error informative message"),
- targetDatabaseName]);
+ // Retrieve the list of tables/views/funcs/triggers from the source database
+ tables = [connection listTablesFromDB:sourceDatabaseName];
+ }
+ else {
return NO;
}
- DLog(@"list of found tables of source db: %@", tables);
-
+
BOOL success = [self createDatabase:targetDatabaseName];
+
SPTableCopy *dbActionTableCopy = [[SPTableCopy alloc] init];
+
[dbActionTableCopy setConnection:connection];
for (NSString *currentTable in tables) {
@@ -82,26 +85,20 @@
return success;
}
-- (BOOL) createDatabase: (NSString *)newDatabaseName {
- NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE %@",
- [newDatabaseName backtickQuotedString]];
+- (BOOL)createDatabase:(NSString *)newDatabaseName
+{
+ NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE %@", [newDatabaseName backtickQuotedString]];
+
[connection queryString:createStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to create database", @"create database error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create the target database.\n\nMySQL said: %@",
- @"create database error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
- return YES;
-
+ if ([connection queryErrored]) return NO;
+ return YES;
}
-- (void)dealloc {
- [dbInfo dealloc];
+- (void)dealloc
+{
+ [dbInfo release], dbInfo = nil;
}
diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m
index 3a0e029d..27e773b9 100644
--- a/Source/SPDatabaseDocument.m
+++ b/Source/SPDatabaseDocument.m
@@ -4673,41 +4673,60 @@
@implementation SPDatabaseDocument (PrivateAPI)
-- (void)_copyDatabase {
+- (void)_copyDatabase
+{
if ([[databaseCopyNameField stringValue] isEqualToString:@""]) {
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given"));
return;
}
+
SPDatabaseCopy *dbActionCopy = [[SPDatabaseCopy alloc] init];
- [dbActionCopy setConnection: [self getConnection]];
- [dbActionCopy setMessageWindow: parentWindow];
+
+ [dbActionCopy setConnection:[self getConnection]];
+ [dbActionCopy setMessageWindow:parentWindow];
BOOL copyWithContent = [copyDatabaseDataButton state] == NSOnState;
- if ([dbActionCopy copyDatabaseFrom: [self database]
- to: [databaseCopyNameField stringValue]
- withContent: copyWithContent]) {
+ if ([dbActionCopy copyDatabaseFrom:[self database] to:[databaseCopyNameField stringValue] withContent:copyWithContent]) {
[self selectDatabase:[databaseCopyNameField stringValue] item:nil];
}
+ else {
+ SPBeginAlertSheet(NSLocalizedString(@"Unable to copy database", @"unable to copy database message"),
+ NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to copy the database '%@' to '%@'.", @"unable to copy database message informative message"), [self database], [databaseCopyNameField stringValue]]);
+ }
+
[dbActionCopy release];
- [self setDatabases: self];
+
+ // Update DB list
+ [self setDatabases:self];
}
-- (void)_renameDatabase {
+- (void)_renameDatabase
+{
if ([[databaseRenameNameField stringValue] isEqualToString:@""]) {
SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given"));
return;
}
+
SPDatabaseRename *dbActionRename = [[SPDatabaseRename alloc] init];
- [dbActionRename setConnection: [self getConnection]];
- [dbActionRename setMessageWindow: parentWindow];
- if ([dbActionRename renameDatabaseFrom: [self database]
- to: [databaseRenameNameField stringValue]]) {
+ [dbActionRename setConnection:[self getConnection]];
+ [dbActionRename setMessageWindow:parentWindow];
+
+ if ([dbActionRename renameDatabaseFrom:[self database] to:[databaseRenameNameField stringValue]]) {
[self selectDatabase:[databaseRenameNameField stringValue] item:nil];
}
+ else {
+ SPBeginAlertSheet(NSLocalizedString(@"Unable to rename database", @"unable to rename database message"),
+ NSLocalizedString(@"OK", @"OK button"), nil, nil, parentWindow, self, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to rename the database '%@' to '%@'.", @"unable to rename database message informative message"), [self database], [databaseRenameNameField stringValue]]);
+ }
+
[dbActionRename release];
- [self setDatabases: self];
+
+ // Update DB list
+ [self setDatabases:self];
}
/**
diff --git a/Source/SPDatabaseInfo.m b/Source/SPDatabaseInfo.m
index 551a1c77..3c70aec9 100644
--- a/Source/SPDatabaseInfo.m
+++ b/Source/SPDatabaseInfo.m
@@ -27,42 +27,44 @@
@implementation SPDatabaseInfo
--(BOOL)databaseExists:(NSString *)databaseName {
+-(BOOL)databaseExists:(NSString *)databaseName
+{
NSArray *names = [self listDBs];
+
return [names containsObject:databaseName];
}
-- (NSArray *)listDBs {
+- (NSArray *)listDBs
+{
return [self listDBsLike:nil];
}
- (NSArray *)listDBsLike:(NSString *)dbsName
{
NSString *listDBStatement = nil;
+
if ((dbsName == nil) || ([dbsName isEqualToString:@""])) {
listDBStatement = [NSString stringWithFormat:@"SHOW DATABASES"];
}
else {
listDBStatement = [NSString stringWithFormat:@"SHOW DATABASES LIKE %@", [dbsName backtickQuotedString]];
}
- DLog(@"running query : %@", listDBStatement);
+
MCPResult *theResult = [connection queryString:listDBStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to retrieve databases list", @"database list error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to retrieve a list of databases.\n\nMySQL said: %@",
- @"database list error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
+ if ([connection queryErrored]) return NO;
NSMutableArray *names = [NSMutableArray array];
NSMutableString *name;
+
if ([theResult numOfRows] > 1) {
- int i;
- for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
+
+ NSUInteger i;
+
+ for (i = 0 ; i < [theResult numOfRows]; i++)
+ {
name = [[theResult fetchRowAsArray] objectAtIndex:0];
+
[names addObject:name];
}
}
diff --git a/Source/SPDatabaseRename.h b/Source/SPDatabaseRename.h
index 6273c4dd..e679f476 100644
--- a/Source/SPDatabaseRename.h
+++ b/Source/SPDatabaseRename.h
@@ -23,7 +23,8 @@
// More info at <http://code.google.com/p/sequel-pro/>
#import "SPDBActionCommons.h"
-#import "SPDatabaseInfo.h"
+
+@class SPDatabaseInfo;
/**
* The SPDatabaseRename class povides functionality to rename a database.
@@ -53,7 +54,7 @@
* @param NSString targetDatabaseName the name of the target database
* @result BOOL success
*/
-- (BOOL)renameDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName;
+- (BOOL)renameDatabaseFrom:(NSString *)sourceDatabaseName to:(NSString *)targetDatabaseName;
/**
* This method creates a new database.
@@ -61,7 +62,7 @@
* @param NSString newDatabaseName name of the new database to be created
* @return BOOL YES on success, otherwise NO
*/
-- (BOOL) createDatabase: (NSString *)newDatabaseName;
+- (BOOL)createDatabase:(NSString *)newDatabaseName;
/**
* This method drops a database.
@@ -69,6 +70,6 @@
* @param NSString databaseName name of the database to drop
* @return BOOL YES on success, otherwise NO
*/
-- (BOOL) dropDatabase: (NSString *)databaseName;
+- (BOOL)dropDatabase:(NSString *)databaseName;
@end
diff --git a/Source/SPDatabaseRename.m b/Source/SPDatabaseRename.m
index 33d01724..b565b406 100644
--- a/Source/SPDatabaseRename.m
+++ b/Source/SPDatabaseRename.m
@@ -30,97 +30,85 @@
@synthesize dbInfo;
-- (SPDatabaseInfo *)getDBInfoObject {
+- (SPDatabaseInfo *)getDBInfoObject
+{
if (dbInfo != nil) {
return dbInfo;
- } else {
+ }
+ else {
dbInfo = [[SPDatabaseInfo alloc] init];
+
[dbInfo setConnection:[self connection]];
[dbInfo setMessageWindow:messageWindow];
}
+
return dbInfo;
}
-- (BOOL)renameDatabaseFrom: (NSString *)sourceDatabaseName to: (NSString *)targetDatabaseName {
+- (BOOL)renameDatabaseFrom:(NSString *)sourceDatabaseName to:(NSString *)targetDatabaseName
+{
SPDatabaseInfo *databaseInfo = [self getDBInfoObject];
- // check, whether the source database exists and the target database doesn't.
+ // Check, whether the source database exists and the target database doesn't.
NSArray *tables = [NSArray array];
+
BOOL sourceExists = [databaseInfo databaseExists:sourceDatabaseName];
BOOL targetExists = [databaseInfo databaseExists:targetDatabaseName];
+
if (sourceExists && !targetExists) {
- // retrieve the list of tables/views/funcs/triggers from the source database
+ // Retrieve the list of tables/views/funcs/triggers from the source database
tables = [connection listTablesFromDB:sourceDatabaseName];
- } else {
- SPBeginAlertSheet(NSLocalizedString(@"Cannot create existing database", @"create database exists error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create the target database.\n\nDatabase %@ already exists.",
- @"create database error informative message"),
- targetDatabaseName]);
+ }
+ else {
return NO;
}
- DLog(@"list of found tables of source db: %@", tables);
-
+
BOOL success = [self createDatabase:targetDatabaseName];
+
SPTableCopy *dbActionTableCopy = [[SPTableCopy alloc] init];
+
[dbActionTableCopy setConnection:connection];
- for (NSString *currentTable in tables) {
- if ([dbActionTableCopy moveTable:currentTable
- from:sourceDatabaseName
- to:targetDatabaseName]) {
- } else {
- success = FALSE;
- }
+ for (NSString *currentTable in tables)
+ {
+ success = [dbActionTableCopy moveTable:currentTable from:sourceDatabaseName to:targetDatabaseName];
}
+
tables = [connection listTablesFromDB:sourceDatabaseName];
+
if ([tables count] == 0) {
[self dropDatabase:sourceDatabaseName];
- } else {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to delete database", @"delete database error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Database %@ not empty, skipping drop database.",
- @"delete database not empty error informative message"),
- sourceDatabaseName]);
- }
+ }
+
return success;
}
-- (BOOL) createDatabase: (NSString *)newDatabaseName {
- NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE %@",
- [newDatabaseName backtickQuotedString]];
+- (BOOL)createDatabase:(NSString *)newDatabaseName
+{
+ NSString *createStatement = [NSString stringWithFormat:@"CREATE DATABASE %@", [newDatabaseName backtickQuotedString]];
+
[connection queryString:createStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to create database", @"create database error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to create a database.\n\nMySQL said: %@",
- @"create database error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
- return YES;
+ if ([connection queryErrored]) return NO;
+
+ return YES;
}
-- (BOOL) dropDatabase: (NSString *)databaseName {
- NSString *dropStatement = [NSString stringWithFormat:@"DROP DATABASE %@",
- [databaseName backtickQuotedString]];
+- (BOOL)dropDatabase:(NSString *)databaseName
+{
+ NSString *dropStatement = [NSString stringWithFormat:@"DROP DATABASE %@", [databaseName backtickQuotedString]];
+
[connection queryString:dropStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to drop database", @"drop database error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to drop a database.\n\nMySQL said: %@",
- @"drop database error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
- return YES;
+ if ([connection queryErrored]) return NO;
+
+ return YES;
}
-- (void)dealloc {
- [dbInfo dealloc];
+- (void)dealloc
+{
+ [dbInfo release], dbInfo = nil;
}
@end \ No newline at end of file
diff --git a/Source/SPTableCopy.m b/Source/SPTableCopy.m
index 514eaeb1..c965350a 100644
--- a/Source/SPTableCopy.m
+++ b/Source/SPTableCopy.m
@@ -27,49 +27,35 @@
@implementation SPTableCopy
-- (NSString *)getCreateTableStatementFor: (NSString *)tableName inDB: (NSString *)sourceDB {
- NSString *showCreateTableStatment = [NSString stringWithFormat:@"SHOW CREATE TABLE %@.%@",
- [sourceDB backtickQuotedString],
- [tableName backtickQuotedString]
- ];
+- (NSString *)getCreateTableStatementFor:(NSString *)tableName inDB:(NSString *)sourceDB
+{
+ NSString *showCreateTableStatment = [NSString stringWithFormat:@"SHOW CREATE TABLE %@.%@", [sourceDB backtickQuotedString], [tableName backtickQuotedString]];
+
MCPResult *theResult = [connection queryString:showCreateTableStatment];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to show create table statement", @"show create table error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to retrieve the create table statement for a table.\n\nMySQL said: %@",
- @"show create table error informative message"),
- [connection getLastErrorMessage]]);
- }
if ([theResult numOfRows] != 0) {
return [[theResult fetchRowAsArray] objectAtIndex:1];
}
+
return @"";
}
-- (BOOL)copyTable:(NSString *)tableName from: (NSString *)sourceDB to: (NSString *)targetDB {
-
+- (BOOL)copyTable:(NSString *)tableName from:(NSString *)sourceDB to:(NSString *)targetDB
+{
NSString *createTableResult = [self getCreateTableStatementFor:tableName inDB:sourceDB];
NSMutableString *createTableStatement = [[NSMutableString alloc] initWithString:createTableResult];
if ([[createTableStatement substringToIndex:12] isEqualToString:@"CREATE TABLE"]) {
- // adding the target DB name and the separator dot after "CREATE TABLE ".
+
+ // Add the target DB name and the separator dot after "CREATE TABLE ".
[createTableStatement insertString:@"." atIndex:13];
[createTableStatement insertString:[targetDB backtickQuotedString] atIndex:13];
[connection queryString:createTableStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to copy table", @"copy table error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to copy a table.\n\nMySQL said: %@",
- @"copy table error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
+ if ([connection queryErrored]) return NO;
+
return YES;
- } else {
- NSLog(@"Could not copy non-table/view %@", tableName);
}
[createTableStatement release];
@@ -77,55 +63,44 @@
return NO;
}
-- (BOOL)copyTable:(NSString *)tableName from: (NSString *)sourceDB to: (NSString *)targetDB withContent:(BOOL)copyWithContent{
- // copy the table structure
+- (BOOL)copyTable:(NSString *)tableName from:(NSString *)sourceDB to:(NSString *)targetDB withContent:(BOOL)copyWithContent
+{
+ // Copy the table structure
BOOL structureCopyResult = [self copyTable:tableName from:sourceDB to:targetDB];
- // optionally copy the table data using an insert select
- if (structureCopyResult && copyWithContent) {
+ // Optionally copy the table data using an insert select
+ if (structureCopyResult && structureCopyResult && copyWithContent) {
+
NSString *copyDataStatement = [NSString stringWithFormat:@"INSERT INTO %@.%@ SELECT * FROM %@.%@",
- [targetDB backtickQuotedString],
- [tableName backtickQuotedString],
- [sourceDB backtickQuotedString],
- [tableName backtickQuotedString]
- ];
+ [targetDB backtickQuotedString],
+ [tableName backtickQuotedString],
+ [sourceDB backtickQuotedString],
+ [tableName backtickQuotedString]
+ ];
+
[connection queryString:copyDataStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to copy table data", @"copy table data error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to copy a table's data.\n\nMySQL said: %@",
- @"copy table data error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
- return YES;
+ if ([connection queryErrored]) return NO;
+ return YES;
}
+
return structureCopyResult;
}
-- (BOOL)moveTable:(NSString *)tableName from: (NSString *)sourceDB to: (NSString *)targetDB {
-
+- (BOOL)moveTable:(NSString *)tableName from:(NSString *)sourceDB to:(NSString *)targetDB
+{
NSString *moveStatement = [NSString stringWithFormat:@"RENAME TABLE %@.%@ TO %@.%@",
[sourceDB backtickQuotedString],
[tableName backtickQuotedString],
[targetDB backtickQuotedString],
[tableName backtickQuotedString]
];
- // moving the table
- DLog(@"Moving table %@ from %@ to %@", tableName, sourceDB, targetDB);
- DLog(@"Moving table: %@", moveStatement);
+ // Move the table
[connection queryString:moveStatement];
- if ([connection queryErrored]) {
- SPBeginAlertSheet(NSLocalizedString(@"Failed to move table", @"move table error message"),
- NSLocalizedString(@"OK", @"OK button"), nil, nil, messageWindow, self, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"An error occured while trying to move a table.\n\nMySQL said: %@",
- @"move table error informative message"),
- [connection getLastErrorMessage]]);
- return NO;
- }
+ if ([connection queryErrored]) return NO;
+
return YES;
}
9 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655