aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableTriggers.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-03-13 14:43:04 +0000
committerstuconnolly <stuart02@gmail.com>2010-03-13 14:43:04 +0000
commitf07531d1361e810a63a30f2e3b26313c18b3c302 (patch)
tree5502ffce3bbee9e6780eb5b56ce19babe2a199c3 /Source/SPTableTriggers.m
parent710c28ff5d55ccb26b362d80e866d53d2a4583ad (diff)
downloadsequelpro-f07531d1361e810a63a30f2e3b26313c18b3c302.tar.gz
sequelpro-f07531d1361e810a63a30f2e3b26313c18b3c302.tar.bz2
sequelpro-f07531d1361e810a63a30f2e3b26313c18b3c302.zip
Add support for printing the table triggers view as well some HTML generation performance improvements.
Diffstat (limited to 'Source/SPTableTriggers.m')
-rw-r--r--Source/SPTableTriggers.m43
1 files changed, 43 insertions, 0 deletions
diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m
index 5ca424e7..26011044 100644
--- a/Source/SPTableTriggers.m
+++ b/Source/SPTableTriggers.m
@@ -393,6 +393,49 @@
[self _toggleConfirmAddTriggerButtonEnabled];
}
+/**
+ * Returns an array of trigger data to be used for printing purposes. The first element in the array is always
+ * an array of the columns and each subsequent element is an array of trigger data.
+ */
+- (NSArray *)triggerDataForPrinting
+{
+ NSMutableArray *headings = [[NSMutableArray alloc] init];
+ NSMutableArray *data = [NSMutableArray array];
+
+ // Get the relations table view's columns
+ for (NSTableColumn *column in [triggersTableView tableColumns])
+ {
+ [headings addObject:[[column headerCell] stringValue]];
+ }
+
+ // Get rid of the 'Table' column
+ [headings removeObjectAtIndex:0];
+
+ [data addObject:headings];
+
+ [headings release];
+
+ // Get the relation data
+ for (NSDictionary *trigger in triggerData)
+ {
+ 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"]];
+
+ [data addObject:temp];
+
+ [temp release];
+ }
+
+ return data;
+}
+
#pragma mark -
/*