diff options
-rw-r--r-- | Interfaces/English.lproj/DBView.xib | 18 | ||||
-rw-r--r-- | Source/SPTableTriggers.h | 11 | ||||
-rw-r--r-- | Source/SPTableTriggers.m | 54 |
3 files changed, 53 insertions, 30 deletions
diff --git a/Interfaces/English.lproj/DBView.xib b/Interfaces/English.lproj/DBView.xib index 3d816896..fc0c5510 100644 --- a/Interfaces/English.lproj/DBView.xib +++ b/Interfaces/English.lproj/DBView.xib @@ -23,8 +23,8 @@ </object> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="6701"/> <integer value="6735"/> - <integer value="25"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -5763,7 +5763,7 @@ <object class="NSMutableArray" key="NSTableColumns"> <bool key="EncodedWithXMLCoder">YES</bool> <object class="NSTableColumn" id="900454738"> - <string key="NSIdentifier">table</string> + <string key="NSIdentifier">TriggerTableName</string> <double key="NSWidth">116</double> <double key="NSMinWidth">8</double> <double key="NSMaxWidth">1000</double> @@ -5793,7 +5793,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="849108098"> - <string key="NSIdentifier">trigger</string> + <string key="NSIdentifier">TriggerName</string> <double key="NSWidth">100</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028230607370965e+38</double> @@ -5820,7 +5820,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="684549484"> - <string key="NSIdentifier">event</string> + <string key="NSIdentifier">TriggerEvent</string> <double key="NSWidth">85</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028230607370965e+38</double> @@ -5847,7 +5847,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="676095135"> - <string key="NSIdentifier">timing</string> + <string key="NSIdentifier">TriggerActionTime</string> <double key="NSWidth">121</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028230607370965e+38</double> @@ -5874,7 +5874,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="805441036"> - <string key="NSIdentifier">statement</string> + <string key="NSIdentifier">TriggerStatement</string> <double key="NSWidth">68</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028230607370965e+38</double> @@ -5901,7 +5901,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="266935210"> - <string key="NSIdentifier">definer</string> + <string key="NSIdentifier">TriggerDefiner</string> <double key="NSWidth">71</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028230607370965e+38</double> @@ -5928,7 +5928,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="619233826"> - <string key="NSIdentifier">created</string> + <string key="NSIdentifier">TriggerCreated</string> <double key="NSWidth">49</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028234663852886e+38</double> @@ -5955,7 +5955,7 @@ <reference key="NSTableView" ref="496402806"/> </object> <object class="NSTableColumn" id="496712"> - <string key="NSIdentifier">sql_mode</string> + <string key="NSIdentifier">TriggerSQLMode</string> <double key="NSWidth">60</double> <double key="NSMinWidth">10</double> <double key="NSMaxWidth">3.4028234663852886e+38</double> diff --git a/Source/SPTableTriggers.h b/Source/SPTableTriggers.h index b7bd61fd..c6178310 100644 --- a/Source/SPTableTriggers.h +++ b/Source/SPTableTriggers.h @@ -25,6 +25,16 @@ #import <MCPKit/MCPKit.h> +// Constants +/*extern NSString *SPTriggerName; +extern NSString *SPTriggerTableName; +extern NSString *SPTriggerEvent; +extern NSString *SPTriggerActionTime; +extern NSString *SPTriggerStatement; +extern NSString *SPTriggerDefiner; +extern NSString *SPTriggerCreated; +extern NSString *SPTriggerSQLMode;*/ + @interface SPTableTriggers : NSObject { IBOutlet id tableDocumentInstance; @@ -54,6 +64,7 @@ BOOL isEdit; + // Cache vars NSString *editTriggerName; NSString *editTriggerEvent; NSString *editTriggerTableName; diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m index a934f450..329b0f8c 100644 --- a/Source/SPTableTriggers.m +++ b/Source/SPTableTriggers.m @@ -32,6 +32,16 @@ #import "SPAlertSheets.h" #import "SPServerSupport.h" +// Constants +static const NSString *SPTriggerName = @"TriggerName"; +static const NSString *SPTriggerTableName = @"TriggerTableName"; +static const NSString *SPTriggerEvent = @"TriggerEvent"; +static const NSString *SPTriggerActionTime = @"TriggerActionTime"; +static const NSString *SPTriggerStatement = @"TriggerStatement"; +static const NSString *SPTriggerDefiner = @"TriggerDefiner"; +static const NSString *SPTriggerCreated = @"TriggerCreated"; +static const NSString *SPTriggerSQLMode = @"TriggerSQLMode"; + @interface SPTableTriggers (PrivateAPI) - (void)_editTriggerAtIndex:(NSInteger)index; @@ -48,7 +58,7 @@ #pragma mark Initialization /** - * init + * Init */ - (id)init { @@ -493,13 +503,13 @@ { NSMutableArray *temp = [[NSMutableArray alloc] init]; - [temp addObject:[trigger objectForKey:@"trigger"]]; - [temp addObject:[trigger objectForKey:@"event"]]; - [temp addObject:[trigger objectForKey:@"timing"]]; - [temp addObject:[trigger objectForKey:@"statement"]]; - [temp addObject:[trigger objectForKey:@"definer"]]; - [temp addObject:([trigger objectForKey:@"created"]) ? [trigger objectForKey:@"created"] : @""]; - [temp addObject:[trigger objectForKey:@"sql_mode"]]; + [temp addObject:[trigger objectForKey:SPTriggerName]]; + [temp addObject:[trigger objectForKey:SPTriggerEvent]]; + [temp addObject:[trigger objectForKey:SPTriggerActionTime]]; + [temp addObject:[trigger objectForKey:SPTriggerStatement]]; + [temp addObject:[trigger objectForKey:SPTriggerDefiner]]; + [temp addObject:([trigger objectForKey:SPTriggerCreated]) ? [trigger objectForKey:SPTriggerCreated] : @""]; + [temp addObject:[trigger objectForKey:SPTriggerSQLMode]]; [data addObject:temp]; @@ -534,11 +544,11 @@ // Cache the original trigger's name and statement in the event that the editing process fails and // we need to recreate it. - editTriggerName = [trigger objectForKey:@"trigger"]; - editTriggerStatement = [trigger objectForKey:@"statement"]; - editTriggerTableName = [trigger objectForKey:@"table"]; - editTriggerEvent = [trigger objectForKey:@"event"]; - editTriggerActionTime = [trigger objectForKey:@"timing"]; + editTriggerName = [trigger objectForKey:SPTriggerName]; + editTriggerStatement = [trigger objectForKey:SPTriggerStatement]; + editTriggerTableName = [trigger objectForKey:SPTriggerTableName]; + editTriggerEvent = [trigger objectForKey:SPTriggerEvent]; + editTriggerActionTime = [trigger objectForKey:SPTriggerActionTime]; [triggerNameTextField setStringValue:editTriggerName]; [triggerStatementTextView setString:editTriggerStatement]; @@ -584,6 +594,8 @@ /** * Refresh the displayed trigger, optionally forcing a refresh of the underlying cache. + * + * @param classAllCaches Indicates whether all the caches should be refreshed */ - (void)_refreshTriggerDataForcingCacheRefresh:(BOOL)clearAllCaches { @@ -601,14 +613,14 @@ for (NSDictionary *trigger in triggers) { [triggerData addObject:[NSDictionary dictionaryWithObjectsAndKeys: - [trigger objectForKey:@"Table"], @"table", - [trigger objectForKey:@"Trigger"], @"trigger", - [trigger objectForKey:@"Event"], @"event", - [trigger objectForKey:@"Timing"], @"timing", - [trigger objectForKey:@"Statement"], @"statement", - [trigger objectForKey:@"Definer"], @"definer", - [trigger objectForKey:@"Created"], @"created", - [trigger objectForKey:@"sql_mode"], @"sql_mode", + [trigger objectForKey:@"Table"], SPTriggerTableName, + [trigger objectForKey:@"Trigger"], SPTriggerName, + [trigger objectForKey:@"Event"], SPTriggerEvent, + [trigger objectForKey:@"Timing"], SPTriggerActionTime, + [trigger objectForKey:@"Statement"], SPTriggerStatement, + [trigger objectForKey:@"Definer"], SPTriggerDefiner, + [trigger objectForKey:@"Created"], SPTriggerCreated, + [trigger objectForKey:@"sql_mode"], SPTriggerSQLMode, nil]]; } |