aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructureDelegate.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPTableStructureDelegate.m')
-rw-r--r--Source/SPTableStructureDelegate.m14
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/SPTableStructureDelegate.m b/Source/SPTableStructureDelegate.m
index bdc3cb3f..84c0a80c 100644
--- a/Source/SPTableStructureDelegate.m
+++ b/Source/SPTableStructureDelegate.m
@@ -114,8 +114,20 @@
if(![[currentRow objectForKey:@"Extra"] isEqualToString:anObject]) {
isCurrentExtraAutoIncrement = [[[anObject stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString] isEqualToString:@"AUTO_INCREMENT"];
- if(isCurrentExtraAutoIncrement)
+ if(isCurrentExtraAutoIncrement) {
[currentRow setObject:[NSNumber numberWithInteger:0] forKey:@"null"];
+ // Asks the user to add an index to query if AUTO_INCREMENT is set and field isn't indexed
+ if ((![currentRow objectForKey:@"Key"] || [[currentRow objectForKey:@"Key"] isEqualToString:@""])) {
+ [chooseKeyButton selectItemAtIndex:0];
+
+ [NSApp beginSheet:keySheet
+ modalForWindow:[tableDocumentInstance parentWindow] modalDelegate:self
+ didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+ contextInfo:@"autoincrementindex" ];
+ }
+ } else {
+ autoIncrementIndex = nil;
+ }
id dataCell = [aTableColumn dataCell];
[dataCell removeAllItems];