aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorMax <post@wickenrode.com>2015-04-06 18:23:11 +0200
committerMax <post@wickenrode.com>2015-04-06 18:23:11 +0200
commit8eadd956e7b28695a3204ed2ba695a771a2b8da4 (patch)
tree4a71937e3d2aa5b694fa05e7ad2e88fe347cbf74 /Source
parent8631b5a61843aa52662946093e8391ead3de5689 (diff)
downloadsequelpro-8eadd956e7b28695a3204ed2ba695a771a2b8da4.tar.gz
sequelpro-8eadd956e7b28695a3204ed2ba695a771a2b8da4.tar.bz2
sequelpro-8eadd956e7b28695a3204ed2ba695a771a2b8da4.zip
Add support for FULLTEXT indexes in InnoDB tables
Fixes #1917
Diffstat (limited to 'Source')
-rw-r--r--Source/SPIndexesController.h3
-rw-r--r--Source/SPIndexesController.m16
-rw-r--r--Source/SPServerSupport.h6
-rw-r--r--Source/SPServerSupport.m3
4 files changed, 20 insertions, 8 deletions
diff --git a/Source/SPIndexesController.h b/Source/SPIndexesController.h
index 6ee59226..82bc0a03 100644
--- a/Source/SPIndexesController.h
+++ b/Source/SPIndexesController.h
@@ -74,7 +74,8 @@
#endif
BOOL _mainNibLoaded;
- BOOL isMyISAMTale;
+ BOOL isMyISAMTable;
+ BOOL isInnoDBTable;
NSString *table;
NSMutableArray *fields, *indexes, *indexedFields;
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m
index 5cca12f9..93466c27 100644
--- a/Source/SPIndexesController.m
+++ b/Source/SPIndexesController.m
@@ -166,7 +166,8 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
// Check whether a save of the current field row is required.
if (![tableStructure saveRowOnDeselect]) return;
- isMyISAMTale = [[[tableData statusValues] objectForKey:@"Engine"] isEqualToString:@"MyISAM"];
+ isMyISAMTable = [[[tableData statusValues] objectForKey:@"Engine"] isEqualToString:@"MyISAM"];
+ isInnoDBTable = [[[tableData statusValues] objectForKey:@"Engine"] isEqualToString:@"InnoDB"];
// Reset visibility of the primary key item
[[[indexTypePopUpButton menu] itemWithTag:SPPrimaryKeyMenuTag] setHidden:NO];
@@ -236,7 +237,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
#ifndef SP_CODA
// MyISAM and InnoDB tables only support BTREE storage types so disable the storage type popup button
// as it's the default anyway.
- [indexStorageTypePopUpButton setEnabled:(!(isMyISAMTale || [[[tableData statusValues] objectForKey:@"Engine"] isEqualToString:@"InnoDB"]))];
+ [indexStorageTypePopUpButton setEnabled:(!(isMyISAMTable || isInnoDBTable))];
// The ability to specify an index's key block size was added in MySQL 5.1.10 so disable the textfield
// if it's not supported.
@@ -328,10 +329,8 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
}
#ifndef SP_CODA
- NSString *engine = [[tableData statusValues] objectForKey:@"Engine"];
-
// Specifiying an index storage type (i.e. HASH or BTREE) is not permitted with SPATIAL indexes
- [indexStorageTypePopUpButton setEnabled:(indexType != SPSpatialMenuTag) && !(isMyISAMTale || [engine isEqualToString:@"InnoDB"])];
+ [indexStorageTypePopUpButton setEnabled:(indexType != SPSpatialMenuTag) && !(isMyISAMTable || isInnoDBTable)];
#endif
}
@@ -768,8 +767,8 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
[indexTypePopUpButton removeItemAtIndex:[indexTypePopUpButton indexOfItemWithTag:SPFullTextMenuTag]];
}
- // FULLTEXT and SPATIAL index types are only available using the MyISAM engine
- if (isMyISAMTale) {
+ // SPATIAL index types are only available using the MyISAM engine
+ if (isMyISAMTable) {
if ([[dbDocument serverSupport] supportsSpatialExtensions]) {
NSMenuItem *spatialMenuItem = [[[NSMenuItem alloc] init] autorelease];
@@ -778,7 +777,10 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize";
[[indexTypePopUpButton menu] addItem:spatialMenuItem];
}
+ }
+ // FULLTEXT only works with MyISAM and (InnoDB since 5.6.4)
+ if(isMyISAMTable || (isInnoDBTable && [[dbDocument serverSupport] supportsFulltextOnInnoDB])) {
NSMenuItem *fullTextMenuItem = [[[NSMenuItem alloc] init] autorelease];
[fullTextMenuItem setTitle:NSLocalizedString(@"FULLTEXT", @"full text index menu item title")];
diff --git a/Source/SPServerSupport.h b/Source/SPServerSupport.h
index e8b8a613..8052ed90 100644
--- a/Source/SPServerSupport.h
+++ b/Source/SPServerSupport.h
@@ -85,6 +85,7 @@
// Indexes
BOOL supportsIndexKeyBlockSize;
+ BOOL supportsFulltextOnInnoDB;
// Events
BOOL supportsEvents;
@@ -253,6 +254,11 @@
*/
@property (readonly) BOOL supportsFractionalSeconds;
+/**
+ * @property supportsFulltextOnInnoDB Indicates whether the server supports FULLTEXT indexes with the InnoDb engine.
+ */
+@property (readonly) BOOL supportsFulltextOnInnoDB;
+
- (id)initWithMajorVersion:(NSInteger)majorVersion minor:(NSInteger)minorVersion release:(NSInteger)releaseVersion;
- (void)evaluate;
diff --git a/Source/SPServerSupport.m b/Source/SPServerSupport.m
index bf74a61e..5537e476 100644
--- a/Source/SPServerSupport.m
+++ b/Source/SPServerSupport.m
@@ -76,6 +76,7 @@
@synthesize serverMajorVersion;
@synthesize serverMinorVersion;
@synthesize serverReleaseVersion;
+@synthesize supportsFulltextOnInnoDB;
#pragma mark -
#pragma mark Initialisation
@@ -198,6 +199,7 @@
// Fractional second support wasn't added until MySQL 5.6.4
supportsFractionalSeconds = [self isEqualToOrGreaterThanMajorVersion:5 minor:6 release:4];
+ supportsFulltextOnInnoDB = supportsFractionalSeconds; //introduced in 5.6.4 too
}
/**
@@ -288,6 +290,7 @@
supportsIndexKeyBlockSize = NO;
supportsQuotingEngineTypeInCreateSyntax = NO;
supportsFractionalSeconds = NO;
+ supportsFulltextOnInnoDB = NO;
}
/**