aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2009-05-05 12:24:43 +0000
committerbamse16 <marius@marius.me.uk>2009-05-05 12:24:43 +0000
commit2a4bbd2e425fbbf0ffd20a9c36921778b92963ae (patch)
tree2e3030c66bc4171066a37b0516eda38a1ec8a947
parent4be832e7173836d78c91a8724c9dbfa14bd4b09f (diff)
downloadsequelpro-2a4bbd2e425fbbf0ffd20a9c36921778b92963ae.tar.gz
sequelpro-2a4bbd2e425fbbf0ffd20a9c36921778b92963ae.tar.bz2
sequelpro-2a4bbd2e425fbbf0ffd20a9c36921778b92963ae.zip
Issue 233: Option to copy field headings from result panels
Also replaced some NSLog with DLog/ALog
-rw-r--r--Interfaces/English.lproj/MainMenu.xib376
-rw-r--r--Source/TableDocument.h2
-rw-r--r--Source/TableDocument.m49
-rw-r--r--Source/TableDump.m21
-rw-r--r--Source/TablesList.m21
5 files changed, 419 insertions, 50 deletions
diff --git a/Interfaces/English.lproj/MainMenu.xib b/Interfaces/English.lproj/MainMenu.xib
index 714fc8c1..e25afd7e 100644
--- a/Interfaces/English.lproj/MainMenu.xib
+++ b/Interfaces/English.lproj/MainMenu.xib
@@ -8,7 +8,7 @@
<string key="IBDocument.HIToolboxVersion">353.00</string>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
- <integer value="159"/>
+ <integer value="924"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1405,6 +1405,25 @@
<reference key="NSOnImage" ref="625762401"/>
<reference key="NSMixedImage" ref="315854375"/>
</object>
+ <object class="NSMenuItem" id="17386715">
+ <reference key="NSMenu" ref="1056168652"/>
+ <string key="NSTitle">Copy Column Names</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ </object>
+ <object class="NSMenuItem" id="477591318">
+ <reference key="NSMenu" ref="1056168652"/>
+ <bool key="NSIsDisabled">YES</bool>
+ <bool key="NSIsSeparator">YES</bool>
+ <string key="NSTitle"/>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="625762401"/>
+ <reference key="NSMixedImage" ref="315854375"/>
+ </object>
<object class="NSMenuItem" id="785987636">
<reference key="NSMenu" ref="1056168652"/>
<string key="NSTitle">Check Table</string>
@@ -2355,6 +2374,14 @@
</object>
<int key="connectionID">922</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">copyColumnNames:</string>
+ <reference key="source" ref="63651044"/>
+ <reference key="destination" ref="17386715"/>
+ </object>
+ <int key="connectionID">925</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -3440,6 +3467,8 @@
<reference ref="587676764"/>
<reference ref="785987636"/>
<reference ref="449401330"/>
+ <reference ref="477591318"/>
+ <reference ref="17386715"/>
</object>
<reference key="parent" ref="228261277"/>
</object>
@@ -3518,6 +3547,16 @@
<reference key="object" ref="921138658"/>
<reference key="parent" ref="302471527"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">923</int>
+ <reference key="object" ref="477591318"/>
+ <reference key="parent" ref="1056168652"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">924</int>
+ <reference key="object" ref="17386715"/>
+ <reference key="parent" ref="1056168652"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -3849,6 +3888,8 @@
<string>914.IBPluginDependency</string>
<string>92.IBPluginDependency</string>
<string>92.ImportedFromIB2</string>
+ <string>923.IBPluginDependency</string>
+ <string>924.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -3894,7 +3935,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{408, 457}, {241, 103}}</string>
+ <string>{{622, 457}, {241, 103}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3909,7 +3950,7 @@
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{262, 517}, {146, 213}}</string>
+ <string>{{476, 517}, {146, 213}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{654, 613}, {157, 223}}</string>
@@ -3942,7 +3983,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{449, 1007}, {197, 53}}</string>
- <string>{{114, 730}, {511, 20}}</string>
+ <string>{{328, 730}, {511, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>{{506, 836}, {511, 20}}</string>
@@ -4090,7 +4131,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{437, 547}, {268, 183}}</string>
+ <string>{{651, 517}, {268, 213}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{829, 663}, {268, 173}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -4220,6 +4261,8 @@ w6gg4oaSIGZhY2FkZV0</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@@ -4242,12 +4285,24 @@ w6gg4oaSIGZhY2FkZV0</string>
</object>
</object>
<nil key="sourceID"/>
- <int key="maxID">922</int>
+ <int key="maxID">925</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
+ <string key="className">CMCopyTable</string>
+ <string key="superclassName">NSTableView</string>
+ <object class="NSMutableDictionary" key="actions">
+ <string key="NS.key.0">copy:</string>
+ <string key="NS.object.0">id</string>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/CMCopyTable.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
<string key="className">FirstResponder</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
@@ -4321,6 +4376,31 @@ w6gg4oaSIGZhY2FkZV0</string>
<object class="IBPartialClassDescription">
<string key="className">MainController</string>
<string key="superclassName">NSObject</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>donate:</string>
+ <string>openPreferences:</string>
+ <string>visitHelpWebsite:</string>
+ <string>visitWebsite:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/MainController.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">MainController</string>
+ <string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
@@ -4334,20 +4414,37 @@ w6gg4oaSIGZhY2FkZV0</string>
<string key="minorKey"/>
</object>
</object>
- </object>
- <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
- <bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
- <string key="className">MainController</string>
- <string key="superclassName">NSObject</string>
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/CMImageView.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSObject</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/CMMCPConnection.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSTextView</string>
<object class="NSMutableDictionary" key="actions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMutableArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>donate:</string>
- <string>openPreferences:</string>
- <string>visitHelpWebsite:</string>
- <string>visitWebsite:</string>
+ <string>doDecomposedStringWithCanonicalMapping:</string>
+ <string>doDecomposedStringWithCompatibilityMapping:</string>
+ <string>doPrecomposedStringWithCanonicalMapping:</string>
+ <string>doPrecomposedStringWithCompatibilityMapping:</string>
+ <string>doRemoveDiacritics:</string>
+ <string>doSelectionLowerCase:</string>
+ <string>doSelectionTitleCase:</string>
+ <string>doSelectionUpperCase:</string>
+ <string>doTranspose:</string>
+ <string>selectCurrentLine:</string>
+ <string>selectCurrentWord:</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -4355,13 +4452,258 @@ w6gg4oaSIGZhY2FkZV0</string>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
- <string key="majorKey">IBDocumentRelativeSource</string>
- <string key="minorKey">../../Source/MainController.h</string>
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPTextViewAdditions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">NSWindow</string>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPWindowAdditions.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">SPQueryConsole</string>
+ <string key="superclassName">NSWindowController</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>clearConsole:</string>
+ <string>copy:</string>
+ <string>saveConsoleAs:</string>
+ <string>toggleShowHelpStatements:</string>
+ <string>toggleShowSelectShowStatements:</string>
+ <string>toggleShowTimeStamps:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>clearConsoleButton</string>
+ <string>consoleSearchField</string>
+ <string>consoleTableView</string>
+ <string>includeTimeStampsButton</string>
+ <string>progressIndicator</string>
+ <string>saveConsoleButton</string>
+ <string>saveLogView</string>
+ <string>showHelpMenuItem</string>
+ <string>showSelectShowStatementsMenuItem</string>
+ <string>showTimeStampsMenuItem</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>NSButton</string>
+ <string>NSSearchField</string>
+ <string>NSTableView</string>
+ <string>NSButton</string>
+ <string>NSProgressIndicator</string>
+ <string>NSButton</string>
+ <string>NSView</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ <string>NSMenuItem</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/SPQueryConsole.h</string>
+ </object>
+ </object>
+ <object class="IBPartialClassDescription">
+ <string key="className">TableDocument</string>
+ <string key="superclassName">NSDocument</string>
+ <object class="NSMutableDictionary" key="actions">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>addConnectionToFavorites:</string>
+ <string>addDatabase:</string>
+ <string>analyzeTable:</string>
+ <string>cancelConnectSheet:</string>
+ <string>checkTable:</string>
+ <string>checksumTable:</string>
+ <string>chooseDatabase:</string>
+ <string>chooseEncoding:</string>
+ <string>chooseFavorite:</string>
+ <string>closeDatabaseSheet:</string>
+ <string>closeSheet:</string>
+ <string>connect:</string>
+ <string>connectSheetAddToFavorites:</string>
+ <string>connectToDB:</string>
+ <string>copyColumnNames:</string>
+ <string>copyCreateTableSyntax:</string>
+ <string>editFavorites:</string>
+ <string>export:</string>
+ <string>exportMultipleTables:</string>
+ <string>exportTable:</string>
+ <string>flushPrivileges:</string>
+ <string>flushTable:</string>
+ <string>import:</string>
+ <string>optimizeTable:</string>
+ <string>removeDatabase:</string>
+ <string>repairTable:</string>
+ <string>setDatabases:</string>
+ <string>showCreateTableSyntax:</string>
+ <string>showMySQLHelp:</string>
+ <string>showVariables:</string>
+ <string>viewContent:</string>
+ <string>viewQuery:</string>
+ <string>viewStatus:</string>
+ <string>viewStructure:</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="NSMutableDictionary" key="outlets">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSMutableArray" key="dict.sortedKeys">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>addDatabaseButton</string>
+ <string>chooseDatabaseButton</string>
+ <string>connectFavoritesTableView</string>
+ <string>connectProgressBar</string>
+ <string>connectProgressStatusText</string>
+ <string>connectSheet</string>
+ <string>createTableSyntaxWindow</string>
+ <string>customQueryInstance</string>
+ <string>customQueryTextView</string>
+ <string>databaseEncodingButton</string>
+ <string>databaseField</string>
+ <string>databaseNameField</string>
+ <string>databaseSheet</string>
+ <string>dbTablesTableView</string>
+ <string>favoritesButton</string>
+ <string>favoritesController</string>
+ <string>hostField</string>
+ <string>keyChainInstance</string>
+ <string>nameField</string>
+ <string>passwordField</string>
+ <string>portField</string>
+ <string>queryProgressBar</string>
+ <string>sidebarGrabber</string>
+ <string>socketField</string>
+ <string>spExportControllerInstance</string>
+ <string>syntaxView</string>
+ <string>syntaxViewContent</string>
+ <string>tableContentInstance</string>
+ <string>tableDataInstance</string>
+ <string>tableDumpInstance</string>
+ <string>tableSourceInstance</string>
+ <string>tableStatusInstance</string>
+ <string>tableTabView</string>
+ <string>tableWindow</string>
+ <string>tablesListInstance</string>
+ <string>userField</string>
+ <string>variablesSheet</string>
+ <string>variablesTableView</string>
+ </object>
+ <object class="NSMutableArray" key="dict.values">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTableView</string>
+ <string>id</string>
+ <string>NSTextField</string>
+ <string>id</string>
+ <string>NSWindow</string>
+ <string>id</string>
+ <string>NSTextView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTableView</string>
+ <string>id</string>
+ <string>NSArrayController</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>NSTabView</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ <string>id</string>
+ </object>
+ </object>
+ <object class="IBClassDescriptionSource" key="sourceIdentifier">
+ <string key="majorKey">IBProjectSource</string>
+ <string key="minorKey">Source/TableDocument.h</string>
</object>
</object>
+ </object>
+ <object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.1+">
+ <bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier" id="939419192">
diff --git a/Source/TableDocument.h b/Source/TableDocument.h
index 94e95047..17440f68 100644
--- a/Source/TableDocument.h
+++ b/Source/TableDocument.h
@@ -150,6 +150,8 @@
//table methods
- (IBAction)showCreateTableSyntax:(id)sender;
- (IBAction)copyCreateTableSyntax:(id)sender;
+- (IBAction)copyColumnNames:(id)sender;
+- (NSArray *)columnNames;
- (IBAction)checkTable:(id)sender;
- (IBAction)analyzeTable:(id)sender;
- (IBAction)optimizeTable:(id)sender;
diff --git a/Source/TableDocument.m b/Source/TableDocument.m
index ecbe6d86..fcb3340e 100644
--- a/Source/TableDocument.m
+++ b/Source/TableDocument.m
@@ -160,11 +160,10 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[connection setValue:versionForPrint forKey:@"version"];
NSArray *columns, *rows;
- columns = rows = [[NSArray alloc] init];
+ columns = rows = nil;
+ columns = [self columnNames];
if ( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0 ){
- if([[tableSourceInstance tableStructureForPrint] count] > 0)
- columns = [[NSArray alloc] initWithArray:[[tableSourceInstance tableStructureForPrint] objectAtIndex:0] copyItems:YES];
if([[tableSourceInstance tableStructureForPrint] count] > 1)
rows = [[NSArray alloc] initWithArray:
[[tableSourceInstance tableStructureForPrint] objectsAtIndexes:
@@ -173,8 +172,6 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
];
}
else if ( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1 ){
- if([[tableContentInstance currentResult] count] > 0)
- columns = [[NSArray alloc] initWithArray:[[tableContentInstance currentResult] objectAtIndex:0] copyItems:YES];
if([[tableContentInstance currentResult] count] > 1)
rows = [[NSArray alloc] initWithArray:
[[tableContentInstance currentResult] objectsAtIndexes:
@@ -184,8 +181,6 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
[connection setValue:[tableContentInstance usedQuery] forKey:@"query"];
}
else if ( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2 ){
- if([[customQueryInstance currentResult] count] > 0)
- columns = [[NSArray alloc] initWithArray:[[customQueryInstance currentResult] objectAtIndex:0] copyItems:YES];
if([[customQueryInstance currentResult] count] > 1)
rows = [[NSArray alloc] initWithArray:
[[customQueryInstance currentResult] objectsAtIndexes:
@@ -982,6 +977,45 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
notificationName:@"Table Syntax Copied"];
}
+- (IBAction)copyColumnNames:(id)sender
+{
+ //NSArray *columns;
+ NSString *columnNames;
+ //columns = ;
+ if ([self columnNames]) {
+ columnNames = [NSString stringWithFormat:@"`%@`", [[self columnNames] componentsJoinedByString:@"`, `"]];
+ }
+
+ if([columnNames length]){
+ NSPasteboard *pasteBoard = [NSPasteboard generalPasteboard];
+ // Copy the string to the pasteboard
+ [pasteBoard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, nil] owner:nil];
+ [pasteBoard setString:columnNames forType:NSStringPboardType];
+ }
+}
+
+- (NSArray *)columnNames
+{
+ NSArray *columns = nil;
+ if ( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 0
+ && [[tableSourceInstance tableStructureForPrint] count] > 0 ){
+ columns = [[NSArray alloc] initWithArray:[[tableSourceInstance tableStructureForPrint] objectAtIndex:0] copyItems:YES];
+ }
+ else if ( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 1
+ && [[tableContentInstance currentResult] count] > 0 ){
+ columns = [[NSArray alloc] initWithArray:[[tableContentInstance currentResult] objectAtIndex:0] copyItems:YES];
+ }
+ else if ( [tableTabView indexOfTabViewItem:[tableTabView selectedTabViewItem]] == 2
+ && [[customQueryInstance currentResult] count] > 0 ){
+ columns = [[NSArray alloc] initWithArray:[[customQueryInstance currentResult] objectAtIndex:0] copyItems:YES];
+ }
+
+ if(columns) {
+ [columns autorelease];
+ }
+ return columns;
+}
+
/**
* Performs a MySQL check table on the selected table and presents the result to the user via an alert sheet.
*/
@@ -1473,6 +1507,7 @@ NSString *TableDocumentFavoritesControllerSelectionIndexDidChange = @"TableDocum
// table menu items
if ([menuItem action] == @selector(showCreateTableSyntax:) ||
[menuItem action] == @selector(copyCreateTableSyntax:) ||
+ [menuItem action] == @selector(copyColumnNames:) ||
[menuItem action] == @selector(checkTable:) ||
[menuItem action] == @selector(analyzeTable:) ||
[menuItem action] == @selector(optimizeTable:) ||
diff --git a/Source/TableDump.m b/Source/TableDump.m
index e44e01ae..23db6cf5 100644
--- a/Source/TableDump.m
+++ b/Source/TableDump.m
@@ -193,7 +193,7 @@
contextInfo = @"exportMultipleTablesAsXML";
break;
default:
- NSLog(@"ERROR: unknown export item with tag %d", tag);
+ ALog(@"ERROR: unknown export item with tag %d", tag);
return;
break;
}
@@ -312,7 +312,7 @@
// Unknown operation
} else {
- NSLog(@"Unknown export operation: %@", [contextInfo description]);
+ ALog(@"Unknown export operation: %@", [contextInfo description]);
return;
}
@@ -391,7 +391,7 @@
// Load file into string. For SQL imports, try UTF8 file encoding before the current encoding.
if ([fileType isEqualToString:@"SQL"]) {
- NSLog(@"Attempting to read as utf8");
+ DLog(@"Attempting to read as utf8");
dumpFile = [SPSQLParser stringWithContentsOfFile:filename
encoding:NSUTF8StringEncoding
error:&errorStr];
@@ -407,7 +407,7 @@
// If the SQL-as-UTF8 read failed, and for CSVs, use the current connection encoding.
if (!importSQLAsUTF8 || [fileType isEqualToString:@"CSV"]) {
- NSLog(@"Reading using connection encoding");
+ DLog(@"Reading using connection encoding");
dumpFile = [SPSQLParser stringWithContentsOfFile:filename
encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance connectionEncoding] UTF8String]]
error:&errorStr];
@@ -505,8 +505,6 @@
////////////////
} else if ( [fileType isEqualToString:@"CSV"] ) {
- //NSLog(@"CSV Import...");
- //import csv file
int code;
NSPopUpButtonCell *buttonCell = [[NSPopUpButtonCell alloc] init];
@@ -1309,10 +1307,7 @@
/*
loads a csv string into an array
*/
-{
-
- //NSLog(@"In arrayForCSV...");
-
+{
NSMutableString *tempTerminated, *tempLineEnds;
NSMutableArray *tempArray = [NSMutableArray array];
NSMutableArray *tempRowArray = [NSMutableArray array];
@@ -1444,7 +1439,6 @@
}
//add row to tempArray
[tempArray addObject:[NSArray arrayWithArray:tempRowArray]];
- //NSLog(@"tempArray count: %d", [tempArray count]);
}
return [NSArray arrayWithArray:tempArray];
@@ -1871,7 +1865,6 @@
}
} else {
//add object to array
- //NSLog([string substringWithRange:NSMakeRange(start,(i-start))]);
[tempArray addObject:[string substringWithRange:NSMakeRange(start,(i-start))]];
start = i + 1;
}
@@ -2042,9 +2035,7 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
}
- (void)dealloc
-{
- // NSLog(@"TableDump dealloc");
-
+{
[tables release];
[importArray release];
[fieldMappingButtonOptions release];
diff --git a/Source/TablesList.m b/Source/TablesList.m
index df22bb92..beeef5a1 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -707,7 +707,6 @@
*/
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
{
-
if ( [tablesListView numberOfSelectedRows] == 1 && [[self tableName] length] ) {
// Reset the table information caches
@@ -750,24 +749,24 @@
// Change mainMenu > Table > ... according to table type
[[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create View Syntax", @"copy create view syntax menu item")];
[[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create View Syntax", @"show create view syntax menu item")];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setTitle:NSLocalizedString(@"Check View", @"check view menu item")];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:4] setHidden:YES]; // repair
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:YES]; // analyse
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:YES]; // optimize
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; // checksum
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:5] setTitle:NSLocalizedString(@"Check View", @"check view menu item")];
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:YES]; // repair
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:YES]; // analyse
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:YES]; // optimize
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:10] setTitle:NSLocalizedString(@"Flush View", @"flush view menu item")];
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:11] setHidden:YES]; // checksum
[removeTableMenuItem setTitle:NSLocalizedString(@"Remove view", @"remove view menu title")];
[duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate view", @"duplicate view menu title")];
} else {
[[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:0] setTitle:NSLocalizedString(@"Copy Create Table Syntax", @"copy create table syntax menu item")];
[[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:1] setTitle:NSLocalizedString(@"Show Create Table Syntax", @"show create table syntax menu item")];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:3] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:4] setHidden:NO];
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:5] setTitle:NSLocalizedString(@"Check Table", @"check table menu item")];
[[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:6] setHidden:NO];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:7] setHidden:NO];
- [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")];
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:8] setHidden:NO];
[[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:9] setHidden:NO];
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:10] setTitle:NSLocalizedString(@"Flush Table", @"flush table menu item")];
+ [[[[[NSApp mainMenu] itemAtIndex:5] submenu] itemAtIndex:11] setHidden:NO];
[removeTableMenuItem setTitle:NSLocalizedString(@"Remove table", @"remove table menu title")];
[duplicateTableMenuItem setTitle:NSLocalizedString(@"Duplicate table", @"duplicate table menu title")];