From 12c773ff7f06a240e66a264b23261f0436e56175 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 4 Jan 2011 02:31:18 +0000 Subject: - Rework the Add Index indexes menu and the auto_increment index required menu to use tag-based values when generating queries, allowing localisation of menu contents without using those localised values in queries. This addresses I$ - Remove the ability to specify a FULLTEXT auto_increment index, as I believe this isn't possible. - Prevent sheet reuse from specifying invalid storage types for PRIMARY KEYs - Fix exceptions when adding indexes to a table where every field is already indexed - Fix initialField/indexedFieldNames check to improve on r3061 - Fix toggling advanced index view after closing the sheet with the view open - Update localisable strings --- Source/SPTableStructure.m | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'Source/SPTableStructure.m') diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index f57a881f..8e6b7e77 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -1219,8 +1219,18 @@ alertSheetOpened = NO; if(contextInfo && [contextInfo isEqualToString:@"autoincrementindex"]) { - if(returnCode) { - autoIncrementIndex = [chooseKeyButton titleOfSelectedItem]; + if (returnCode) { + switch ([[chooseKeyButton selectedItem] tag]) { + case SPPrimaryKeyMenuTag: + autoIncrementIndex = @"PRIMARY KEY"; + break; + case SPIndexMenuTag: + autoIncrementIndex = @"INDEX"; + break; + case SPUniqueMenuTag: + autoIncrementIndex = @"UNIQUE"; + break; + } } else { autoIncrementIndex = nil; if([tableSourceView selectedRow] > -1 && [extraFieldSuggestions count]) -- cgit v1.2.3 From 1da136ca968282821f61695eae4746f6c802c046 Mon Sep 17 00:00:00 2001 From: rowanbeentje Date: Tue, 11 Jan 2011 00:54:04 +0000 Subject: - When resetting AUTO_INCREMENT for a table, always use the selected table name sourced from SPTablesList rather than a SPTableStructure cached value, which may not have been updated. This addresses Issue #945. --- Source/SPTableStructure.m | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'Source/SPTableStructure.m') diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 8e6b7e77..1cd5ca4e 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -758,13 +758,7 @@ */ - (void)setAutoIncrementTo:(NSString*)valueAsString { - NSString *selTable = nil; - - // if selectedTable is nil try to get the name from SPTablesList - if (selectedTable == nil || ![selectedTable length]) - selTable = [tablesListInstance tableName]; - else - selTable = [NSString stringWithString:selectedTable]; + NSString *selTable = [tablesListInstance tableName]; if (selTable == nil || ![selTable length]) return; -- cgit v1.2.3