aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
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];