aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableStructureDelegate.m
diff options
context:
space:
mode:
authorBibiko <bibiko@eva.mpg.de>2010-11-01 12:39:41 +0000
committerBibiko <bibiko@eva.mpg.de>2010-11-01 12:39:41 +0000
commite7a050e4426b519885e826fe50b4db54177dceda (patch)
tree3212120983f40c6198bc3ab49fe96489ac041695 /Source/SPTableStructureDelegate.m
parent7587849d307c6c0a7fa11ddbc2ee48af87ab9087 (diff)
downloadsequelpro-e7a050e4426b519885e826fe50b4db54177dceda.tar.gz
sequelpro-e7a050e4426b519885e826fe50b4db54177dceda.tar.bz2
sequelpro-e7a050e4426b519885e826fe50b4db54177dceda.zip
• TableStructure sheet to ask for the to be used index of an auto_increment field now runs doc-modal not app-modal
- the used strategy is to ask the user for an index whenever the user set the Extra field to 'auto_increment' and not as part of the 'addRowToDb' method
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];