diff options
author | stuconnolly <stuart02@gmail.com> | 2010-10-19 20:39:35 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-10-19 20:39:35 +0000 |
commit | ee085902c3312eb623fbafaca2d59b3260385e72 (patch) | |
tree | a74203022e03efea229d10670f0f7b9f74a8f065 /Source/SPTableTriggers.m | |
parent | 68e90d59bbb8660751e9fb74cd6553c4b32bcfa5 (diff) | |
download | sequelpro-ee085902c3312eb623fbafaca2d59b3260385e72.tar.gz sequelpro-ee085902c3312eb623fbafaca2d59b3260385e72.tar.bz2 sequelpro-ee085902c3312eb623fbafaca2d59b3260385e72.zip |
Replace use of hardcoded strings with constants when working with trigger data.
Diffstat (limited to 'Source/SPTableTriggers.m')
-rw-r--r-- | Source/SPTableTriggers.m | 54 |
1 files changed, 33 insertions, 21 deletions
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]]; } |