aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2010-10-07 19:25:41 +0000
committerstuconnolly <stuart02@gmail.com>2010-10-07 19:25:41 +0000
commit22afbe4dacdf089c3f9f440e1ad859982cbb714e (patch)
treee8ba3561348e2680b9c6e51e0acc9c3b03fb0e00
parenta9bab719792a3a035618ba9d19ca0651c0387c00 (diff)
downloadsequelpro-22afbe4dacdf089c3f9f440e1ad859982cbb714e.tar.gz
sequelpro-22afbe4dacdf089c3f9f440e1ad859982cbb714e.tar.bz2
sequelpro-22afbe4dacdf089c3f9f440e1ad859982cbb714e.zip
When printing a table/view's structure, change the heading accordingly. Also, don't include the tables indexes table if there are none.
-rw-r--r--Resources/Templates/sequel-pro-print-template.html2
-rw-r--r--Source/SPPrintController.m14
2 files changed, 13 insertions, 3 deletions
diff --git a/Resources/Templates/sequel-pro-print-template.html b/Resources/Templates/sequel-pro-print-template.html
index 5baa214f..19687f7f 100644
--- a/Resources/Templates/sequel-pro-print-template.html
+++ b/Resources/Templates/sequel-pro-print-template.html
@@ -101,7 +101,7 @@
</tbody>
</table><br />
- {% if indexes %}
+ {% if hasIndexes && indexes %}
<h2>Table Indexes</h2>
<table class="data">
diff --git a/Source/SPPrintController.m b/Source/SPPrintController.m
index 3a2f4148..1119fc15 100644
--- a/Source/SPPrintController.m
+++ b/Source/SPPrintController.m
@@ -178,7 +178,6 @@
// Cancel the print thread
[printThread cancel];
-
}
/**
@@ -217,7 +216,16 @@
NSDictionary *tableSource = [tableSourceInstance tableSourceForPrinting];
- heading = NSLocalizedString(@"Table Structure", @"table structure print heading");
+ SPExportMode tableType = [tablesListInstance tableType];
+
+ switch (tableType) {
+ case SPTableTypeTable:
+ heading = NSLocalizedString(@"Table Structure", @"table structure print heading");
+ break;
+ case SPTableTypeView:
+ heading = NSLocalizedString(@"View Structure", @"view structure print heading");
+ break;
+ }
rows = [[NSArray alloc] initWithArray:
[[tableSource objectForKey:@"structure"] objectsAtIndexes:
@@ -235,6 +243,8 @@
[printData setObject:indexes forKey:@"indexes"];
[printData setObject:indexColumns forKey:@"indexColumns"];
+ if ([indexes count]) [printData setObject:[NSNumber numberWithInteger:1] forKey:@"hasIndexes"];
+
[rows release];
[indexes release];
}