aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2009-05-19 14:06:32 +0000
committerstuconnolly <stuart02@gmail.com>2009-05-19 14:06:32 +0000
commit0ad4a219afda9e2c00db4dd80598d17ce6bf0c1f (patch)
treecd439e749894ee5d03f0c0af05505bd88d850f8c /Source
parent7115982d90ccc4e601d1d20ffb12bedb18978d10 (diff)
downloadsequelpro-0ad4a219afda9e2c00db4dd80598d17ce6bf0c1f.tar.gz
sequelpro-0ad4a219afda9e2c00db4dd80598d17ce6bf0c1f.tar.bz2
sequelpro-0ad4a219afda9e2c00db4dd80598d17ce6bf0c1f.zip
When adding a new table allow the user to specify the storage engine used.
Diffstat (limited to 'Source')
-rw-r--r--Source/TablesList.h1
-rw-r--r--Source/TablesList.m21
2 files changed, 22 insertions, 0 deletions
diff --git a/Source/TablesList.h b/Source/TablesList.h
index 6bc0d76b..a745f9ba 100644
--- a/Source/TablesList.h
+++ b/Source/TablesList.h
@@ -58,6 +58,7 @@ enum sp_table_types
IBOutlet id tableSheet;
IBOutlet id tableNameField;
IBOutlet id tableEncodingButton;
+ IBOutlet id tableTypeButton;
IBOutlet id addTableButton;
IBOutlet id tableRenameSheet;
IBOutlet id tableRenameField;
diff --git a/Source/TablesList.m b/Source/TablesList.m
index f0e7abd3..6173a5d2 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -204,6 +204,22 @@
[tableWindow endEditingFor:nil];
+ // Populate the table type (engine) popup button
+ [tableTypeButton removeAllItems];
+
+ CMMCPResult *engines = [mySQLConnection queryString:@"SELECT engine FROM information_schema.engines"];
+
+ [engines dataSeek:0];
+
+ // Add default menu item
+ [tableTypeButton addItemWithTitle:@"Default"];
+ [[tableTypeButton menu] addItem:[NSMenuItem separatorItem]];
+
+ for (int i = 0; i < [engines numOfRows]; i++)
+ {
+ [tableTypeButton addItemWithTitle:[[engines fetchRowAsArray] objectAtIndex:0]];
+ }
+
[NSApp beginSheet:tableSheet
modalForWindow:tableWindow
modalDelegate:self
@@ -230,6 +246,11 @@
createStatement = [NSString stringWithFormat:@"%@ DEFAULT CHARACTER SET %@", createStatement, [[tableDocumentInstance mysqlEncodingFromDisplayEncoding:[tableEncodingButton title]] backtickQuotedString]];
}
+ // If there is a type selected other than the default we must specify it in CREATE TABLE statement
+ if ([tableTypeButton indexOfSelectedItem] > 0) {
+ createStatement = [NSString stringWithFormat:@"%@ ENGINE = %@", createStatement, [[tableTypeButton title] backtickQuotedString]];
+ }
+
// Create the table
[mySQLConnection queryString:createStatement];