diff options
-rw-r--r-- | Interfaces/English.lproj/IndexesView.xib | 248 | ||||
-rw-r--r-- | Source/SPIndexesController.h | 2 | ||||
-rw-r--r-- | Source/SPIndexesController.m | 37 |
3 files changed, 245 insertions, 42 deletions
diff --git a/Interfaces/English.lproj/IndexesView.xib b/Interfaces/English.lproj/IndexesView.xib index 9a236e98..f89b3eba 100644 --- a/Interfaces/English.lproj/IndexesView.xib +++ b/Interfaces/English.lproj/IndexesView.xib @@ -3,7 +3,7 @@ <data> <int key="IBDocument.SystemTarget">1050</int> <string key="IBDocument.SystemVersion">10F569</string> - <string key="IBDocument.InterfaceBuilderVersion">788</string> + <string key="IBDocument.InterfaceBuilderVersion">804</string> <string key="IBDocument.AppKitVersion">1038.29</string> <string key="IBDocument.HIToolboxVersion">461.00</string> <object class="NSMutableDictionary" key="IBDocument.PluginVersions"> @@ -15,13 +15,13 @@ </object> <object class="NSMutableArray" key="dict.values"> <bool key="EncodedWithXMLCoder">YES</bool> - <string>788</string> + <string>804</string> <string>1.2.5</string> </object> </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> - <integer value="4"/> + <integer value="67"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -29,13 +29,8 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> <object class="NSMutableDictionary" key="IBDocument.Metadata"> - <bool key="EncodedWithXMLCoder">YES</bool> - <object class="NSArray" key="dict.sortedKeys" id="0"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> - <object class="NSMutableArray" key="dict.values"> - <bool key="EncodedWithXMLCoder">YES</bool> - </object> + <string key="NS.key.0">PluginDependencyRecalculationVersion</string> + <integer value="1" key="NS.object.0"/> </object> <object class="NSMutableArray" key="IBDocument.RootObjects" id="1000"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -51,7 +46,7 @@ <object class="NSWindowTemplate" id="880032408"> <int key="NSWindowStyleMask">9</int> <int key="NSWindowBacking">2</int> - <string key="NSWindowRect">{{512, 244}, {267, 274}}</string> + <string key="NSWindowRect">{{512, 188}, {267, 330}}</string> <int key="NSWTFlags">1886913536</int> <string key="NSWindowTitle">New Index</string> <string key="NSWindowClass">NSWindow</string> @@ -68,7 +63,7 @@ <object class="NSPopUpButton" id="708230399"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{83, 233}, {167, 22}}</string> + <string key="NSFrame">{{83, 289}, {167, 22}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="431781347"> @@ -147,8 +142,8 @@ </object> <object class="NSTextField" id="978293712"> <reference key="NSNextResponder" ref="762677578"/> - <int key="NSvFlags">266</int> - <string key="NSFrame">{{86, 211}, {161, 19}}</string> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{86, 267}, {161, 19}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="1000744513"> @@ -168,7 +163,7 @@ <bytes key="NSWhite">MQA</bytes> </object> </object> - <object class="NSColor" key="NSTextColor"> + <object class="NSColor" key="NSTextColor" id="200547827"> <int key="NSColorSpace">6</int> <string key="NSCatalogName">System</string> <string key="NSColorName">textColor</string> @@ -182,7 +177,7 @@ <object class="NSTextField" id="452572425"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 213}, {64, 14}}</string> + <string key="NSFrame">{{17, 269}, {64, 14}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="568966163"> @@ -211,7 +206,7 @@ <object class="NSTextField" id="832689269"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{17, 238}, {64, 14}}</string> + <string key="NSFrame">{{17, 294}, {64, 14}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="217993475"> @@ -451,7 +446,7 @@ </object> <reference ref="310534340"/> </object> - <string key="NSFrame">{{-1, 97}, {269, 98}}</string> + <string key="NSFrame">{{-1, 153}, {269, 98}}</string> <reference key="NSSuperview" ref="762677578"/> <reference key="NSNextKeyView" ref="726923866"/> <int key="NSsFlags">530</int> @@ -480,7 +475,7 @@ <object class="NSTextField" id="925790600"> <reference key="NSNextResponder" ref="361997881"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{15, 16}, {78, 14}}</string> + <string key="NSFrame">{{21, 46}, {78, 14}}</string> <reference key="NSSuperview" ref="361997881"/> <bool key="NSEnabled">YES</bool> <object class="NSTextFieldCell" key="NSCell" id="971022587"> @@ -496,7 +491,7 @@ <object class="NSPopUpButton" id="645455211"> <reference key="NSNextResponder" ref="361997881"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{95, 11}, {168, 22}}</string> + <string key="NSFrame">{{101, 41}, {162, 22}}</string> <reference key="NSSuperview" ref="361997881"/> <bool key="NSEnabled">YES</bool> <object class="NSPopUpButtonCell" key="NSCell" id="747441327"> @@ -575,12 +570,109 @@ <int key="NSArrowPosition">2</int> </object> </object> + <object class="NSTextField" id="711967371"> + <reference key="NSNextResponder" ref="361997881"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{15, 20}, {84, 14}}</string> + <reference key="NSSuperview" ref="361997881"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="408249519"> + <int key="NSCellFlags">68288064</int> + <int key="NSCellFlags2">272761856</int> + <string key="NSContents">Key Block Size:</string> + <reference key="NSSupport" ref="26"/> + <reference key="NSControlView" ref="711967371"/> + <reference key="NSBackgroundColor" ref="224183994"/> + <reference key="NSTextColor" ref="723855329"/> + </object> + </object> + <object class="NSTextField" id="417214146"> + <reference key="NSNextResponder" ref="361997881"/> + <int key="NSvFlags">268</int> + <string key="NSFrame">{{104, 18}, {63, 19}}</string> + <reference key="NSSuperview" ref="361997881"/> + <bool key="NSEnabled">YES</bool> + <object class="NSTextFieldCell" key="NSCell" id="659211423"> + <int key="NSCellFlags">-1804468671</int> + <int key="NSCellFlags2">-1874721792</int> + <string key="NSContents"/> + <reference key="NSSupport" ref="26"/> + <object class="NSNumberFormatter" key="NSFormatter" id="299133641"> + <object class="NSMutableDictionary" key="NS.attributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys"> + <bool key="EncodedWithXMLCoder">YES</bool> + <string>allowsFloats</string> + <string>formatterBehavior</string> + <string>locale</string> + <string>maximum</string> + <string>minimum</string> + <string>negativeInfinitySymbol</string> + <string>nilSymbol</string> + <string>numberStyle</string> + <string>positiveInfinitySymbol</string> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + <boolean value="YES"/> + <integer value="1040"/> + <object class="NSLocale"> + <string key="NS.identifier"/> + </object> + <real value="10000"/> + <real value="0.0"/> + <string>-∞</string> + <string/> + <integer value="1"/> + <string>+∞</string> + </object> + </object> + <string key="NS.positiveformat">#,##0.###</string> + <string key="NS.negativeformat">#,##0.###</string> + <nil key="NS.positiveattrs"/> + <nil key="NS.negativeattrs"/> + <nil key="NS.zero"/> + <object class="NSAttributedString" key="NS.nil"> + <string key="NSString"/> + </object> + <object class="NSAttributedString" key="NS.nan"> + <string key="NSString">NaN</string> + <object class="NSDictionary" key="NSAttributes"> + <bool key="EncodedWithXMLCoder">YES</bool> + <object class="NSArray" key="dict.sortedKeys" id="0"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + <object class="NSMutableArray" key="dict.values"> + <bool key="EncodedWithXMLCoder">YES</bool> + </object> + </object> + </object> + <real value="0.0" key="NS.min"/> + <real value="10000" key="NS.max"/> + <object class="NSDecimalNumberHandler" key="NS.rounding"> + <int key="NS.roundingmode">3</int> + <bool key="NS.raise.overflow">YES</bool> + <bool key="NS.raise.underflow">YES</bool> + <bool key="NS.raise.dividebyzero">YES</bool> + </object> + <string key="NS.decimal">.</string> + <string key="NS.thousand">,</string> + <bool key="NS.hasthousands">YES</bool> + <bool key="NS.localized">NO</bool> + <bool key="NS.allowsfloats">YES</bool> + </object> + <reference key="NSControlView" ref="417214146"/> + <bool key="NSDrawsBackground">YES</bool> + <reference key="NSBackgroundColor" ref="253907032"/> + <reference key="NSTextColor" ref="200547827"/> + </object> + </object> </object> - <string key="NSFrame">{{1, 1}, {278, 45}}</string> + <string key="NSFrame">{{1, 1}, {278, 75}}</string> <reference key="NSSuperview" ref="197030792"/> </object> </object> - <string key="NSFrame">{{-5, -4}, {280, 47}}</string> + <string key="NSFrame">{{-5, -4}, {280, 77}}</string> <reference key="NSSuperview" ref="30022357"/> <string key="NSOffsets">{0, 0}</string> <object class="NSTextFieldCell" key="NSTitleCell"> @@ -603,7 +695,7 @@ <object class="NSButton" id="226972970"> <reference key="NSNextResponder" ref="30022357"/> <int key="NSvFlags">268</int> - <string key="NSFrame">{{-83, 15}, {100, 18}}</string> + <string key="NSFrame">{{-83, 45}, {100, 18}}</string> <reference key="NSSuperview" ref="30022357"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="708153532"> @@ -628,14 +720,14 @@ </object> </object> </object> - <string key="NSFrame">{{-2, -4}, {272, 41}}</string> + <string key="NSFrame">{{-2, 22}, {272, 71}}</string> <reference key="NSSuperview" ref="762677578"/> <string key="NSClassName">NSView</string> </object> <object class="NSButton" id="1003402112"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">292</int> - <string key="NSFrame">{{0, 40}, {29, 26}}</string> + <string key="NSFrame">{{0, 96}, {29, 26}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="782137189"> @@ -656,7 +748,7 @@ <object class="NSButton" id="928710921"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">292</int> - <string key="NSFrame">{{24, 41}, {214, 22}}</string> + <string key="NSFrame">{{24, 97}, {214, 22}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="958218934"> @@ -681,7 +773,7 @@ <object class="NSButton" id="587008277"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{152, 13}, {100, 28}}</string> + <string key="NSFrame">{{152, 69}, {100, 28}}</string> <reference key="NSSuperview" ref="762677578"/> <int key="NSTag">1</int> <bool key="NSEnabled">YES</bool> @@ -707,7 +799,7 @@ <object class="NSButton" id="948801180"> <reference key="NSNextResponder" ref="762677578"/> <int key="NSvFlags">289</int> - <string key="NSFrame">{{54, 13}, {100, 28}}</string> + <string key="NSFrame">{{54, 69}, {100, 28}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="NSEnabled">YES</bool> <object class="NSButtonCell" key="NSCell" id="758521208"> @@ -779,7 +871,7 @@ </object> </object> </object> - <string key="NSFrame">{{-2, 74}, {270, 24}}</string> + <string key="NSFrame">{{-2, 130}, {270, 24}}</string> <reference key="NSSuperview" ref="762677578"/> <bool key="BWABBIsResizable">NO</bool> <bool key="BWABBIsAtBottom">NO</bool> @@ -787,7 +879,7 @@ <int key="BWABBSelectedIndex">2</int> </object> </object> - <string key="NSFrameSize">{267, 274}</string> + <string key="NSFrameSize">{267, 330}</string> <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string> @@ -1060,6 +1152,14 @@ </object> <int key="connectionID">131</int> </object> + <object class="IBConnectionRecord"> + <object class="IBOutletConnection" key="connection"> + <string key="label">indexKeyBlockSizeTextField</string> + <reference key="source" ref="1001"/> + <reference key="destination" ref="417214146"/> + </object> + <int key="connectionID">137</int> + </object> </object> <object class="IBMutableOrderedSet" key="objectRecords"> <object class="NSArray" key="orderedObjects"> @@ -1293,8 +1393,10 @@ <reference key="object" ref="197030792"/> <object class="NSMutableArray" key="children"> <bool key="EncodedWithXMLCoder">YES</bool> - <reference ref="925790600"/> <reference ref="645455211"/> + <reference ref="711967371"/> + <reference ref="925790600"/> + <reference ref="417214146"/> </object> <reference key="parent" ref="30022357"/> </object> @@ -1476,6 +1578,43 @@ <reference key="object" ref="13091714"/> <reference key="parent" ref="358986900"/> </object> + <object class="IBObjectRecord"> + <int key="objectID">132</int> + <reference key="object" ref="711967371"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="408249519"/> + </object> + <reference key="parent" ref="197030792"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">133</int> + <reference key="object" ref="408249519"/> + <reference key="parent" ref="711967371"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">134</int> + <reference key="object" ref="417214146"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="659211423"/> + </object> + <reference key="parent" ref="197030792"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">135</int> + <reference key="object" ref="659211423"/> + <object class="NSMutableArray" key="children"> + <bool key="EncodedWithXMLCoder">YES</bool> + <reference ref="299133641"/> + </object> + <reference key="parent" ref="417214146"/> + </object> + <object class="IBObjectRecord"> + <int key="objectID">136</int> + <reference key="object" ref="299133641"/> + <reference key="parent" ref="659211423"/> + </object> </object> </object> <object class="NSMutableDictionary" key="flattenedProperties"> @@ -1501,6 +1640,15 @@ <string>124.IBPluginDependency</string> <string>129.IBPluginDependency</string> <string>13.IBPluginDependency</string> + <string>132.IBPluginDependency</string> + <string>132.IBViewBoundsToFrameTransform</string> + <string>133.IBPluginDependency</string> + <string>134.IBPluginDependency</string> + <string>134.IBViewBoundsToFrameTransform</string> + <string>135.IBPluginDependency</string> + <string>136.IBNumberFormatterBehaviorMetadataKey</string> + <string>136.IBNumberFormatterLocalizesFormatMetadataKey</string> + <string>136.IBPluginDependency</string> <string>14.IBEditorWindowLastContentRect</string> <string>14.IBPluginDependency</string> <string>14.ImportedFromIB2</string> @@ -1561,6 +1709,7 @@ <string>90.IBPluginDependency</string> <string>91.IBPluginDependency</string> <string>92.IBPluginDependency</string> + <string>92.IBViewBoundsToFrameTransform</string> <string>93.IBPluginDependency</string> </object> <object class="NSMutableArray" key="dict.values"> @@ -1612,6 +1761,19 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSAffineTransform"> + <bytes key="NSTransformStruct">P4AAAL+AAABBcAAAwdAAAA</bytes> + </object> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSAffineTransform"> + <bytes key="NSTransformStruct">P4AAAL+AAABC0AAAwgwAAA</bytes> + </object> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <integer value="1041"/> + <boolean value="NO"/> + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>{{631, 783}, {167, 54}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <integer value="1"/> @@ -1624,9 +1786,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{512, 335}, {267, 274}}</string> + <string>{{657, 151}, {267, 330}}</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> - <string>{{512, 335}, {267, 274}}</string> + <string>{{657, 151}, {267, 330}}</string> <integer value="1"/> <integer value="0"/> <integer value="1"/> @@ -1686,6 +1848,9 @@ <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> + <object class="NSAffineTransform"> + <bytes key="NSTransformStruct">P4AAAL+AAABBcAAAwmgAAA</bytes> + </object> <string>com.apple.InterfaceBuilder.CocoaPlugin</string> </object> </object> @@ -1705,7 +1870,7 @@ </object> </object> <nil key="sourceID"/> - <int key="maxID">131</int> + <int key="maxID">137</int> </object> <object class="IBClassDescriber" key="IBDocument.Classes"> <object class="NSMutableArray" key="referencedPartialClassDescriptions"> @@ -2931,6 +3096,7 @@ <string>indexAdvancedOptionsView</string> <string>indexAdvancedOptionsViewButton</string> <string>indexAdvancedOptionsViewLabelButton</string> + <string>indexKeyBlockSizeTextField</string> <string>indexNameLabel</string> <string>indexNameTextField</string> <string>indexSizeTableColumn</string> @@ -2958,6 +3124,7 @@ <string>NSButton</string> <string>NSTextField</string> <string>NSTextField</string> + <string>NSTextField</string> <string>NSTableColumn</string> <string>NSPopUpButton</string> <string>NSTextField</string> @@ -2984,6 +3151,7 @@ <string>indexAdvancedOptionsView</string> <string>indexAdvancedOptionsViewButton</string> <string>indexAdvancedOptionsViewLabelButton</string> + <string>indexKeyBlockSizeTextField</string> <string>indexNameLabel</string> <string>indexNameTextField</string> <string>indexSizeTableColumn</string> @@ -3034,6 +3202,10 @@ <string key="candidateClassName">NSButton</string> </object> <object class="IBToOneOutletInfo"> + <string key="name">indexKeyBlockSizeTextField</string> + <string key="candidateClassName">NSTextField</string> + </object> + <object class="IBToOneOutletInfo"> <string key="name">indexNameLabel</string> <string key="candidateClassName">NSTextField</string> </object> @@ -4003,6 +4175,14 @@ </object> </object> <object class="IBPartialClassDescription"> + <string key="className">NSNumberFormatter</string> + <string key="superclassName">NSFormatter</string> + <object class="IBClassDescriptionSource" key="sourceIdentifier"> + <string key="majorKey">IBFrameworkSource</string> + <string key="minorKey">Foundation.framework/Headers/NSNumberFormatter.h</string> + </object> + </object> + <object class="IBPartialClassDescription"> <string key="className">NSObject</string> <object class="IBClassDescriptionSource" key="sourceIdentifier"> <string key="majorKey">IBFrameworkSource</string> diff --git a/Source/SPIndexesController.h b/Source/SPIndexesController.h index cd049e57..4d23aa3d 100644 --- a/Source/SPIndexesController.h +++ b/Source/SPIndexesController.h @@ -30,6 +30,7 @@ extern NSString *SPNewIndexIndexName; extern NSString *SPNewIndexIndexType; extern NSString *SPNewIndexIndexedColumns; extern NSString *SPNewIndexStorageType; +extern NSString *SPNewIndexKeyBlockSize; @interface SPIndexesController : NSWindowController { @@ -62,6 +63,7 @@ extern NSString *SPNewIndexStorageType; IBOutlet NSView *indexAdvancedOptionsView; IBOutlet NSButton *indexAdvancedOptionsViewLabelButton; IBOutlet NSPopUpButton *indexStorageTypePopUpButton; + IBOutlet NSTextField *indexKeyBlockSizeTextField; NSString *table; diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 50f2e677..21e1a66c 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -32,6 +32,7 @@ NSString *SPNewIndexIndexName = @"IndexName"; NSString *SPNewIndexIndexType = @"IndexType"; NSString *SPNewIndexIndexedColumns = @"IndexedColumns"; NSString *SPNewIndexStorageType = @"IndexStorageType"; +NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; @interface SPIndexesController (PrivateAPI) @@ -161,6 +162,10 @@ NSString *SPNewIndexStorageType = @"IndexStorageType"; // as it's the default anyway. [indexStorageTypePopUpButton setEnabled:(!([engine isEqualToString:@"MyISAM"] || [engine isEqualToString:@"InnoDB"]))]; + // 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. + [indexKeyBlockSizeTextField setEnabled:(([connection serverMajorVersion] >= 5) && ([connection serverMinorVersion] >= 1) && ([connection serverReleaseVersion] >= 10))]; + // Begin the sheet [NSApp beginSheet:[self window] modalForWindow:[dbDocument parentWindow] @@ -258,6 +263,9 @@ NSString *SPNewIndexStorageType = @"IndexStorageType"; [NSApp endSheet:[sender window] returnCode:[sender tag]]; [[sender window] orderOut:self]; + + // Clear the index key block size field + [indexKeyBlockSizeTextField setStringValue:@""]; } /** @@ -337,13 +345,14 @@ NSString *SPNewIndexStorageType = @"IndexStorageType"; - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex { + if (tableView == indexesTableView) return; - if(tableView == indexesTableView) return; - - if([[tableColumn identifier] isEqualToString:@"name"]) { + if ([[tableColumn identifier] isEqualToString:@"name"]) { + // Iterate to given fields to replace the correct desired index field dictionary - for(NSDictionary *dic in fields) { - if([[dic objectForKey:@"name"] isEqualToString:object]) { + for (NSDictionary *dic in fields) + { + if ([[dic objectForKey:@"name"] isEqualToString:object]) { [indexedFields replaceObjectAtIndex:rowIndex withObject:dic]; break; } @@ -474,6 +483,11 @@ NSString *SPNewIndexStorageType = @"IndexStorageType"; [indexDetails setObject:indexedFields forKey:SPNewIndexIndexedColumns]; [indexDetails setObject:[indexNameTextField stringValue] forKey:SPNewIndexIndexName]; [indexDetails setObject:[indexTypePopUpButton titleOfSelectedItem] forKey:SPNewIndexIndexType]; + + // If there is a key block size set it means the database version supports it + if ([[indexKeyBlockSizeTextField stringValue] length]) { + [indexDetails setObject:[NSNumber numberWithInteger:[indexKeyBlockSizeTextField integerValue]] forKey:SPNewIndexKeyBlockSize]; + } if ([indexStorageTypePopUpButton indexOfSelectedItem] > 0) { [indexDetails setObject:[indexStorageTypePopUpButton titleOfSelectedItem] forKey:SPNewIndexStorageType]; @@ -614,9 +628,11 @@ NSString *SPNewIndexStorageType = @"IndexStorageType"; if (![[tableStructure onMainThread] saveRowOnDeselect]) return; // Retrieve index details - NSString *indexName = [indexDetails objectForKey:SPNewIndexIndexName]; - NSString *indexType = [indexDetails objectForKey:SPNewIndexIndexType]; - NSString *indexStorageType = [indexDetails objectForKey:SPNewIndexStorageType]; + NSString *indexName = [indexDetails objectForKey:SPNewIndexIndexName]; + NSString *indexType = [indexDetails objectForKey:SPNewIndexIndexType]; + NSString *indexStorageType = [indexDetails objectForKey:SPNewIndexStorageType]; + NSNumber *indexKeyBlockSize = [indexDetails objectForKey:SPNewIndexKeyBlockSize]; + NSArray *indexedColumns = [indexDetails objectForKey:SPNewIndexIndexedColumns]; // Interface validation should prevent this, but just to be safe @@ -669,6 +685,11 @@ NSString *SPNewIndexStorageType = @"IndexStorageType"; [query appendString:@" USING "]; [query appendString:indexStorageType]; } + + // If supplied specify the index's key block size + if (indexKeyBlockSize) { + [query appendFormat:@" KEY_BLOCK_SIZE = %d", [indexKeyBlockSize integerValue]]; + } // Execute the query [connection queryString:query]; |