aboutsummaryrefslogtreecommitdiffstats
path: root/Source/TablesList.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2009-06-05 17:44:48 +0000
committerBibiko <bibiko@eva.mpg.de>2009-06-05 17:44:48 +0000
commit7b5f4d96727a505b67b7970e0b4f2ca1de0394a2 (patch)
tree79c322f805286c5cfa1e37c40da9e8e8278b458a /Source/TablesList.m
parent67a3148cec8bc7d1c6f52f60c8ce93a4fe0b8ece (diff)
downloadsequelpro-7b5f4d96727a505b67b7970e0b4f2ca1de0394a2.tar.gz
sequelpro-7b5f4d96727a505b67b7970e0b4f2ca1de0394a2.tar.bz2
sequelpro-7b5f4d96727a505b67b7970e0b4f2ca1de0394a2.zip
• reload table list, database pull-down menu according to user's statements in the Custom Query editor if necessary
- if statement begins with: use, create, alter, rename, drop • reload table list, database pull-down menu according to imported statements • sped up "Import MySQL Dump" • fixed some tiny issues of the last commit
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r--Source/TablesList.m10
1 files changed, 4 insertions, 6 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m
index b5536fd9..2d8ad1dc 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -52,7 +52,8 @@
NSInteger selectedRowIndex;
selectedRowIndex = [tablesListView selectedRow];
- if(selectedRowIndex > 0 && [tables count]){
+
+ if(selectedRowIndex > 0 && [tables count] && selectedRowIndex < [tables count]){
selectedTable = [NSString stringWithString:[tables objectAtIndex:selectedRowIndex]];
}
@@ -187,7 +188,7 @@
[tablesListView reloadData];
- //if the previous selected table still exists, select it
+ // if the previous selected table still exists, select it
if( selectedTable != nil && [tables indexOfObject:selectedTable] < [tables count]) {
[tablesListView selectRowIndexes:[NSIndexSet indexSetWithIndex:[tables indexOfObject:selectedTable]] byExtendingSelection:NO];
}
@@ -489,8 +490,6 @@
[scanner scanUpToString:@"" intoString:&scanString];
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE %@ %@", [[copyTableNameField stringValue] backtickQuotedString], scanString]];
}
- [scanner release];
-
else if(tblType == SP_TABLETYPE_FUNC || tblType == SP_TABLETYPE_PROC)
{
// get the create syntax
@@ -518,13 +517,13 @@
// replace the old name by the new one and drop the old one
[mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[copyTableNameField stringValue] backtickQuotedString]]];
[tableSyntax release];
-
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't duplicate '%@'.\nMySQL said: %@", @"message of panel when an item cannot be renamed"), [copyTableNameField stringValue], [mySQLConnection getLastErrorMessage]]);
}
}
+ [scanner release];
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
//error while creating new table
@@ -988,7 +987,6 @@
// replace the old name by the new one and drop the old one
[mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", tableType] withString:[anObject backtickQuotedString]]];
[tableSyntax release];
-
if ([[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
if ([mySQLConnection isConnected]) {
[mySQLConnection queryString: [NSString stringWithFormat: @"DROP %@ %@", tableType, [[tables objectAtIndex:rowIndex] backtickQuotedString]]];