aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPIndexesController.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2012-03-22 01:18:18 +0000
committerrowanbeentje <rowan@beent.je>2012-03-22 01:18:18 +0000
commit24f89a873caf37947f0447ff870ca4c8d55c453e (patch)
tree22162a0e1eead7190e316c384ff8c6c1b98661b3 /Source/SPIndexesController.m
parent3916b4227d1e02942504e13a2d36b3e6f57670bb (diff)
downloadsequelpro-24f89a873caf37947f0447ff870ca4c8d55c453e.tar.gz
sequelpro-24f89a873caf37947f0447ff870ca4c8d55c453e.tar.bz2
sequelpro-24f89a873caf37947f0447ff870ca4c8d55c453e.zip
- Rework SPTableData PRIMARY KEY and UNIQUE KEY parsing to use SPSQLParser instead of regexes
- Support multiple primary keys in the SPTableData parse - If possible, use primary keys to preserve table content selection instead of row indexes - Improve SPTableData primary keys method to use cached value instead of using another query - Preserve selection when filtering tables if appropriate
Diffstat (limited to 'Source/SPIndexesController.m')
-rw-r--r--Source/SPIndexesController.m17
1 files changed, 1 insertions, 16 deletions
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m
index 99d359f7..f4f03d28 100644
--- a/Source/SPIndexesController.m
+++ b/Source/SPIndexesController.m
@@ -187,22 +187,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
// Check to see whether a primary key already exists for the table, and if so select INDEX instead
for (NSDictionary *field in fields)
{
- BOOL hasCompositePrimaryKey = NO;
- BOOL isPrimaryKey = [[field objectForKey:@"isprimarykey"] boolValue];
-
- // The 'isprimarykey' key of a field is only present for single column primary keys, not composite keys,
- // so we need to check the indexes manually.
- if (!isPrimaryKey) {
- for (NSDictionary *index in indexes)
- {
- if ([[index objectForKey:@"Key_name"] isEqualToString:@"PRIMARY"]) {
- hasCompositePrimaryKey = YES;
- break;
- }
- }
- }
-
- if (isPrimaryKey || hasCompositePrimaryKey) {
+ if ([[field objectForKey:@"isprimarykey"] boolValue]) {
// Hide primary key option
[[[indexTypePopUpButton menu] itemWithTag:SPPrimaryKeyMenuTag] setHidden:YES];