aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormltownsend <mltownsend@gmail.com>2008-11-10 19:56:30 +0000
committermltownsend <mltownsend@gmail.com>2008-11-10 19:56:30 +0000
commitc8146f9c28da66f02d47537e505a70725fb0c2b4 (patch)
treef967e1cadc654ea262f5fa7402572fdc2482d60d
parent87173093000bc5c36962451cc3e58c9aaac5ab50 (diff)
downloadsequelpro-c8146f9c28da66f02d47537e505a70725fb0c2b4.tar.gz
sequelpro-c8146f9c28da66f02d47537e505a70725fb0c2b4.tar.bz2
sequelpro-c8146f9c28da66f02d47537e505a70725fb0c2b4.zip
New XCode project
-rw-r--r--CMCopyTable.h72
-rw-r--r--CMCopyTable.m254
-rw-r--r--CMImageView.h6
-rw-r--r--CMImageView.m10
-rw-r--r--CMMCPConnection.h2
-rw-r--r--CMMCPConnection.m28
-rw-r--r--CMMCPResult.m211
-rw-r--r--CustomQuery.h48
-rw-r--r--CustomQuery.m986
-rw-r--r--English.lproj/Credits.rtf3
-rw-r--r--English.lproj/DBView.xib8
-rwxr-xr-xImageAndTextCell.h2
-rwxr-xr-xImageAndTextCell.m92
-rw-r--r--Info.plist28
-rw-r--r--KeyChain.h2
-rw-r--r--KeyChain.m86
-rw-r--r--MainController.h72
-rw-r--r--MainController.m930
-rw-r--r--SPTableInfo.m4
-rw-r--r--SSHTunnel.h40
-rwxr-xr-xSSHTunnel.m570
-rwxr-xr-xSSHTunnel_old.h8
-rwxr-xr-xSSHTunnel_old.m124
-rw-r--r--TableContent.h2
-rw-r--r--TableContent.m1972
-rw-r--r--TableDocument.h18
-rw-r--r--TableDocument.m534
-rw-r--r--TableDump.h116
-rw-r--r--TableDump.m2297
-rw-r--r--TableSource.h68
-rw-r--r--TableSource.m1361
-rw-r--r--TableStatus.h38
-rw-r--r--TableStatus.m126
-rw-r--r--TablesList.h42
-rw-r--r--TablesList.m760
-rw-r--r--gpl.html1
-rw-r--r--gpl.txt340
-rw-r--r--main.m4
-rwxr-xr-xsequel-pro.scriptSuite68
-rwxr-xr-xsequel-pro.scriptTerminology58
-rw-r--r--sequel-pro.xcodeproj/TemplateIcon.icnsbin0 -> 52318 bytes
-rw-r--r--sequel-pro.xcodeproj/ide.pbxuser222
-rw-r--r--sequel-pro.xcodeproj/project.pbxproj1111
-rw-r--r--sequel-pro_Prefix.pch7
44 files changed, 5991 insertions, 6740 deletions
diff --git a/CMCopyTable.h b/CMCopyTable.h
index 18fabde5..8b4e1485 100644
--- a/CMCopyTable.h
+++ b/CMCopyTable.h
@@ -27,12 +27,12 @@
/*!
- @class copyTable
- @abstract subclassed NSTableView to implement copy & drag-n-drop
- @discussion Allows copying by creating a string with each table row as
- a separate line and each cell then separate via tabs. The drag out
- is in similar format. The values for each cell are obtained via the
- objects description method
+ @class copyTable
+ @abstract subclassed NSTableView to implement copy & drag-n-drop
+ @discussion Allows copying by creating a string with each table row as
+ a separate line and each cell then separate via tabs. The drag out
+ is in similar format. The values for each cell are obtained via the
+ objects description method
*/
@interface CMCopyTable : NSTableView
{
@@ -40,52 +40,52 @@
}
/*!
- @method copy:
- @abstract does the work of copying
- @discussion gets selected (if any) row(s) as a string setting it
- then into th default pasteboard as a string type and tabular text type.
- @param sender who asked for this copy?
+ @method copy:
+ @abstract does the work of copying
+ @discussion gets selected (if any) row(s) as a string setting it
+ then into th default pasteboard as a string type and tabular text type.
+ @param sender who asked for this copy?
*/
- (void)copy:(id)sender;
/*!
- @method validateMenuItem:
- @abstract Dynamically enable Copy menu item for the table view
- @discussion Will only enable the Copy item when something is selected in
- this table view
- @param anItem the menu item being validated
- @result YES if there is at least one row selected & the menu item is
- copy, NO otherwise
+ @method validateMenuItem:
+ @abstract Dynamically enable Copy menu item for the table view
+ @discussion Will only enable the Copy item when something is selected in
+ this table view
+ @param anItem the menu item being validated
+ @result YES if there is at least one row selected & the menu item is
+ copy, NO otherwise
*/
- (BOOL)validateMenuItem:(NSMenuItem*)anItem;
/*!
- @method draggingSourceOperationMaskForLocal:
- @discussion Allows for dragging out of the table to other applications
- @param isLocal who cares
- @result Always calls for a copy type drag operation
+ @method draggingSourceOperationMaskForLocal:
+ @discussion Allows for dragging out of the table to other applications
+ @param isLocal who cares
+ @result Always calls for a copy type drag operation
*/
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
/*!
- @method selectedRowsAsTabString
- @abstract getter of the selected rows of the table for copy
- @discussion For the selected rows returns a single string with each row
- separated by a newline and then for each column value separated by a
- tab. Values are from the objects description method, so make sure it
- returns something meaningful.
- @result The above described string, or nil if nothing selected
+ @method selectedRowsAsTabString
+ @abstract getter of the selected rows of the table for copy
+ @discussion For the selected rows returns a single string with each row
+ separated by a newline and then for each column value separated by a
+ tab. Values are from the objects description method, so make sure it
+ returns something meaningful.
+ @result The above described string, or nil if nothing selected
*/
- (NSString *)selectedRowsAsTabString;
/*!
- @method draggedRowsAsTabString:
- @abstract getter of the dragged rows of the table for drag
- @discussion For the dragged rows returns a single string with each row
- separated by a newline and then for each column value separated by a
- tab. Values are from the objects description method, so make sure it
- returns something meaningful.
- @result The above described string, or nil if nothing selected
+ @method draggedRowsAsTabString:
+ @abstract getter of the dragged rows of the table for drag
+ @discussion For the dragged rows returns a single string with each row
+ separated by a newline and then for each column value separated by a
+ tab. Values are from the objects description method, so make sure it
+ returns something meaningful.
+ @result The above described string, or nil if nothing selected
*/
- (NSString *)draggedRowsAsTabString:(NSArray *)rows;
diff --git a/CMCopyTable.m b/CMCopyTable.m
index 8b46b583..7eb80c52 100644
--- a/CMCopyTable.m
+++ b/CMCopyTable.m
@@ -27,19 +27,19 @@
- (void)copy:(id)sender
{
- NSString *tmp = [self selectedRowsAsTabString];
-
- if ( nil != tmp )
- {
- NSPasteboard *pb = [NSPasteboard generalPasteboard];
-
- [pb declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType,
- NSStringPboardType, nil]
- owner:nil];
-
- [pb setString:tmp forType:NSStringPboardType];
- [pb setString:tmp forType:NSTabularTextPboardType];
- }
+ NSString *tmp = [self selectedRowsAsTabString];
+
+ if ( nil != tmp )
+ {
+ NSPasteboard *pb = [NSPasteboard generalPasteboard];
+
+ [pb declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType,
+ NSStringPboardType, nil]
+ owner:nil];
+
+ [pb setString:tmp forType:NSStringPboardType];
+ [pb setString:tmp forType:NSTabularTextPboardType];
+ }
}
//allow for drag-n-drop out of the application as a copy
@@ -50,134 +50,134 @@
//only have the copy menu item enabled when row(s) are selected
- (BOOL)validateMenuItem:(NSMenuItem*)anItem
-{
- int row = [self selectedRow];
- if ([[anItem title] isEqualToString:@"Copy"] )
- {
- if (row < 0 )
- {
- return NO;
- }
- }
- return YES;
+{
+ int row = [self selectedRow];
+ if ([[anItem title] isEqualToString:@"Copy"] )
+ {
+ if (row < 0 )
+ {
+ return NO;
+ }
+ }
+ return YES;
}
//get selected rows a string of newline separated lines of tab separated fields
//the value in each field is from the objects description method
- (NSString *)selectedRowsAsTabString
{
- if ( [self numberOfSelectedRows] > 0 )
- {
- NSArray *columns = [self tableColumns];
- int numColumns = [columns count];
- id dataSource = [self dataSource];
-
- NSMutableString *result = [NSMutableString stringWithCapacity:numColumns];
+ if ( [self numberOfSelectedRows] > 0 )
+ {
+ NSArray *columns = [self tableColumns];
+ int numColumns = [columns count];
+ id dataSource = [self dataSource];
+
+ NSMutableString *result = [NSMutableString stringWithCapacity:numColumns];
- //this is really deprecated in 10.3, but the new method is really weird
- NSEnumerator *enumerator = [self selectedRowEnumerator];
-
- int c;
- id row = nil;
- id rowData = nil;
- NSTableColumn *col = nil;
-
- while (row = [enumerator nextObject])
- {
- rowData = nil;
- for ( c = 0; c < numColumns; c++)
- {
- col = [columns objectAtIndex:c];
- rowData = [dataSource tableView:self
- objectValueForTableColumn:col
- row:[row intValue] ];
-
- if ( nil != rowData )
- {
- [result appendString:[NSString stringWithFormat:@"%@\t", [rowData description] ] ];
- }
- else
- {
- [result appendString:@"\t"];
- }
- } //end for each column
-
- if ( [result length] )
- {
- [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
- }
- [result appendString: [ NSString stringWithFormat:@"\n"]];
- } //end for each row
-
- if ( [result length] )
- {
- [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
- }
- return result;
- }
- else
- {
- return nil;
- }
+ //this is really deprecated in 10.3, but the new method is really weird
+ NSEnumerator *enumerator = [self selectedRowEnumerator];
+
+ int c;
+ id row = nil;
+ id rowData = nil;
+ NSTableColumn *col = nil;
+
+ while (row = [enumerator nextObject])
+ {
+ rowData = nil;
+ for ( c = 0; c < numColumns; c++)
+ {
+ col = [columns objectAtIndex:c];
+ rowData = [dataSource tableView:self
+ objectValueForTableColumn:col
+ row:[row intValue] ];
+
+ if ( nil != rowData )
+ {
+ [result appendString:[NSString stringWithFormat:@"%@\t", [rowData description] ] ];
+ }
+ else
+ {
+ [result appendString:@"\t"];
+ }
+ } //end for each column
+
+ if ( [result length] )
+ {
+ [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
+ }
+ [result appendString: [ NSString stringWithFormat:@"\n"]];
+ } //end for each row
+
+ if ( [result length] )
+ {
+ [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
+ }
+ return result;
+ }
+ else
+ {
+ return nil;
+ }
}
//get dragged rows a string of newline separated lines of tab separated fields
//the value in each field is from the objects description method
- (NSString *)draggedRowsAsTabString:(NSArray *)rows
{
- if ( [rows count] > 0 )
- {
- NSArray *columns = [self tableColumns];
- int numColumns = [columns count];
- id dataSource = [self dataSource];
-
- NSMutableString *result = [NSMutableString stringWithCapacity:numColumns];
+ if ( [rows count] > 0 )
+ {
+ NSArray *columns = [self tableColumns];
+ int numColumns = [columns count];
+ id dataSource = [self dataSource];
+
+ NSMutableString *result = [NSMutableString stringWithCapacity:numColumns];
- //this is really deprecated in 10.3, but the new method is really weird
- NSEnumerator *enumerator = [rows objectEnumerator];
-
- int c;
- id row = nil;
- id rowData = nil;
- NSTableColumn *col = nil;
-
- while (row = [enumerator nextObject])
- {
- rowData = nil;
- for ( c = 0; c < numColumns; c++)
- {
- col = [columns objectAtIndex:c];
- rowData = [dataSource tableView:self
- objectValueForTableColumn:col
- row:[row intValue] ];
-
- if ( nil != rowData )
- {
- [result appendString:[NSString stringWithFormat:@"%@\t", [rowData description] ] ];
- }
- else
- {
- [result appendString:@"\t"];
- }
- } //end for each column
-
- if ( [result length] )
- {
- [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
- }
- [result appendString: [ NSString stringWithFormat:@"\n"]];
- } //end for each row
-
- if ( [result length] )
- {
- [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
- }
- return result;
- }
- else
- {
- return nil;
- }
+ //this is really deprecated in 10.3, but the new method is really weird
+ NSEnumerator *enumerator = [rows objectEnumerator];
+
+ int c;
+ id row = nil;
+ id rowData = nil;
+ NSTableColumn *col = nil;
+
+ while (row = [enumerator nextObject])
+ {
+ rowData = nil;
+ for ( c = 0; c < numColumns; c++)
+ {
+ col = [columns objectAtIndex:c];
+ rowData = [dataSource tableView:self
+ objectValueForTableColumn:col
+ row:[row intValue] ];
+
+ if ( nil != rowData )
+ {
+ [result appendString:[NSString stringWithFormat:@"%@\t", [rowData description] ] ];
+ }
+ else
+ {
+ [result appendString:@"\t"];
+ }
+ } //end for each column
+
+ if ( [result length] )
+ {
+ [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
+ }
+ [result appendString: [ NSString stringWithFormat:@"\n"]];
+ } //end for each row
+
+ if ( [result length] )
+ {
+ [result deleteCharactersInRange:NSMakeRange([result length]-1, 1)];
+ }
+ return result;
+ }
+ else
+ {
+ return nil;
+ }
}
@end
diff --git a/CMImageView.h b/CMImageView.h
index c0444240..f52e8e5b 100644
--- a/CMImageView.h
+++ b/CMImageView.h
@@ -26,9 +26,9 @@
@interface CMImageView : NSImageView {
-
- NSString *draggedFilePath;
-
+
+ NSString *draggedFilePath;
+
}
- (NSString *)draggedFilePath;
diff --git a/CMImageView.m b/CMImageView.m
index f3757879..0eb4c250 100644
--- a/CMImageView.m
+++ b/CMImageView.m
@@ -32,17 +32,17 @@
returns the path of the dragged file
*/
{
- return [NSString stringWithString:draggedFilePath];
+ return [NSString stringWithString:draggedFilePath];
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
{
- if ( draggedFilePath )
- [draggedFilePath release];
+ if ( draggedFilePath )
+ [draggedFilePath release];
- draggedFilePath = [[NSString stringWithString:[[[sender draggingPasteboard] propertyListForType:@"NSFilenamesPboardType"] objectAtIndex:0]] retain];
+ draggedFilePath = [[NSString stringWithString:[[[sender draggingPasteboard] propertyListForType:@"NSFilenamesPboardType"] objectAtIndex:0]] retain];
- [super concludeDragOperation:sender];
+ [super concludeDragOperation:sender];
}
@end
diff --git a/CMMCPConnection.h b/CMMCPConnection.h
index 1433d885..3e6212ed 100644
--- a/CMMCPConnection.h
+++ b/CMMCPConnection.h
@@ -27,7 +27,7 @@
#import "CMMCPResult.h"
@interface CMMCPConnection : MCPConnection {
- id delegate;
+ id delegate;
}
- (CMMCPResult *) queryString:(NSString *) query;
diff --git a/CMMCPConnection.m b/CMMCPConnection.m
index 1e022e40..a8ae8dac 100644
--- a/CMMCPConnection.m
+++ b/CMMCPConnection.m
@@ -103,14 +103,14 @@
modified version of queryString to be used in sequel-pro
*/
{
- CMMCPResult *theResult;
- const char *theCQuery = [self cStringFromString:query];
- int theQueryCode;
+ CMMCPResult *theResult;
+ const char *theCQuery = [self cStringFromString:query];
+ int theQueryCode;
//[DIFF]: check connection
- if ( ![self checkConnection] ) {
- NSLog(@"Connection was gone, but should be reestablished now!");
- }
+ if ( ![self checkConnection] ) {
+ NSLog(@"Connection was gone, but should be reestablished now!");
+ }
//end [DIFF]
//[DIFF]: inform the delegate about the query
@@ -127,18 +127,18 @@ modified version of queryString to be used in sequel-pro
else {
return nil;
}
- }
- else {
-// NSLog (@"Problem in queryString error code is : %d, query is : %s -in ObjC : %@-\n", theQueryCode, theCQuery, query);
-// NSLog(@"Error message is : %@\n", [self getLastErrorMessage]);
-// theResult = [theResult init]; // Old version...
-// theResult = nil;
+ }
+ else {
+// NSLog (@"Problem in queryString error code is : %d, query is : %s -in ObjC : %@-\n", theQueryCode, theCQuery, query);
+// NSLog(@"Error message is : %@\n", [self getLastErrorMessage]);
+// theResult = [theResult init]; // Old version...
+// theResult = nil;
//[DIFF]: inform the delegate about errors
if ( delegate && [delegate respondsToSelector:@selector(queryGaveError:)] )
[delegate queryGaveError:[self getLastErrorMessage]];
//end [DIFF]
return nil;
- }
+ }
return [theResult autorelease];
}
@@ -147,7 +147,7 @@ modified version of queryString to be used in sequel-pro
sets the delegate
*/
{
- delegate = object;
+ delegate = object;
}
diff --git a/CMMCPResult.m b/CMMCPResult.m
index ff5c6c88..a41ce84d 100644
--- a/CMMCPResult.m
+++ b/CMMCPResult.m
@@ -32,123 +32,114 @@
modified version for use with sequel-pro
"*/
{
- MYSQL_ROW theRow;
- unsigned long *theLengths;
- MYSQL_FIELD *theField;
- int i;
- id theReturn;
+ MYSQL_ROW theRow;
+ unsigned long *theLengths;
+ MYSQL_FIELD *theField;
+ int i;
+ id theReturn;
- if (mResult == NULL) {
-// If there is no results, returns nil, as after the last row...
- return nil;
- }
+ if (mResult == NULL) {
+ // If there is no results, returns nil, as after the last row...
+ return nil;
+ }
- theRow = mysql_fetch_row(mResult);
- if (theRow == NULL) {
- return nil;
- }
+ theRow = mysql_fetch_row(mResult);
+ if (theRow == NULL) {
+ return nil;
+ }
- switch (aType) {
- case MCPTypeArray:
- theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields];
- break;
- case MCPTypeDictionary:
- if (mNames == nil) {
- [self fetchFieldNames];
- }
- theReturn = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields];
- break;
- default :
- NSLog (@"Unknown type : %d, will return an Array!\n", aType);
- theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields];
- break;
- }
+ switch (aType) {
+ case MCPTypeArray:
+ theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields];
+ break;
+ case MCPTypeDictionary:
+ if (mNames == nil) {
+ [self fetchFieldNames];
+ }
+ theReturn = [NSMutableDictionary dictionaryWithCapacity:mNumOfFields];
+ break;
+ default :
+ NSLog (@"Unknown type : %d, will return an Array!\n", aType);
+ theReturn = [NSMutableArray arrayWithCapacity:mNumOfFields];
+ break;
+ }
- theLengths = mysql_fetch_lengths(mResult);
- theField = mysql_fetch_fields(mResult);
- for (i=0; i<mNumOfFields; i++) {
- id theCurrentObj;
+ theLengths = mysql_fetch_lengths(mResult);
+ theField = mysql_fetch_fields(mResult);
+
+ for (i=0; i<mNumOfFields; i++) {
+ id theCurrentObj;
- if (theRow[i] == NULL) {
- theCurrentObj = [NSNull null];
- }
- else {
- char *theData = calloc(sizeof(char),theLengths[i]+1);
-// char *theUselLess;
- memcpy(theData, theRow[i],theLengths[i]);
- theData[theLengths[i]] = '\0';
+ if (theRow[i] == NULL) {
+ theCurrentObj = [NSNull null];
+ }
+ else {
+ char *theData = calloc(sizeof(char),theLengths[i]+1);
+ // char *theUselLess;
+ memcpy(theData, theRow[i],theLengths[i]);
+ theData[theLengths[i]] = '\0';
- switch (theField[i].type) {
- case FIELD_TYPE_TINY:
- case FIELD_TYPE_SHORT:
- case FIELD_TYPE_INT24:
- case FIELD_TYPE_LONG:
- case FIELD_TYPE_LONGLONG:
- case FIELD_TYPE_DECIMAL:
- case FIELD_TYPE_FLOAT:
- case FIELD_TYPE_DOUBLE:
- case FIELD_TYPE_NEW_DECIMAL:
- theCurrentObj = [self stringWithCString:theData];
- break;
- case FIELD_TYPE_TIMESTAMP:
- case FIELD_TYPE_DATE:
- case FIELD_TYPE_TIME:
- case FIELD_TYPE_DATETIME:
- case FIELD_TYPE_YEAR:
- theCurrentObj = [self stringWithCString:theData];
- break;
- case FIELD_TYPE_VAR_STRING:
- case FIELD_TYPE_STRING:
- theCurrentObj = [self stringWithCString:theData];
- break;
- case FIELD_TYPE_TINY_BLOB:
- case FIELD_TYPE_BLOB:
- case FIELD_TYPE_MEDIUM_BLOB:
- case FIELD_TYPE_LONG_BLOB:
- theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]];
- if (!(theField[i].flags & BINARY_FLAG)) { // It is TEXT and NOT BLOB...
- theCurrentObj = [self stringWithText:theCurrentObj];
- }
-//#warning Should check for TEXT (using theField[i].flag BINARY_FLAG)
- break;
- case FIELD_TYPE_SET:
- theCurrentObj = [self stringWithCString:theData];
- break;
- case FIELD_TYPE_ENUM:
- theCurrentObj = [self stringWithCString:theData];
- break;
- case FIELD_TYPE_NULL:
- theCurrentObj = [NSNull null];
- break;
- case FIELD_TYPE_NEWDATE:
-// Don't know what the format for this type is...
- theCurrentObj = [self stringWithCString:theData];
- break;
- default:
- NSLog (@"in fetchRowAsDictionary : Unknown type : %d for column %d, send back a NSData object", (int)theField[i].type, (int)i);
- theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]];
- break;
- }
- free(theData);
-// Some of the creators return nil object...
- if (theCurrentObj == nil) {
- theCurrentObj = [NSNull null];
- }
- }
- switch (aType) {
- case MCPTypeArray :
- [theReturn addObject:theCurrentObj];
- break;
- case MCPTypeDictionary :
- [theReturn setObject:theCurrentObj forKey:[mNames objectAtIndex:i]];
- break;
- default :
- [theReturn addObject:theCurrentObj];
- break;
- }
- }
+ switch (theField[i].type) {
+ case FIELD_TYPE_TINY:
+ case FIELD_TYPE_SHORT:
+ case FIELD_TYPE_INT24:
+ case FIELD_TYPE_LONG:
+ case FIELD_TYPE_LONGLONG:
+ case FIELD_TYPE_DECIMAL:
+ case FIELD_TYPE_FLOAT:
+ case FIELD_TYPE_DOUBLE:
+ case FIELD_TYPE_NEW_DECIMAL:
+ case FIELD_TYPE_TIMESTAMP:
+ case FIELD_TYPE_DATE:
+ case FIELD_TYPE_TIME:
+ case FIELD_TYPE_DATETIME:
+ case FIELD_TYPE_YEAR:
+ case FIELD_TYPE_VAR_STRING:
+ case FIELD_TYPE_STRING:
+ case FIELD_TYPE_SET:
+ case FIELD_TYPE_ENUM:
+ case FIELD_TYPE_NEWDATE: // Don't know what the format for this type is...
+ theCurrentObj = [self stringWithCString:theData];
+ break;
+ case FIELD_TYPE_TINY_BLOB:
+ case FIELD_TYPE_BLOB:
+ case FIELD_TYPE_MEDIUM_BLOB:
+ case FIELD_TYPE_LONG_BLOB:
+ theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]];
+ if (!(theField[i].flags & BINARY_FLAG)) { // It is TEXT and NOT BLOB...
+ theCurrentObj = [self stringWithText:theCurrentObj];
+ } //#warning Should check for TEXT (using theField[i].flag BINARY_FLAG)
+ break;
- return theReturn;
+ case FIELD_TYPE_NULL:
+ theCurrentObj = [NSNull null];
+ break;
+
+ default:
+ NSLog (@"in fetchRowAsType : Unknown type : %d for column %d, send back a NSData object", (int)theField[i].type, (int)i);
+ theCurrentObj = [NSData dataWithBytes:theData length:theLengths[i]];
+ break;
+ }
+
+ free(theData);
+ // Some of the creators return nil object...
+ if (theCurrentObj == nil) {
+ theCurrentObj = [NSNull null];
+ }
+ }
+
+ switch (aType) {
+ case MCPTypeDictionary :
+ [theReturn setObject:theCurrentObj forKey:[mNames objectAtIndex:i]];
+ break;
+ case MCPTypeArray :
+ default :
+ [theReturn addObject:theCurrentObj];
+ break;
+ }
+ }
+
+ return theReturn;
}
@end
diff --git a/CustomQuery.h b/CustomQuery.h
index 0a3aca94..e873d833 100644
--- a/CustomQuery.h
+++ b/CustomQuery.h
@@ -31,24 +31,24 @@
@interface CustomQuery : NSObject {
- IBOutlet id tableDumpInstance;
-
- IBOutlet id tableWindow;
- IBOutlet id queryFavoritesButton;
- IBOutlet id queryHistoryButton;
- IBOutlet id textView;
- IBOutlet CMCopyTable *customQueryView;
- IBOutlet id errorText;
- IBOutlet id affectedRowsText;
- IBOutlet id valueSheet;
- IBOutlet id valueTextField;
- IBOutlet id queryFavoritesSheet;
- IBOutlet id queryFavoritesView;
-
- CMMCPConnection *mySQLConnection;
- NSArray *queryResult;
- NSUserDefaults *prefs;
- NSMutableArray *queryFavorites;
+ IBOutlet id tableDumpInstance;
+
+ IBOutlet id tableWindow;
+ IBOutlet id queryFavoritesButton;
+ IBOutlet id queryHistoryButton;
+ IBOutlet id textView;
+ IBOutlet CMCopyTable *customQueryView;
+ IBOutlet id errorText;
+ IBOutlet id affectedRowsText;
+ IBOutlet id valueSheet;
+ IBOutlet id valueTextField;
+ IBOutlet id queryFavoritesSheet;
+ IBOutlet id queryFavoritesView;
+
+ CMMCPConnection *mySQLConnection;
+ NSArray *queryResult;
+ NSUserDefaults *prefs;
+ NSMutableArray *queryFavorites;
}
//IBAction methods
@@ -74,17 +74,17 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
//tableView drag&drop datasource methods
- (BOOL)tableView:(NSTableView *)aTableView writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard;
- (NSDragOperation)tableView:(NSTableView*)aTableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation;
+ proposedDropOperation:(NSTableViewDropOperation)operation;
- (BOOL)tableView:(NSTableView*)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation;
//tableView delegate methods
diff --git a/CustomQuery.m b/CustomQuery.m
index 70b305d6..19ae26e0 100644
--- a/CustomQuery.m
+++ b/CustomQuery.m
@@ -35,104 +35,104 @@
performs the mysql-query given by the user
sets the tableView columns corresponding to the mysql-result
*/
-{
- NSArray *theColumns;
- NSTableColumn *theCol;
- CMMCPResult *theResult = nil;
- NSArray *queries;
-// NSArray *theTypes;
- NSMutableArray *menuItems = [NSMutableArray array];
- NSMutableArray *tempResult = [NSMutableArray array];
- NSMutableString *errors = [NSMutableString string];
- int i;
-
- //query started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
-
- //split queries by ;'s
- queries = [tableDumpInstance splitQueries:[textView string]];
+{
+ NSArray *theColumns;
+ NSTableColumn *theCol;
+ CMMCPResult *theResult = nil;
+ NSArray *queries;
+// NSArray *theTypes;
+ NSMutableArray *menuItems = [NSMutableArray array];
+ NSMutableArray *tempResult = [NSMutableArray array];
+ NSMutableString *errors = [NSMutableString string];
+ int i;
+
+ //query started
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+
+ //split queries by ;'s
+ queries = [tableDumpInstance splitQueries:[textView string]];
//perform queries
- for ( i = 0 ; i < [queries count] ; i++ ) {
- theResult = [mySQLConnection queryString:[queries objectAtIndex:i]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- //query gave error
- if ( [queries count] > 1 ) {
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"),
- i+1,
- [mySQLConnection getLastErrorMessage]]];
- } else {
- [errors setString:[mySQLConnection getLastErrorMessage]];
- }
- }
-// theTypes = [queryResult fetchTypesAsArray];
- }
-
- //perform empty query if no query is given
- if ( [queries count] == 0 ) {
- theResult = [mySQLConnection queryString:@""];
- [errors setString:[mySQLConnection getLastErrorMessage]];
- }
-
+ for ( i = 0 ; i < [queries count] ; i++ ) {
+ theResult = [mySQLConnection queryString:[queries objectAtIndex:i]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ //query gave error
+ if ( [queries count] > 1 ) {
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"),
+ i+1,
+ [mySQLConnection getLastErrorMessage]]];
+ } else {
+ [errors setString:[mySQLConnection getLastErrorMessage]];
+ }
+ }
+// theTypes = [queryResult fetchTypesAsArray];
+ }
+
+ //perform empty query if no query is given
+ if ( [queries count] == 0 ) {
+ theResult = [mySQLConnection queryString:@""];
+ [errors setString:[mySQLConnection getLastErrorMessage]];
+ }
+
//put result in array
- [queryResult release];
- queryResult = nil;
- if ( nil != theResult )
- {
- int r = [theResult numOfRows];
- for ( i = 0 ; i < r ; i++ ) {
- [theResult dataSeek:i];
- [tempResult addObject:[theResult fetchRowAsArray]];
- }
- queryResult = [[NSArray arrayWithArray:tempResult] retain];
- }
+ [queryResult release];
+ queryResult = nil;
+ if ( nil != theResult )
+ {
+ int r = [theResult numOfRows];
+ for ( i = 0 ; i < r ; i++ ) {
+ [theResult dataSeek:i];
+ [tempResult addObject:[theResult fetchRowAsArray]];
+ }
+ queryResult = [[NSArray arrayWithArray:tempResult] retain];
+ }
//add query to history
- [queryHistoryButton insertItemWithTitle:[textView string] atIndex:1];
- while ( [queryHistoryButton numberOfItems] > 21 ) {
- [queryHistoryButton removeItemAtIndex:[queryHistoryButton numberOfItems]-1];
- }
- for ( i = 1 ; i < [queryHistoryButton numberOfItems] ; i++ )
- {
- [menuItems addObject:[queryHistoryButton itemTitleAtIndex:i]];
- }
- [prefs setObject:menuItems forKey:@"queryHistory"];
+ [queryHistoryButton insertItemWithTitle:[textView string] atIndex:1];
+ while ( [queryHistoryButton numberOfItems] > 21 ) {
+ [queryHistoryButton removeItemAtIndex:[queryHistoryButton numberOfItems]-1];
+ }
+ for ( i = 1 ; i < [queryHistoryButton numberOfItems] ; i++ )
+ {
+ [menuItems addObject:[queryHistoryButton itemTitleAtIndex:i]];
+ }
+ [prefs setObject:menuItems forKey:@"queryHistory"];
//select the text of the query textView and set standard font
- [textView selectAll:self];
- if ( [errors length] ) {
- [errorText setStringValue:errors];
- } else {
- [errorText setStringValue:NSLocalizedString(@"There were no errors.", @"text shown when query was successfull")];
- }
- if ( [mySQLConnection affectedRows] != -1 ) {
- [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%@ row(s) affected", @"text showing how many rows have been affected"),
- [[NSNumber numberWithLongLong:[mySQLConnection affectedRows]] stringValue]]];
- } else {
- [affectedRowsText setStringValue:@""];
- }
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [textView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [textView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
-
- if ( !theResult || ![theResult numOfRows] ) {
+ [textView selectAll:self];
+ if ( [errors length] ) {
+ [errorText setStringValue:errors];
+ } else {
+ [errorText setStringValue:NSLocalizedString(@"There were no errors.", @"text shown when query was successfull")];
+ }
+ if ( [mySQLConnection affectedRows] != -1 ) {
+ [affectedRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%@ row(s) affected", @"text showing how many rows have been affected"),
+ [[NSNumber numberWithLongLong:[mySQLConnection affectedRows]] stringValue]]];
+ } else {
+ [affectedRowsText setStringValue:@""];
+ }
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [textView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ } else {
+ [textView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+
+ if ( !theResult || ![theResult numOfRows] ) {
//no rows in result
- //free tableView
- theColumns = [customQueryView tableColumns];
- while ([theColumns count]) {
- [customQueryView removeTableColumn:[theColumns objectAtIndex:0]];
- }
-// theCol = [[NSTableColumn alloc] initWithIdentifier:@""];
-// [[theCol headerCell] setStringValue:@""];
-// [customQueryView addTableColumn:theCol];
-// [customQueryView sizeLastColumnToFit];
- [customQueryView reloadData];
+ //free tableView
+ theColumns = [customQueryView tableColumns];
+ while ([theColumns count]) {
+ [customQueryView removeTableColumn:[theColumns objectAtIndex:0]];
+ }
+// theCol = [[NSTableColumn alloc] initWithIdentifier:@""];
+// [[theCol headerCell] setStringValue:@""];
+// [customQueryView addTableColumn:theCol];
+// [customQueryView sizeLastColumnToFit];
+ [customQueryView reloadData];
// [theCol release];
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
// Query Finished Growl Notification
[GrowlApplicationBridge notifyWithTitle:@"Query Finished"
@@ -144,24 +144,24 @@ sets the tableView columns corresponding to the mysql-result
clickContext:nil
];
- return;
- }
+ return;
+ }
//set columns
//remove all columns
- theColumns = [customQueryView tableColumns];
-// i=0;
- while ([theColumns count]) {
- [customQueryView removeTableColumn:[theColumns objectAtIndex:0]];
-// i++;
- }
+ theColumns = [customQueryView tableColumns];
+// i=0;
+ while ([theColumns count]) {
+ [customQueryView removeTableColumn:[theColumns objectAtIndex:0]];
+// i++;
+ }
//add columns, corresponding to the query result
- theColumns = [theResult fetchFieldNames];
- for ( i = 0 ; i < [theResult numOfFields] ; i++) {
- theCol = [[NSTableColumn alloc] initWithIdentifier:[NSNumber numberWithInt:i]];
-// theCol = [[NSTableColumn alloc] initWithIdentifier:[theColumns objectAtIndex:i]];
-// [theCol setEditable:NO];
+ theColumns = [theResult fetchFieldNames];
+ for ( i = 0 ; i < [theResult numOfFields] ; i++) {
+ theCol = [[NSTableColumn alloc] initWithIdentifier:[NSNumber numberWithInt:i]];
+// theCol = [[NSTableColumn alloc] initWithIdentifier:[theColumns objectAtIndex:i]];
+// [theCol setEditable:NO];
if ( [theCol respondsToSelector:@selector(setResizingMask:)] ) {
// os 10.4
[theCol setResizingMask:NSTableColumnUserResizingMask];
@@ -169,50 +169,50 @@ sets the tableView columns corresponding to the mysql-result
// os pre-10.4
[theCol setResizable:YES];
}
- NSTextFieldCell *dataCell = [[[NSTextFieldCell alloc] initTextCell:@""] autorelease];
- [dataCell setEditable:NO];
- // [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
- } else {
- [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ NSTextFieldCell *dataCell = [[[NSTextFieldCell alloc] initTextCell:@""] autorelease];
+ [dataCell setEditable:NO];
+ // [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
+ } else {
+ [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
if ( [dataCell respondsToSelector:@selector(setLineBreakMode:)] ) {
// os 10.4
[dataCell setLineBreakMode:NSLineBreakByTruncatingTail];
}
- [theCol setDataCell:dataCell];
+ [theCol setDataCell:dataCell];
/*
- if ([[theTypes objectAtIndex:i] isEqualToString:@"timestamp"]) {
- [[theCol dataCell] setFormatter:[[NSDateFormatter alloc]
- initWithDateFormat:@"%d/%m/%Y at %H:%M:%S" allowNaturalLanguage:YES]];
- }
- if ([[theTypes objectAtIndex:i] isEqualToString:@"datetime"]) {
- [[theCol dataCell] setFormatter:[[NSDateFormatter alloc] initWithDateFormat:@"%d/%m/%Y at %H:%M:%S" allowNaturalLanguage:YES]];
- }
+ if ([[theTypes objectAtIndex:i] isEqualToString:@"timestamp"]) {
+ [[theCol dataCell] setFormatter:[[NSDateFormatter alloc]
+ initWithDateFormat:@"%d/%m/%Y at %H:%M:%S" allowNaturalLanguage:YES]];
+ }
+ if ([[theTypes objectAtIndex:i] isEqualToString:@"datetime"]) {
+ [[theCol dataCell] setFormatter:[[NSDateFormatter alloc] initWithDateFormat:@"%d/%m/%Y at %H:%M:%S" allowNaturalLanguage:YES]];
+ }
*/
- [[theCol headerCell] setStringValue:[theColumns objectAtIndex:i]];
+ [[theCol headerCell] setStringValue:[theColumns objectAtIndex:i]];
- [customQueryView addTableColumn:theCol];
+ [customQueryView addTableColumn:theCol];
[theCol release];
- }
-
- [customQueryView sizeLastColumnToFit];
- //tries to fix problem with last row (otherwise to small)
- //sets last column to width of the first if smaller than 30
- //problem not fixed for resizing window
+ }
+
+ [customQueryView sizeLastColumnToFit];
+ //tries to fix problem with last row (otherwise to small)
+ //sets last column to width of the first if smaller than 30
+ //problem not fixed for resizing window
/*
- if ( [[customQueryView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]] width] < 30 )
- [[customQueryView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]]
- setWidth:[[customQueryView tableColumnWithIdentifier:[theColumns objectAtIndex:0]] width]];
+ if ( [[customQueryView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]] width] < 30 )
+ [[customQueryView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]]
+ setWidth:[[customQueryView tableColumnWithIdentifier:[theColumns objectAtIndex:0]] width]];
*/
- if ( [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:[theColumns count]-1]] width] < 30 )
- [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:[theColumns count]-1]]
- setWidth:[[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:0]] width]];
- [customQueryView reloadData];
-
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ if ( [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:[theColumns count]-1]] width] < 30 )
+ [[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:[theColumns count]-1]]
+ setWidth:[[customQueryView tableColumnWithIdentifier:[NSNumber numberWithInt:0]] width]];
+ [customQueryView reloadData];
+
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
// Query Finished Growl Notification
[GrowlApplicationBridge notifyWithTitle:@"Query Finished"
@@ -230,39 +230,39 @@ sets the tableView columns corresponding to the mysql-result
insert the choosen favorite query in the query textView or save query to favorites or opens window to edit favorites
*/
{
- if ( [queryFavoritesButton indexOfSelectedItem] == 1) {
+ if ( [queryFavoritesButton indexOfSelectedItem] == 1) {
//save query to favorites
- //check if favorite doesn't exist
- NSEnumerator *enumerator = [queryFavorites objectEnumerator];
- id favorite;
- while ( (favorite = [enumerator nextObject]) ) {
- if ( [favorite isEqualToString:[textView string]] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"Query already exists in favorites.", @"message of panel when trying to save query which already exists in favorites"));
- return;
- }
- }
- if ( [[textView string] isEqualToString:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"Query can't be empty.", @"message of panel when trying to save empty query"));
- return;
- }
- [queryFavorites addObject:[NSString stringWithString:[textView string]]];
- [prefs setObject:queryFavorites forKey:@"queryFavorites"];
- [self setFavorites];
- } else if ( [queryFavoritesButton indexOfSelectedItem] == 2) {
+ //check if favorite doesn't exist
+ NSEnumerator *enumerator = [queryFavorites objectEnumerator];
+ id favorite;
+ while ( (favorite = [enumerator nextObject]) ) {
+ if ( [favorite isEqualToString:[textView string]] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"Query already exists in favorites.", @"message of panel when trying to save query which already exists in favorites"));
+ return;
+ }
+ }
+ if ( [[textView string] isEqualToString:@""] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"Query can't be empty.", @"message of panel when trying to save empty query"));
+ return;
+ }
+ [queryFavorites addObject:[NSString stringWithString:[textView string]]];
+ [prefs setObject:queryFavorites forKey:@"queryFavorites"];
+ [self setFavorites];
+ } else if ( [queryFavoritesButton indexOfSelectedItem] == 2) {
//edit favorites
- [NSApp beginSheet:queryFavoritesSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:queryFavoritesSheet];
-
- [NSApp endSheet:queryFavoritesSheet];
- [queryFavoritesSheet orderOut:nil];
- } else if ( [queryFavoritesButton indexOfSelectedItem] != 3) {
+ [NSApp beginSheet:queryFavoritesSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:queryFavoritesSheet];
+
+ [NSApp endSheet:queryFavoritesSheet];
+ [queryFavoritesSheet orderOut:nil];
+ } else if ( [queryFavoritesButton indexOfSelectedItem] != 3) {
//choose favorite
- [textView replaceCharactersInRange:[textView selectedRange] withString:[queryFavoritesButton titleOfSelectedItem]];
- }
+ [textView replaceCharactersInRange:[textView selectedRange] withString:[queryFavoritesButton titleOfSelectedItem]];
+ }
}
- (IBAction)chooseQueryHistory:(id)sender
@@ -270,8 +270,8 @@ insert the choosen favorite query in the query textView or save query to favorit
insert the choosen history query in the query textView
*/
{
- [textView setString:[queryHistoryButton titleOfSelectedItem]];
- [textView selectAll:self];
+ [textView setString:[queryHistoryButton titleOfSelectedItem]];
+ [textView selectAll:self];
}
- (IBAction)closeSheet:(id)sender
@@ -279,7 +279,7 @@ insert the choosen history query in the query textView
closes the sheet
*/
{
- [NSApp stopModal];
+ [NSApp stopModal];
}
@@ -289,22 +289,22 @@ closes the sheet
adds a query favorite
*/
{
- int row = [queryFavoritesView editedRow];
- int column = [queryFavoritesView editedColumn];
- NSTableColumn *tableColumn;
- NSCell *cell;
+ int row = [queryFavoritesView editedRow];
+ int column = [queryFavoritesView editedColumn];
+ NSTableColumn *tableColumn;
+ NSCell *cell;
//end editing
- if ( row != -1 ) {
- tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
- cell = [tableColumn dataCellForRow:row];
+ if ( row != -1 ) {
+ tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
+ cell = [tableColumn dataCellForRow:row];
[cell endEditing:[queryFavoritesView currentEditor]];
- }
+ }
- [queryFavorites addObject:[NSString string]];
- [queryFavoritesView reloadData];
- [queryFavoritesView selectRow:[queryFavoritesView numberOfRows]-1 byExtendingSelection:NO];
- [queryFavoritesView editColumn:0 row:[queryFavoritesView numberOfRows]-1 withEvent:nil select:YES];
+ [queryFavorites addObject:[NSString string]];
+ [queryFavoritesView reloadData];
+ [queryFavoritesView selectRow:[queryFavoritesView numberOfRows]-1 byExtendingSelection:NO];
+ [queryFavoritesView editColumn:0 row:[queryFavoritesView numberOfRows]-1 withEvent:nil select:YES];
}
- (IBAction)removeQueryFavorite:(id)sender
@@ -312,22 +312,22 @@ adds a query favorite
removes a query favorite
*/
{
- int row = [queryFavoritesView editedRow];
- int column = [queryFavoritesView editedColumn];
- NSTableColumn *tableColumn;
- NSCell *cell;
+ int row = [queryFavoritesView editedRow];
+ int column = [queryFavoritesView editedColumn];
+ NSTableColumn *tableColumn;
+ NSCell *cell;
//end editing
- if ( row != -1 ) {
- tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
- cell = [tableColumn dataCellForRow:row];
+ if ( row != -1 ) {
+ tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
+ cell = [tableColumn dataCellForRow:row];
[cell endEditing:[queryFavoritesView currentEditor]];
- }
+ }
- if ( [queryFavoritesView numberOfSelectedRows] > 0 ) {
- [queryFavorites removeObjectAtIndex:[queryFavoritesView selectedRow]];
- [queryFavoritesView reloadData];
- }
+ if ( [queryFavoritesView numberOfSelectedRows] > 0 ) {
+ [queryFavorites removeObjectAtIndex:[queryFavoritesView selectedRow]];
+ [queryFavoritesView reloadData];
+ }
}
- (IBAction)copyQueryFavorite:(id)sender
@@ -335,26 +335,26 @@ removes a query favorite
copies a query favorite
*/
{
- int row = [queryFavoritesView editedRow];
- int column = [queryFavoritesView editedColumn];
- NSTableColumn *tableColumn;
- NSCell *cell;
+ int row = [queryFavoritesView editedRow];
+ int column = [queryFavoritesView editedColumn];
+ NSTableColumn *tableColumn;
+ NSCell *cell;
//end editing
- if ( row != -1 ) {
- tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
- cell = [tableColumn dataCellForRow:row];
+ if ( row != -1 ) {
+ tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
+ cell = [tableColumn dataCellForRow:row];
[cell endEditing:[queryFavoritesView currentEditor]];
- }
-
- if ( [queryFavoritesView numberOfSelectedRows] > 0 ) {
- [queryFavorites insertObject:
- [NSString stringWithString:[queryFavorites objectAtIndex:[queryFavoritesView selectedRow]]]
- atIndex:[queryFavoritesView selectedRow]+1];
- [queryFavoritesView reloadData];
- [queryFavoritesView selectRow:[queryFavoritesView selectedRow]+1 byExtendingSelection:NO];
- [queryFavoritesView editColumn:0 row:[queryFavoritesView selectedRow] withEvent:nil select:YES];
- }
+ }
+
+ if ( [queryFavoritesView numberOfSelectedRows] > 0 ) {
+ [queryFavorites insertObject:
+ [NSString stringWithString:[queryFavorites objectAtIndex:[queryFavoritesView selectedRow]]]
+ atIndex:[queryFavoritesView selectedRow]+1];
+ [queryFavoritesView reloadData];
+ [queryFavoritesView selectRow:[queryFavoritesView selectedRow]+1 byExtendingSelection:NO];
+ [queryFavoritesView editColumn:0 row:[queryFavoritesView selectedRow] withEvent:nil select:YES];
+ }
}
- (IBAction)closeQueryFavoritesSheet:(id)sender
@@ -362,21 +362,21 @@ copies a query favorite
closes queryFavoritesSheet and saves favorites to preferences
*/
{
- int row = [queryFavoritesView editedRow];
- int column = [queryFavoritesView editedColumn];
- NSTableColumn *tableColumn;
- NSCell *cell;
+ int row = [queryFavoritesView editedRow];
+ int column = [queryFavoritesView editedColumn];
+ NSTableColumn *tableColumn;
+ NSCell *cell;
//end editing
- if ( row != -1 ) {
- tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
- cell = [tableColumn dataCellForRow:row];
+ if ( row != -1 ) {
+ tableColumn = [[queryFavoritesView tableColumns] objectAtIndex:column];
+ cell = [tableColumn dataCellForRow:row];
[cell endEditing:[queryFavoritesView currentEditor]];
- }
+ }
- [NSApp stopModal];
- [prefs setObject:queryFavorites forKey:@"queryFavorites"];
- [self setFavorites];
+ [NSApp stopModal];
+ [prefs setObject:queryFavorites forKey:@"queryFavorites"];
+ [self setFavorites];
}
@@ -386,29 +386,29 @@ closes queryFavoritesSheet and saves favorites to preferences
returns the current result (as shown in custom result view) as array, the first object containing the field names as array, the following objects containing the rows as array
*/
{
- NSArray *tableColumns = [customQueryView tableColumns];
- NSEnumerator *enumerator = [tableColumns objectEnumerator];
- id tableColumn;
- NSMutableArray *currentResult = [NSMutableArray array];
- NSMutableArray *tempRow = [NSMutableArray array];
- int i;
-
- //set field names as first line
- while ( (tableColumn = [enumerator nextObject]) ) {
- [tempRow addObject:[[tableColumn headerCell] stringValue]];
- }
- [currentResult addObject:[NSArray arrayWithArray:tempRow]];
-
- //add rows
- for ( i = 0 ; i < [self numberOfRowsInTableView:customQueryView] ; i++) {
- [tempRow removeAllObjects];
- enumerator = [tableColumns objectEnumerator];
- while ( (tableColumn = [enumerator nextObject]) ) {
- [tempRow addObject:[self tableView:customQueryView objectValueForTableColumn:tableColumn row:i]];
- }
- [currentResult addObject:[NSArray arrayWithArray:tempRow]];
- }
- return currentResult;
+ NSArray *tableColumns = [customQueryView tableColumns];
+ NSEnumerator *enumerator = [tableColumns objectEnumerator];
+ id tableColumn;
+ NSMutableArray *currentResult = [NSMutableArray array];
+ NSMutableArray *tempRow = [NSMutableArray array];
+ int i;
+
+ //set field names as first line
+ while ( (tableColumn = [enumerator nextObject]) ) {
+ [tempRow addObject:[[tableColumn headerCell] stringValue]];
+ }
+ [currentResult addObject:[NSArray arrayWithArray:tempRow]];
+
+ //add rows
+ for ( i = 0 ; i < [self numberOfRowsInTableView:customQueryView] ; i++) {
+ [tempRow removeAllObjects];
+ enumerator = [tableColumns objectEnumerator];
+ while ( (tableColumn = [enumerator nextObject]) ) {
+ [tempRow addObject:[self tableView:customQueryView objectValueForTableColumn:tableColumn row:i]];
+ }
+ [currentResult addObject:[NSArray arrayWithArray:tempRow]];
+ }
+ return currentResult;
}
@@ -418,42 +418,42 @@ returns the current result (as shown in custom result view) as array, the first
sets the connection (received from TableDocument) and makes things that have to be done only once
*/
{
- NSArray *tableColumns = [queryFavoritesView tableColumns];
- NSEnumerator *enumerator = [tableColumns objectEnumerator];
- id column;
+ NSArray *tableColumns = [queryFavoritesView tableColumns];
+ NSEnumerator *enumerator = [tableColumns objectEnumerator];
+ id column;
- mySQLConnection = theConnection;
+ mySQLConnection = theConnection;
- prefs = [[NSUserDefaults standardUserDefaults] retain];
- if ( [prefs objectForKey:@"queryFavorites"] ) {
- queryFavorites = [[NSMutableArray alloc] initWithArray:[prefs objectForKey:@"queryFavorites"]];
- } else {
- queryFavorites = [[NSMutableArray array] retain];
- }
+ prefs = [[NSUserDefaults standardUserDefaults] retain];
+ if ( [prefs objectForKey:@"queryFavorites"] ) {
+ queryFavorites = [[NSMutableArray alloc] initWithArray:[prefs objectForKey:@"queryFavorites"]];
+ } else {
+ queryFavorites = [[NSMutableArray array] retain];
+ }
//set up interface
[customQueryView setVerticalMotionCanBeginDrag:NO];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [textView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [textView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- [textView setContinuousSpellCheckingEnabled:NO];
- [queryFavoritesView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]];
- while ( (column = [enumerator nextObject]) )
- {
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [[column dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
- } else {
- [[column dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- }
-// [queryFavoritesView reloadData];
- if ( [prefs objectForKey:@"queryHistory"] )
- {
- [queryHistoryButton addItemsWithTitles:[prefs objectForKey:@"queryHistory"]];
- }
- [self setFavorites];
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [textView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ } else {
+ [textView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+ [textView setContinuousSpellCheckingEnabled:NO];
+ [queryFavoritesView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]];
+ while ( (column = [enumerator nextObject]) )
+ {
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [[column dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
+ } else {
+ [[column dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+ }
+// [queryFavoritesView reloadData];
+ if ( [prefs objectForKey:@"queryHistory"] )
+ {
+ [queryHistoryButton addItemsWithTitles:[prefs objectForKey:@"queryHistory"]];
+ }
+ [self setFavorites];
}
- (void)setFavorites
@@ -461,13 +461,13 @@ sets the connection (received from TableDocument) and makes things that have to
set up the favorites popUpButton
*/
{
- int i;
+ int i;
//remove all menuItems and add favorites from preferences
- for ( i = 4 ; i < [queryFavoritesButton numberOfItems] ; i++ ) {
- [queryFavoritesButton removeItemAtIndex:i];
- }
- [queryFavoritesButton addItemsWithTitles:queryFavorites];
+ for ( i = 4 ; i < [queryFavoritesButton numberOfItems] ; i++ ) {
+ [queryFavoritesButton removeItemAtIndex:i];
+ }
+ [queryFavoritesButton addItemsWithTitles:queryFavorites];
}
- (void)doPerformQueryService:(NSString *)query
@@ -475,179 +475,179 @@ set up the favorites popUpButton
inserts the query in the textView and performs query
*/
{
- [textView setString:query];
- [self performQuery:self];
+ [textView setString:query];
+ [self performQuery:self];
}
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- if ( aTableView == customQueryView ) {
- if ( nil == queryResult ) {
- return 0;
+ if ( aTableView == customQueryView ) {
+ if ( nil == queryResult ) {
+ return 0;
} else {
- return [queryResult count];
- }
- } else if ( aTableView == queryFavoritesView ) {
- return [queryFavorites count];
- } else {
- return 0;
- }
+ return [queryResult count];
+ }
+ } else if ( aTableView == queryFavoritesView ) {
+ return [queryFavorites count];
+ } else {
+ return 0;
+ }
}
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
- NSArray *theRow;
-// NSString *theIdentifier = [aTableColumn identifier];
- NSNumber *theIdentifier = [aTableColumn identifier];
-
- if ( aTableView == customQueryView ) {
- theRow = [queryResult objectAtIndex:rowIndex];
-
- if ( [[theRow objectAtIndex:[theIdentifier intValue]] isKindOfClass:[NSData class]] ) {
- NSString *tmp = [[NSString alloc] initWithData:[theRow objectAtIndex:[theIdentifier intValue]]
- encoding:[mySQLConnection encoding]];
- return [tmp autorelease];
- }
- if ( [[theRow objectAtIndex:[theIdentifier intValue]] isMemberOfClass:[NSNull class]] )
- return [prefs objectForKey:@"nullValue"];
-
- return [theRow objectAtIndex:[theIdentifier intValue]];
- } else if ( aTableView == queryFavoritesView ) {
- return [queryFavorites objectAtIndex:rowIndex];
- } else {
- return @"";
- }
+ NSArray *theRow;
+// NSString *theIdentifier = [aTableColumn identifier];
+ NSNumber *theIdentifier = [aTableColumn identifier];
+
+ if ( aTableView == customQueryView ) {
+ theRow = [queryResult objectAtIndex:rowIndex];
+
+ if ( [[theRow objectAtIndex:[theIdentifier intValue]] isKindOfClass:[NSData class]] ) {
+ NSString *tmp = [[NSString alloc] initWithData:[theRow objectAtIndex:[theIdentifier intValue]]
+ encoding:[mySQLConnection encoding]];
+ return [tmp autorelease];
+ }
+ if ( [[theRow objectAtIndex:[theIdentifier intValue]] isMemberOfClass:[NSNull class]] )
+ return [prefs objectForKey:@"nullValue"];
+
+ return [theRow objectAtIndex:[theIdentifier intValue]];
+ } else if ( aTableView == queryFavoritesView ) {
+ return [queryFavorites objectAtIndex:rowIndex];
+ } else {
+ return @"";
+ }
}
- (void)tableView:(NSTableView *)aTableView setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
+ forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
{
- if ( aTableView == queryFavoritesView ) {
- NSEnumerator *enumerator = [queryFavorites objectEnumerator];
- id favorite;
- int i = 0;
-
- if ( [anObject isEqualToString:@""] ) {
-// NSRunAlertPanel(@"Error", @"Query can't be empty.", @"OK", nil, nil);
- //remove row
-// if ( [[queryFavorites objectAtIndex:rowIndex] isEqualToString:@""] ) {
- [queryFavoritesView deselectAll:self];
- [queryFavorites removeObjectAtIndex:rowIndex];
- [queryFavoritesView reloadData];
- return;
- }
-
- while ( (favorite = [enumerator nextObject]) ) {
- if ( [favorite isEqualToString:anObject] && i != rowIndex) {
- NSRunAlertPanel(@"Error", @"Query already exists in favorites.", @"OK", nil, nil);
- //remove row if it was a (blank) new row or a copied row
- if ( [[queryFavorites objectAtIndex:rowIndex] isEqualToString:@""] ||
- [[queryFavorites objectAtIndex:rowIndex] isEqualToString:anObject] ) {
- [queryFavoritesView deselectAll:self];
- [queryFavorites removeObjectAtIndex:rowIndex];
- [queryFavoritesView reloadData];
- }
- return;
- }
- i++;
- }
- [queryFavorites replaceObjectAtIndex:rowIndex withObject:anObject];
- }
+ if ( aTableView == queryFavoritesView ) {
+ NSEnumerator *enumerator = [queryFavorites objectEnumerator];
+ id favorite;
+ int i = 0;
+
+ if ( [anObject isEqualToString:@""] ) {
+// NSRunAlertPanel(@"Error", @"Query can't be empty.", @"OK", nil, nil);
+ //remove row
+// if ( [[queryFavorites objectAtIndex:rowIndex] isEqualToString:@""] ) {
+ [queryFavoritesView deselectAll:self];
+ [queryFavorites removeObjectAtIndex:rowIndex];
+ [queryFavoritesView reloadData];
+ return;
+ }
+
+ while ( (favorite = [enumerator nextObject]) ) {
+ if ( [favorite isEqualToString:anObject] && i != rowIndex) {
+ NSRunAlertPanel(@"Error", @"Query already exists in favorites.", @"OK", nil, nil);
+ //remove row if it was a (blank) new row or a copied row
+ if ( [[queryFavorites objectAtIndex:rowIndex] isEqualToString:@""] ||
+ [[queryFavorites objectAtIndex:rowIndex] isEqualToString:anObject] ) {
+ [queryFavoritesView deselectAll:self];
+ [queryFavorites removeObjectAtIndex:rowIndex];
+ [queryFavoritesView reloadData];
+ }
+ return;
+ }
+ i++;
+ }
+ [queryFavorites replaceObjectAtIndex:rowIndex withObject:anObject];
+ }
}
//tableView drag&drop datasource methods
- (BOOL)tableView:(NSTableView *)aTableView writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard
{
- int originalRow;
- NSArray *pboardTypes;
-
- if ( aTableView == queryFavoritesView )
- {
- if ( [rows count] == 1 )
- {
- pboardTypes = [NSArray arrayWithObjects:@"SequelProPasteboard", nil];
- originalRow = [[rows objectAtIndex:0] intValue];
-
- [pboard declareTypes:pboardTypes owner:nil];
- [pboard setString:[[NSNumber numberWithInt:originalRow] stringValue] forType:@"SequelProPasteboard"];
-
- return YES;
- }
- else
- {
- return NO;
- }
- } else if ( aTableView == customQueryView ) {
- NSString *tmp = [customQueryView draggedRowsAsTabString:rows];
- if ( nil != tmp )
- {
+ int originalRow;
+ NSArray *pboardTypes;
+
+ if ( aTableView == queryFavoritesView )
+ {
+ if ( [rows count] == 1 )
+ {
+ pboardTypes = [NSArray arrayWithObjects:@"SequelProPasteboard", nil];
+ originalRow = [[rows objectAtIndex:0] intValue];
+
+ [pboard declareTypes:pboardTypes owner:nil];
+ [pboard setString:[[NSNumber numberWithInt:originalRow] stringValue] forType:@"SequelProPasteboard"];
+
+ return YES;
+ }
+ else
+ {
+ return NO;
+ }
+ } else if ( aTableView == customQueryView ) {
+ NSString *tmp = [customQueryView draggedRowsAsTabString:rows];
+ if ( nil != tmp )
+ {
[pboard declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType,
- NSStringPboardType, nil]
- owner:nil];
- [pboard setString:tmp forType:NSStringPboardType];
- [pboard setString:tmp forType:NSTabularTextPboardType];
- return YES;
- }
- return NO;
- } else {
- return NO;
- }
+ NSStringPboardType, nil]
+ owner:nil];
+ [pboard setString:tmp forType:NSStringPboardType];
+ [pboard setString:tmp forType:NSTabularTextPboardType];
+ return YES;
+ }
+ return NO;
+ } else {
+ return NO;
+ }
}
- (NSDragOperation)tableView:(NSTableView*)aTableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation
+ proposedDropOperation:(NSTableViewDropOperation)operation
{
- NSArray *pboardTypes = [[info draggingPasteboard] types];
- int originalRow;
-
- if ( aTableView == queryFavoritesView ) {
- if ([pboardTypes count] == 1 && row != -1)
- {
- if ([[pboardTypes objectAtIndex:0] isEqualToString:@"SequelProPasteboard"]==YES && operation==NSTableViewDropAbove)
- {
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
-
- if (row != originalRow && row != (originalRow+1))
- {
- return NSDragOperationMove;
- }
- }
- }
- return NSDragOperationNone;
- } else {
- return NSDragOperationNone;
- }
+ NSArray *pboardTypes = [[info draggingPasteboard] types];
+ int originalRow;
+
+ if ( aTableView == queryFavoritesView ) {
+ if ([pboardTypes count] == 1 && row != -1)
+ {
+ if ([[pboardTypes objectAtIndex:0] isEqualToString:@"SequelProPasteboard"]==YES && operation==NSTableViewDropAbove)
+ {
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
+
+ if (row != originalRow && row != (originalRow+1))
+ {
+ return NSDragOperationMove;
+ }
+ }
+ }
+ return NSDragOperationNone;
+ } else {
+ return NSDragOperationNone;
+ }
}
- (BOOL)tableView:(NSTableView*)aTableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
{
- int originalRow;
- int destinationRow;
- NSMutableDictionary *draggedRow;
-
- if ( aTableView == queryFavoritesView ) {
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
- destinationRow = row;
-
- if ( destinationRow > originalRow )
- destinationRow--;
-
- draggedRow = [queryFavorites objectAtIndex:originalRow];
- [queryFavorites removeObjectAtIndex:originalRow];
- [queryFavorites insertObject:draggedRow atIndex:destinationRow];
-
- [queryFavoritesView reloadData];
- [queryFavoritesView selectRow:destinationRow byExtendingSelection:NO];
-
- return YES;
- } else {
- return NO;
- }
+ int originalRow;
+ int destinationRow;
+ NSMutableDictionary *draggedRow;
+
+ if ( aTableView == queryFavoritesView ) {
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
+ destinationRow = row;
+
+ if ( destinationRow > originalRow )
+ destinationRow--;
+
+ draggedRow = [queryFavorites objectAtIndex:originalRow];
+ [queryFavorites removeObjectAtIndex:originalRow];
+ [queryFavorites insertObject:draggedRow atIndex:destinationRow];
+
+ [queryFavoritesView reloadData];
+ [queryFavoritesView selectRow:destinationRow byExtendingSelection:NO];
+
+ return YES;
+ } else {
+ return NO;
+ }
}
@@ -657,38 +657,38 @@ inserts the query in the textView and performs query
opens sheet with value when double clicking on a field
*/
{
- if ( aTableView == customQueryView ) {
- NSArray *theRow;
- NSString *theValue;
- NSNumber *theIdentifier = [aTableColumn identifier];
-
- //get the value
- theRow = [queryResult objectAtIndex:rowIndex];
-
- if ( [[theRow objectAtIndex:[theIdentifier intValue]] isKindOfClass:[NSData class]] ) {
- theValue = [[NSString alloc] initWithData:[theRow objectAtIndex:[theIdentifier intValue]]
- encoding:[mySQLConnection encoding]];
+ if ( aTableView == customQueryView ) {
+ NSArray *theRow;
+ NSString *theValue;
+ NSNumber *theIdentifier = [aTableColumn identifier];
+
+ //get the value
+ theRow = [queryResult objectAtIndex:rowIndex];
+
+ if ( [[theRow objectAtIndex:[theIdentifier intValue]] isKindOfClass:[NSData class]] ) {
+ theValue = [[NSString alloc] initWithData:[theRow objectAtIndex:[theIdentifier intValue]]
+ encoding:[mySQLConnection encoding]];
[theValue autorelease];
- } else if ( [[theRow objectAtIndex:[theIdentifier intValue]] isMemberOfClass:[NSNull class]] ) {
- theValue = [prefs objectForKey:@"nullValue"];
- } else {
- theValue = [theRow objectAtIndex:[theIdentifier intValue]];
- }
-
- [valueTextField setString:[theValue description]];
- [valueTextField selectAll:self];
- [NSApp beginSheet:valueSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:valueSheet];
-
- [NSApp endSheet:valueSheet];
- [valueSheet orderOut:nil];
-
- return NO;
- } else {
- return YES;
- }
+ } else if ( [[theRow objectAtIndex:[theIdentifier intValue]] isMemberOfClass:[NSNull class]] ) {
+ theValue = [prefs objectForKey:@"nullValue"];
+ } else {
+ theValue = [theRow objectAtIndex:[theIdentifier intValue]];
+ }
+
+ [valueTextField setString:[theValue description]];
+ [valueTextField selectAll:self];
+ [NSApp beginSheet:valueSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:valueSheet];
+
+ [NSApp endSheet:valueSheet];
+ [valueSheet orderOut:nil];
+
+ return NO;
+ } else {
+ return YES;
+ }
}
@@ -698,7 +698,7 @@ opens sheet with value when double clicking on a field
tells the splitView that it can collapse views
*/
{
- return YES;
+ return YES;
}
- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
@@ -706,11 +706,11 @@ tells the splitView that it can collapse views
defines max position of splitView
*/
{
- if ( offset == 0 ) {
- return proposedMax - 100;
- } else {
- return proposedMax - 73;
- }
+ if ( offset == 0 ) {
+ return proposedMax - 100;
+ } else {
+ return proposedMax - 73;
+ }
}
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
@@ -718,11 +718,11 @@ defines max position of splitView
defines min position of splitView
*/
{
- if ( offset == 0 ) {
- return proposedMin + 100;
- } else {
- return proposedMin + 100;
- }
+ if ( offset == 0 ) {
+ return proposedMin + 100;
+ } else {
+ return proposedMin + 100;
+ }
}
@@ -730,47 +730,47 @@ defines min position of splitView
- (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector
/*
traps enter key and
- performs query instead of inserting a line break if aTextView == textView
- closes valueSheet if aTextView == valueTextField
+ performs query instead of inserting a line break if aTextView == textView
+ closes valueSheet if aTextView == valueTextField
*/
{
- if ( aTextView == textView ) {
- if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] &&
- [[[NSApp currentEvent] characters] isEqualToString:@"\003"] )
- {
- [self performQuery:self];
- return YES;
- } else {
- return NO;
- }
- } else if ( aTextView == valueTextField ) {
- if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] )
- {
- [self closeSheet:self];
- return YES;
- } else {
- return NO;
- }
- }
- return NO;
+ if ( aTextView == textView ) {
+ if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] &&
+ [[[NSApp currentEvent] characters] isEqualToString:@"\003"] )
+ {
+ [self performQuery:self];
+ return YES;
+ } else {
+ return NO;
+ }
+ } else if ( aTextView == valueTextField ) {
+ if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] )
+ {
+ [self closeSheet:self];
+ return YES;
+ } else {
+ return NO;
+ }
+ }
+ return NO;
}
//last but not least
- (id)init;
{
- self = [super init];
- return self;
+ self = [super init];
+ return self;
}
- (void)dealloc
{
- [queryResult release];
- [prefs release];
- [queryFavorites release];
-
- [super dealloc];
+ [queryResult release];
+ [prefs release];
+ [queryFavorites release];
+
+ [super dealloc];
}
-
+
@end
diff --git a/English.lproj/Credits.rtf b/English.lproj/Credits.rtf
index 02985441..76fa23c7 100644
--- a/English.lproj/Credits.rtf
+++ b/English.lproj/Credits.rtf
@@ -1,7 +1,6 @@
-{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf330
+{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
-\vieww22120\viewh18020\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural
\f0\b\fs24 \cf0 Current Developers
diff --git a/English.lproj/DBView.xib b/English.lproj/DBView.xib
index 161501a0..56a57be0 100644
--- a/English.lproj/DBView.xib
+++ b/English.lproj/DBView.xib
@@ -16778,9 +16778,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
<reference ref="9"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{99, 63}, {519, 335}}</string>
+ <string>{{747, 260}, {519, 335}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{99, 63}, {519, 335}}</string>
+ <string>{{747, 260}, {519, 335}}</string>
<reference ref="9"/>
<string>{{136, 447}, {519, 335}}</string>
<reference ref="8"/>
@@ -16959,9 +16959,9 @@ IGRvIHlvdSB3YW50IHRvIGFkZCBmb3IgdGhpcyBmaWVsZD8</string>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<reference ref="9"/>
- <string>{{240, 291}, {845, 504}}</string>
+ <string>{{102, 631}, {845, 504}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>{{240, 291}, {845, 504}}</string>
+ <string>{{102, 631}, {845, 504}}</string>
<reference ref="9"/>
<reference ref="9"/>
<string>{{62, 352}, {845, 504}}</string>
diff --git a/ImageAndTextCell.h b/ImageAndTextCell.h
index 897549cd..bf0ef753 100755
--- a/ImageAndTextCell.h
+++ b/ImageAndTextCell.h
@@ -44,7 +44,7 @@
@interface ImageAndTextCell : NSTextFieldCell
{
@private
- NSImage *image;
+ NSImage *image;
int _indentationLevel;
}
diff --git a/ImageAndTextCell.m b/ImageAndTextCell.m
index 96c0ff9d..a8165f85 100755
--- a/ImageAndTextCell.m
+++ b/ImageAndTextCell.m
@@ -10,45 +10,45 @@
@implementation ImageAndTextCell
- (void)dealloc {
- [image release];
- image = nil;
- [super dealloc];
+ [image release];
+ image = nil;
+ [super dealloc];
}
- copyWithZone:(NSZone *)zone
{
- ImageAndTextCell *cell = (ImageAndTextCell *)[super copyWithZone:zone];
- cell->image = [image retain];
- return cell;
+ ImageAndTextCell *cell = (ImageAndTextCell *)[super copyWithZone:zone];
+ cell->image = [image retain];
+ return cell;
}
- (void)setImage:(NSImage *)anImage
{
- if (anImage != image)
+ if (anImage != image)
{
- [image release];
- image = [anImage retain];
- }
+ [image release];
+ image = [anImage retain];
+ }
}
- (NSImage *)image
{
- return image;
+ return image;
}
- (NSRect)imageFrameForCellFrame:(NSRect)cellFrame
{
- if (image != nil)
+ if (image != nil)
{
- NSRect imageFrame;
- imageFrame.size = [image size];
- imageFrame.origin = cellFrame.origin;
- imageFrame.origin.x += ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
- imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
- return imageFrame;
- }
- else
- return NSZeroRect;
+ NSRect imageFrame;
+ imageFrame.size = [image size];
+ imageFrame.origin = cellFrame.origin;
+ imageFrame.origin.x += ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
+ imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
+ return imageFrame;
+ }
+ else
+ return NSZeroRect;
}
- (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent
@@ -63,7 +63,7 @@
NSDivideRect (aRect, &imageFrame, &aRect, 3 + [image size].width, NSMinXEdge);
}
- [super editWithFrame:aRect inView: controlView editor:textObj delegate:anObject event:theEvent];
+ [super editWithFrame:aRect inView: controlView editor:textObj delegate:anObject event:theEvent];
}
- (void)selectWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject start:(int)selStart length:(int)selLength
@@ -78,7 +78,7 @@
NSDivideRect (aRect, &imageFrame, &aRect, 3 + [image size].width, NSMinXEdge);
}
- [super selectWithFrame:aRect inView: controlView editor:textObj delegate:anObject start:selStart length:selLength];
+ [super selectWithFrame:aRect inView: controlView editor:textObj delegate:anObject start:selStart length:selLength];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
@@ -89,36 +89,36 @@
NSDivideRect(cellFrame, &indentationFrame, &cellFrame, (INDENT_AMOUNT * _indentationLevel), NSMinXEdge);
}
- if (image != nil)
+ if (image != nil)
{
- NSSize imageSize;
- NSRect imageFrame;
+ NSSize imageSize;
+ NSRect imageFrame;
- imageSize = [image size];
- NSDivideRect(cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width, NSMinXEdge);
- if ([self drawsBackground])
+ imageSize = [image size];
+ NSDivideRect(cellFrame, &imageFrame, &cellFrame, 3 + imageSize.width, NSMinXEdge);
+ if ([self drawsBackground])
{
- [[self backgroundColor] set];
- NSRectFill(imageFrame);
- }
- imageFrame.origin.x += 3;
- imageFrame.size = imageSize;
-
- if ([controlView isFlipped])
- imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2);
- else
- imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
-
- [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
- }
- [super drawWithFrame:cellFrame inView:controlView];
+ [[self backgroundColor] set];
+ NSRectFill(imageFrame);
+ }
+ imageFrame.origin.x += 3;
+ imageFrame.size = imageSize;
+
+ if ([controlView isFlipped])
+ imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2);
+ else
+ imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
+
+ [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
+ }
+ [super drawWithFrame:cellFrame inView:controlView];
}
- (NSSize)cellSize
{
- NSSize cellSize = [super cellSize];
- cellSize.width += (image ? [image size].width : 0) + ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
- return cellSize;
+ NSSize cellSize = [super cellSize];
+ cellSize.width += (image ? [image size].width : 0) + ((1 - MIN(1,INDENT_AMOUNT)) * 3) + (INDENT_AMOUNT * _indentationLevel);
+ return cellSize;
}
- (void)setIndentationLevel:(int)level
diff --git a/Info.plist b/Info.plist
index dd185810..a5d6592c 100644
--- a/Info.plist
+++ b/Info.plist
@@ -12,7 +12,7 @@
<string>????</string>
</array>
<key>CFBundleTypeIconFile</key>
- <string></string>
+ <string>appicon.icns</string>
<key>CFBundleTypeName</key>
<string>DocumentType</string>
<key>CFBundleTypeOSTypes</key>
@@ -26,31 +26,27 @@
</dict>
</array>
<key>CFBundleExecutable</key>
- <string>Sequel Pro</string>
- <key>CFBundleHelpBookFolder</key>
- <string>english_help</string>
- <key>CFBundleHelpBookName</key>
- <string>Sequel Pro Help</string>
+ <string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>appicon.icns</string>
<key>CFBundleIdentifier</key>
<string>com.google.code.sequel-pro</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
<key>CFBundleName</key>
- <string>Sequel Pro</string>
+ <string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>154</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
+ <key>CFBundleHelpBookFolder</key>
+ <string>english_help</string>
+ <key>CFBundleHelpBookName</key>
+ <string>Sequel Pro Help</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
- <key>CFBundleShortVersionString</key>
- <string>0.9.2</string>
- <key>NSHumanReadableCopyright</key>
- <string>0.9.2 (154)</string>
- <key>NSAppleScriptEnabled</key>
- <string>YES</string>
<key>SUFeedURL</key>
<string>http://sequelpro.com/appcast/app-releases.xml</string>
<key>NSServices</key>
@@ -76,5 +72,11 @@
</array>
</dict>
</array>
+ <key>NSAppleScriptEnabled</key>
+ <string>YES</string>
+ <key>CFBundleShortVersionString</key>
+ <string>0.9.2</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>0.9.2 (154)</string>
</dict>
</plist>
diff --git a/KeyChain.h b/KeyChain.h
index f0caf0da..0179e899 100644
--- a/KeyChain.h
+++ b/KeyChain.h
@@ -23,7 +23,7 @@
// Or mail to <lorenz@textor.ch>
#import <Foundation/Foundation.h>
-#import <Carbon/Carbon.h>
+#import <Cocoa/Cocoa.h>
@interface KeyChain : NSObject {
diff --git a/KeyChain.m b/KeyChain.m
index 7e71c489..bb3f6315 100644
--- a/KeyChain.m
+++ b/KeyChain.m
@@ -23,42 +23,86 @@
// Or mail to <lorenz@textor.ch>
#import "KeyChain.h"
-
+#include <CoreFoundation/CoreFoundation.h>
+#include <Security/Security.h>
@implementation KeyChain
- (void)addPassword:(NSString *)password forName:(NSString *)name account:(NSString *)account
{
- int code;
- code = kcaddgenericpassword([name cString], [account cString],
- [password cStringLength], [password cString], NULL);
-
- if ( code != 0 )
- NSLog(@"Error while trying to add password for name: %@ account: %@", name, account);
+ OSStatus status;
+ status = SecKeychainAddGenericPassword(
+ NULL, // default keychain
+ [name cStringLength], // length of service name
+ [name cString], // service name
+ [account cStringLength], // length of account name
+ [account cString], // account name
+ [password cStringLength], // length of password
+ [password cString], // pointer to password data
+ NULL // the item reference
+ );
+
+ if ( status != noErr )
+ NSLog(@"Error (%i) while trying to add password for name: %@ account: %@", status, name, account);
}
- (NSString *)getPasswordForName:(NSString *)name account:(NSString *)account
{
- int code;
- UInt32 length;
- void *p = (void *)malloc(128 * sizeof(char));
- NSString *password = @"";
-
- code = kcfindgenericpassword([name cString], [account cString], 128, p, &length, nil);
+ OSStatus status;
+
+ void *passwordData = nil;
+ UInt32 passwordLength = nil;
+ SecKeychainItemRef itemRef = nil;
+ NSString *password = @"";
+
+ status = SecKeychainFindGenericPassword (
+ NULL, // default keychain
+ [name cStringLength], // length of service name
+ [name cString], // service name
+ [account cStringLength], // length of account name
+ [account cString], // account name
+ &passwordLength, // length of password
+ &passwordData, // pointer to password data
+ &itemRef // the item reference
+ );
+
+ if ( status == noErr ) {
+ password = [NSString stringWithCString:passwordData length:passwordLength];
+
+ //Free the data allocated by SecKeychainFindGenericPassword:
+ status = SecKeychainItemFreeContent (
+ NULL, //No attribute data to release
+ passwordData //Release data
+ );
+ }
- if (!code)
- password = [NSString stringWithCString:(const char*)p length:length];
- free(p);
-
- return password;
+ return password;
}
- (void)deletePasswordForName:(NSString *)name account:(NSString *)account
{
- KCItemRef itemref = nil ;
+ OSStatus status;
+ SecKeychainItemRef itemRef = nil;
+
+ status = SecKeychainFindGenericPassword (
+ NULL, // default keychain
+ [name cStringLength], // length of service name
+ [name cString], // service name
+ [account cStringLength], // length of account name
+ [account cString], // account name
+ nil, // length of password
+ nil, // pointer to password data
+ &itemRef // the item reference
+ );
- kcfindgenericpassword([name cString],[account cString],nil,nil,nil,&itemref);
- KCDeleteItem(itemref);
+// if ( status != noErr )
+ NSLog(@"Error (%i) while trying to find password for name: %@ account: %@", status, name, account);
+
+ status = SecKeychainItemDelete(itemRef);
+// if ( status != noErr )
+ NSLog(@"Error (%i) while trying to delete password for name: %@ account: %@", status, name, account);
+
+ CFRelease(itemRef);
}
@end
diff --git a/MainController.h b/MainController.h
index 5c02a75b..f73eb648 100644
--- a/MainController.h
+++ b/MainController.h
@@ -28,39 +28,39 @@
@interface MainController : NSObject <GrowlApplicationBridgeDelegate> {
- IBOutlet id keyChainInstance;
-
- IBOutlet id preferencesWindow;
- IBOutlet id favoriteSheet;
- IBOutlet id reloadAfterAddingSwitch;
- IBOutlet id reloadAfterEditingSwitch;
- IBOutlet id reloadAfterRemovingSwitch;
- IBOutlet id showErrorSwitch;
- IBOutlet id dontShowBlobSwitch;
- IBOutlet id useMonospacedFontsSwitch;
- IBOutlet id fetchRowCountSwitch;
- IBOutlet id limitRowsSwitch;
- IBOutlet id limitRowsField;
- IBOutlet id nullValueField;
- IBOutlet id tableView;
- IBOutlet id nameField;
- IBOutlet id hostField;
- IBOutlet id socketField;
- IBOutlet id userField;
- IBOutlet id passwordField;
- IBOutlet id portField;
- IBOutlet id databaseField;
+ IBOutlet id keyChainInstance;
+
+ IBOutlet id preferencesWindow;
+ IBOutlet id favoriteSheet;
+ IBOutlet id reloadAfterAddingSwitch;
+ IBOutlet id reloadAfterEditingSwitch;
+ IBOutlet id reloadAfterRemovingSwitch;
+ IBOutlet id showErrorSwitch;
+ IBOutlet id dontShowBlobSwitch;
+ IBOutlet id useMonospacedFontsSwitch;
+ IBOutlet id fetchRowCountSwitch;
+ IBOutlet id limitRowsSwitch;
+ IBOutlet id limitRowsField;
+ IBOutlet id nullValueField;
+ IBOutlet id tableView;
+ IBOutlet id nameField;
+ IBOutlet id hostField;
+ IBOutlet id socketField;
+ IBOutlet id userField;
+ IBOutlet id passwordField;
+ IBOutlet id portField;
+ IBOutlet id databaseField;
IBOutlet id sshCheckbox;
- IBOutlet id sshUserField;
- IBOutlet id sshPasswordField;
- IBOutlet id sshHostField;
- IBOutlet id sshPortField;
- IBOutlet id encodingPopUpButton;
-
- NSMutableArray *favorites;
- NSUserDefaults *prefs;
-
- BOOL isNewFavorite;
+ IBOutlet id sshUserField;
+ IBOutlet id sshPasswordField;
+ IBOutlet id sshHostField;
+ IBOutlet id sshPortField;
+ IBOutlet id encodingPopUpButton;
+
+ NSMutableArray *favorites;
+ NSUserDefaults *prefs;
+
+ BOOL isNewFavorite;
}
//IBAction methods
@@ -84,15 +84,15 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
//tableView drag&drop datasource methods
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard;
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation;
+ proposedDropOperation:(NSTableViewDropOperation)operation;
- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info row:(int)row
- dropOperation:(NSTableViewDropOperation)operation;
+ dropOperation:(NSTableViewDropOperation)operation;
//tableView delegate methods
- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;
diff --git a/MainController.m b/MainController.m
index 548c0434..d0f0a181 100644
--- a/MainController.m
+++ b/MainController.m
@@ -35,60 +35,60 @@ opens the preferences window
*/
{
//get favorites if they exist
- [favorites release];
- if ( [prefs objectForKey:@"favorites"] != nil ) {
- favorites = [[NSMutableArray alloc] initWithArray:[prefs objectForKey:@"favorites"]];
- } else {
- favorites = [[NSMutableArray array] retain];
- }
- [tableView reloadData];
-
- if ( [prefs boolForKey:@"reloadAfterAdding"] ) {
- [reloadAfterAddingSwitch setState:NSOnState];
- } else {
- [reloadAfterAddingSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"reloadAfterEditing"] ) {
- [reloadAfterEditingSwitch setState:NSOnState];
- } else {
- [reloadAfterEditingSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"reloadAfterRemoving"] ) {
- [reloadAfterRemovingSwitch setState:NSOnState];
- } else {
- [reloadAfterRemovingSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"showError"] ) {
- [showErrorSwitch setState:NSOnState];
- } else {
- [showErrorSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"dontShowBlob"] ) {
- [dontShowBlobSwitch setState:NSOnState];
- } else {
- [dontShowBlobSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"limitRows"] ) {
- [limitRowsSwitch setState:NSOnState];
- } else {
- [limitRowsSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [useMonospacedFontsSwitch setState:NSOnState];
- } else {
- [useMonospacedFontsSwitch setState:NSOffState];
- }
- if ( [prefs boolForKey:@"fetchRowCount"] ) {
- [fetchRowCountSwitch setState:NSOnState];
- } else {
- [fetchRowCountSwitch setState:NSOffState];
- }
- [nullValueField setStringValue:[prefs stringForKey:@"nullValue"]];
- [limitRowsField setStringValue:[prefs stringForKey:@"limitRowsValue"]];
- [self chooseLimitRows:self];
- [encodingPopUpButton selectItemWithTitle:[prefs stringForKey:@"encoding"]];
-
- [preferencesWindow makeKeyAndOrderFront:self];
+ [favorites release];
+ if ( [prefs objectForKey:@"favorites"] != nil ) {
+ favorites = [[NSMutableArray alloc] initWithArray:[prefs objectForKey:@"favorites"]];
+ } else {
+ favorites = [[NSMutableArray array] retain];
+ }
+ [tableView reloadData];
+
+ if ( [prefs boolForKey:@"reloadAfterAdding"] ) {
+ [reloadAfterAddingSwitch setState:NSOnState];
+ } else {
+ [reloadAfterAddingSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"reloadAfterEditing"] ) {
+ [reloadAfterEditingSwitch setState:NSOnState];
+ } else {
+ [reloadAfterEditingSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"reloadAfterRemoving"] ) {
+ [reloadAfterRemovingSwitch setState:NSOnState];
+ } else {
+ [reloadAfterRemovingSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"showError"] ) {
+ [showErrorSwitch setState:NSOnState];
+ } else {
+ [showErrorSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"dontShowBlob"] ) {
+ [dontShowBlobSwitch setState:NSOnState];
+ } else {
+ [dontShowBlobSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ [limitRowsSwitch setState:NSOnState];
+ } else {
+ [limitRowsSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [useMonospacedFontsSwitch setState:NSOnState];
+ } else {
+ [useMonospacedFontsSwitch setState:NSOffState];
+ }
+ if ( [prefs boolForKey:@"fetchRowCount"] ) {
+ [fetchRowCountSwitch setState:NSOnState];
+ } else {
+ [fetchRowCountSwitch setState:NSOffState];
+ }
+ [nullValueField setStringValue:[prefs stringForKey:@"nullValue"]];
+ [limitRowsField setStringValue:[prefs stringForKey:@"limitRowsValue"]];
+ [self chooseLimitRows:self];
+ [encodingPopUpButton selectItemWithTitle:[prefs stringForKey:@"encoding"]];
+
+ [preferencesWindow makeKeyAndOrderFront:self];
}
- (IBAction)addFavorite:(id)sender
@@ -96,40 +96,40 @@ opens the preferences window
adds a favorite
*/
{
- int code;
+ int code;
- isNewFavorite = YES;
+ isNewFavorite = YES;
- [nameField setStringValue:@""];
- [hostField setStringValue:@""];
- [socketField setStringValue:@""];
- [userField setStringValue:@""];
- [passwordField setStringValue:@""];
- [portField setStringValue:@""];
- [databaseField setStringValue:@""];
+ [nameField setStringValue:@""];
+ [hostField setStringValue:@""];
+ [socketField setStringValue:@""];
+ [userField setStringValue:@""];
+ [passwordField setStringValue:@""];
+ [portField setStringValue:@""];
+ [databaseField setStringValue:@""];
[sshCheckbox setState:NSOffState];
[sshUserField setEnabled:NO];
[sshPasswordField setEnabled:NO];
[sshHostField setEnabled:NO];
[sshPortField setEnabled:NO];
- [sshHostField setStringValue:@""];
- [sshUserField setStringValue:@""];
- [sshPortField setStringValue:@"8888"];
- [sshPasswordField setStringValue:@""];
-
- [NSApp beginSheet:favoriteSheet
- modalForWindow:preferencesWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:favoriteSheet];
-
- [NSApp endSheet:favoriteSheet];
- [favoriteSheet orderOut:nil];
-
- if ( code == 1 ) {
- if ( ![[socketField stringValue] isEqualToString:@""] ) {
- //set host to localhost if socket is used
- [hostField setStringValue:@"localhost"];
- }
+ [sshHostField setStringValue:@""];
+ [sshUserField setStringValue:@""];
+ [sshPortField setStringValue:@"8888"];
+ [sshPasswordField setStringValue:@""];
+
+ [NSApp beginSheet:favoriteSheet
+ modalForWindow:preferencesWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ code = [NSApp runModalForWindow:favoriteSheet];
+
+ [NSApp endSheet:favoriteSheet];
+ [favoriteSheet orderOut:nil];
+
+ if ( code == 1 ) {
+ if ( ![[socketField stringValue] isEqualToString:@""] ) {
+ //set host to localhost if socket is used
+ [hostField setStringValue:@"localhost"];
+ }
// get ssh settings
NSString *sshHost, *sshUser, *sshPassword, *sshPort;
NSNumber *ssh;
@@ -162,25 +162,25 @@ adds a favorite
sshPort = @"";
ssh = [NSNumber numberWithInt:0];
}
- NSDictionary *favorite = [NSDictionary
- dictionaryWithObjects:[NSArray arrayWithObjects:[nameField stringValue], [hostField stringValue], [socketField stringValue], [userField stringValue], [portField stringValue], [databaseField stringValue], ssh, sshHost, sshUser, sshPort, nil]
- forKeys:[NSArray arrayWithObjects:@"name", @"host", @"socket", @"user", @"port", @"database", @"useSSH", @"sshHost", @"sshUser", @"sshPort", nil]];
- [favorites addObject:favorite];
- if ( ![[passwordField stringValue] isEqualToString:@""] )
- [keyChainInstance addPassword:[passwordField stringValue]
- forName:[NSString stringWithFormat:@"Sequel Pro : %@", [nameField stringValue]]
- account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
- [databaseField stringValue]]];
- if ( ![sshPassword isEqualToString:@""] )
- [keyChainInstance addPassword:sshPassword
- forName:[NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@", [nameField stringValue]]
- account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
- [databaseField stringValue]]];
- [tableView reloadData];
- [tableView selectRow:[tableView numberOfRows]-1 byExtendingSelection:NO];
- }
-
- isNewFavorite = NO;
+ NSDictionary *favorite = [NSDictionary
+ dictionaryWithObjects:[NSArray arrayWithObjects:[nameField stringValue], [hostField stringValue], [socketField stringValue], [userField stringValue], [portField stringValue], [databaseField stringValue], ssh, sshHost, sshUser, sshPort, nil]
+ forKeys:[NSArray arrayWithObjects:@"name", @"host", @"socket", @"user", @"port", @"database", @"useSSH", @"sshHost", @"sshUser", @"sshPort", nil]];
+ [favorites addObject:favorite];
+ if ( ![[passwordField stringValue] isEqualToString:@""] )
+ [keyChainInstance addPassword:[passwordField stringValue]
+ forName:[NSString stringWithFormat:@"Sequel Pro : %@", [nameField stringValue]]
+ account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
+ [databaseField stringValue]]];
+ if ( ![sshPassword isEqualToString:@""] )
+ [keyChainInstance addPassword:sshPassword
+ forName:[NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@", [nameField stringValue]]
+ account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
+ [databaseField stringValue]]];
+ [tableView reloadData];
+ [tableView selectRow:[tableView numberOfRows]-1 byExtendingSelection:NO];
+ }
+
+ isNewFavorite = NO;
}
- (IBAction)removeFavorite:(id)sender
@@ -188,19 +188,19 @@ adds a favorite
removes a favorite
*/
{
- if ( ![tableView numberOfSelectedRows] )
- return;
-
- NSString *name = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"name"];
- NSString *user = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"user"];
- NSString *host = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"host"];
- NSString *database = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"database"];
- [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro : %@", name]
- account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
- [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@", name]
- account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
- [favorites removeObjectAtIndex:[tableView selectedRow]];
- [tableView reloadData];
+ if ( ![tableView numberOfSelectedRows] )
+ return;
+
+ NSString *name = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"name"];
+ NSString *user = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"user"];
+ NSString *host = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"host"];
+ NSString *database = [[favorites objectAtIndex:[tableView selectedRow]] objectForKey:@"database"];
+ [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro : %@", name]
+ account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
+ [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@", name]
+ account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
+ [favorites removeObjectAtIndex:[tableView selectedRow]];
+ [tableView reloadData];
}
- (IBAction)copyFavorite:(id)sender
@@ -208,17 +208,17 @@ removes a favorite
copies a favorite
*/
{
- if ( ![tableView numberOfSelectedRows] )
- return;
-
- NSMutableDictionary *tempDictionary = [NSMutableDictionary dictionaryWithDictionary:[favorites objectAtIndex:[tableView selectedRow]]];
- [tempDictionary setObject:[NSString stringWithFormat:@"%@Copy", [tempDictionary objectForKey:@"name"]] forKey:@"name"];
-// [tempDictionary setObject:[NSString stringWithFormat:@"%@Copy", [tempDictionary objectForKey:@"user"]] forKey:@"user"];
+ if ( ![tableView numberOfSelectedRows] )
+ return;
+
+ NSMutableDictionary *tempDictionary = [NSMutableDictionary dictionaryWithDictionary:[favorites objectAtIndex:[tableView selectedRow]]];
+ [tempDictionary setObject:[NSString stringWithFormat:@"%@Copy", [tempDictionary objectForKey:@"name"]] forKey:@"name"];
+// [tempDictionary setObject:[NSString stringWithFormat:@"%@Copy", [tempDictionary objectForKey:@"user"]] forKey:@"user"];
- [favorites insertObject:tempDictionary atIndex:[tableView selectedRow]+1];
- [tableView selectRow:[tableView selectedRow]+1 byExtendingSelection:NO];
+ [favorites insertObject:tempDictionary atIndex:[tableView selectedRow]+1];
+ [tableView selectRow:[tableView selectedRow]+1 byExtendingSelection:NO];
- [tableView reloadData];
+ [tableView reloadData];
}
- (IBAction)chooseLimitRows:(id)sender
@@ -226,12 +226,12 @@ copies a favorite
enables or disables limitRowsField (depending on the state of limitRowsSwitch)
*/
{
- if ( [limitRowsSwitch state] == NSOnState ) {
- [limitRowsField setEnabled:YES];
- [limitRowsField selectText:self];
- } else {
- [limitRowsField setEnabled:NO];
- }
+ if ( [limitRowsSwitch state] == NSOnState ) {
+ [limitRowsField setEnabled:YES];
+ [limitRowsField selectText:self];
+ } else {
+ [limitRowsField setEnabled:NO];
+ }
}
- (IBAction)closeFavoriteSheet:(id)sender
@@ -239,44 +239,44 @@ enables or disables limitRowsField (depending on the state of limitRowsSwitch)
close the favoriteSheet and save favorite if user hit save
*/
{
- NSEnumerator *enumerator = [favorites objectEnumerator];
- id favorite;
- int count;
+ NSEnumerator *enumerator = [favorites objectEnumerator];
+ id favorite;
+ int count;
//test if user has entered at least name and host/socket
- if ( [sender tag] &&
- ([[nameField stringValue] isEqualToString:@""] ||
- ([[hostField stringValue] isEqualToString:@""] && [[socketField stringValue] isEqualToString:@""])) ) {
- NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Please enter at least name and host or socket!", @"message of panel when name/host/socket are missing"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
- return;
- }
-
+ if ( [sender tag] &&
+ ([[nameField stringValue] isEqualToString:@""] ||
+ ([[hostField stringValue] isEqualToString:@""] && [[socketField stringValue] isEqualToString:@""])) ) {
+ NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Please enter at least name and host or socket!", @"message of panel when name/host/socket are missing"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+ return;
+ }
+
//test if favorite name isn't used by another favorite
- count = 0;
- if ( [sender tag] ) {
- while ( (favorite = [enumerator nextObject]) ) {
- if ( [[favorite objectForKey:@"name"] isEqualToString:[nameField stringValue]] )
- {
- if ( isNewFavorite || (!isNewFavorite && (count != [tableView selectedRow])) ) {
- NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), [NSString stringWithFormat:NSLocalizedString(@"Favorite %@ has already been saved!\nPlease specify another name.", @"message of panel when favorite name has already been used"), [nameField stringValue]], NSLocalizedString(@"OK", @"OK button"), nil, nil);
- return;
- }
- }
+ count = 0;
+ if ( [sender tag] ) {
+ while ( (favorite = [enumerator nextObject]) ) {
+ if ( [[favorite objectForKey:@"name"] isEqualToString:[nameField stringValue]] )
+ {
+ if ( isNewFavorite || (!isNewFavorite && (count != [tableView selectedRow])) ) {
+ NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), [NSString stringWithFormat:NSLocalizedString(@"Favorite %@ has already been saved!\nPlease specify another name.", @"message of panel when favorite name has already been used"), [nameField stringValue]], NSLocalizedString(@"OK", @"OK button"), nil, nil);
+ return;
+ }
+ }
/*
- if ( [[favorite objectForKey:@"host"] isEqualToString:[hostField stringValue]] &&
- [[favorite objectForKey:@"user"] isEqualToString:[userField stringValue]] &&
- [[favorite objectForKey:@"database"] isEqualToString:[databaseField stringValue]] ) {
- if ( isNewFavorite || (!isNewFavorite && (count != [tableView selectedRow])) ) {
- NSRunAlertPanel(@"Error", @"There is already a favorite with the same host, user and database!", @"OK", nil, nil);
- return;
- }
- }
+ if ( [[favorite objectForKey:@"host"] isEqualToString:[hostField stringValue]] &&
+ [[favorite objectForKey:@"user"] isEqualToString:[userField stringValue]] &&
+ [[favorite objectForKey:@"database"] isEqualToString:[databaseField stringValue]] ) {
+ if ( isNewFavorite || (!isNewFavorite && (count != [tableView selectedRow])) ) {
+ NSRunAlertPanel(@"Error", @"There is already a favorite with the same host, user and database!", @"OK", nil, nil);
+ return;
+ }
+ }
*/
- count++;
- }
- }
+ count++;
+ }
+ }
- [NSApp stopModalWithCode:[sender tag]];
+ [NSApp stopModalWithCode:[sender tag]];
}
- (IBAction)toggleUseSSH:(id)sender
@@ -284,7 +284,7 @@ close the favoriteSheet and save favorite if user hit save
enables/disables ssh tunneling
*/
{
- if ( [sshCheckbox state] == NSOnState ) {
+ if ( [sshCheckbox state] == NSOnState ) {
[sshUserField setEnabled:YES];
[sshPasswordField setEnabled:YES];
[sshHostField setEnabled:YES];
@@ -303,27 +303,27 @@ enables/disables ssh tunneling
passes the query to the last created document
*/
{
- NSString *pboardString;
- NSArray *types;
+ NSString *pboardString;
+ NSArray *types;
- types = [pboard types];
+ types = [pboard types];
- if (![types containsObject:NSStringPboardType] || !(pboardString = [pboard stringForType:NSStringPboardType])) {
- *error = @"Pasteboard couldn't give string.";
- return;
- }
+ if (![types containsObject:NSStringPboardType] || !(pboardString = [pboard stringForType:NSStringPboardType])) {
+ *error = @"Pasteboard couldn't give string.";
+ return;
+ }
//check if there exists a document
- if ( ![[[NSDocumentController sharedDocumentController] documents] count] ) {
- *error = @"No Documents open!";
- return;
- }
+ if ( ![[[NSDocumentController sharedDocumentController] documents] count] ) {
+ *error = @"No Documents open!";
+ return;
+ }
//pass query to last created document
-// [[[NSDocumentController sharedDocumentController] currentDocument] doPerformQueryService:pboardString];
- [[[[NSDocumentController sharedDocumentController] documents] objectAtIndex:[[[NSDocumentController sharedDocumentController] documents] count]-1] doPerformQueryService:pboardString];
+// [[[NSDocumentController sharedDocumentController] currentDocument] doPerformQueryService:pboardString];
+ [[[[NSDocumentController sharedDocumentController] documents] objectAtIndex:[[[NSDocumentController sharedDocumentController] documents] count]-1] doPerformQueryService:pboardString];
- return;
+ return;
}
@@ -333,7 +333,7 @@ passes the query to the last created document
opens donate link in default browser
*/
{
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro/wiki/Donations"]];
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro/wiki/Donations"]];
}
//menu methods
@@ -342,7 +342,7 @@ opens donate link in default browser
opens donate link in default browser
*/
{
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro"]];
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro"]];
}
- (IBAction)visitHelpWebsite:(id)sender
@@ -350,7 +350,7 @@ opens donate link in default browser
opens donate link in default browser
*/
{
- [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro/wiki/FAQ"]];
+ [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro/wiki/FAQ"]];
}
- (IBAction)checkForUpdates:(id)sender
@@ -359,58 +359,58 @@ checks for updates and opens download page in default browser
*/
{
NSLog(@"[MainController checkForUpdates:] is not currently functional.");
-// CMMCPConnection *tempConnection = [[CMMCPConnection alloc] initToHost:@"com.google.code.sequel-pro"
-// withLogin:@"sequel-pro"
-// password:@""
-// usingPort:nil];
-// CMMCPResult *tempResult;
-// NSString *version;
-// int code;
+// CMMCPConnection *tempConnection = [[CMMCPConnection alloc] initToHost:@"com.google.code.sequel-pro"
+// withLogin:@"sequel-pro"
+// password:@""
+// usingPort:nil];
+// CMMCPResult *tempResult;
+// NSString *version;
+// int code;
//
// //connect to db
-// if ( ![tempConnection isConnected] ) {
-// //no connection
-// NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Error while trying to get the current version number!\nBe sure that you are connected to the internet and try again later.", @"message of panel when check for current version number failed"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
-// return;
-// }
-// if ( ![tempConnection selectDB:@"usr_web8_1"] ) {
-// //db not found
-// NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Error while trying to get the current version number!\nBe sure that you are connected to the internet and try again later.", @"message of panel when check for current version number failed"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
-// return;
-// }
+// if ( ![tempConnection isConnected] ) {
+// //no connection
+// NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Error while trying to get the current version number!\nBe sure that you are connected to the internet and try again later.", @"message of panel when check for current version number failed"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+// return;
+// }
+// if ( ![tempConnection selectDB:@"usr_web8_1"] ) {
+// //db not found
+// NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Error while trying to get the current version number!\nBe sure that you are connected to the internet and try again later.", @"message of panel when check for current version number failed"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+// return;
+// }
// //get current version
-// tempResult = [tempConnection queryString:@"SELECT * FROM sequel-pro"];
-// if ( ![tempResult numOfRows] ) {
-// //error in query
-// NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Error while trying to get the current version number!\nBe sure that you are connected to the internet and try again later.", @"message of panel when check for current version number failed"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
-// return;
-// }
-// version = [[tempResult fetchRowAsArray] objectAtIndex:0];
+// tempResult = [tempConnection queryString:@"SELECT * FROM sequel-pro"];
+// if ( ![tempResult numOfRows] ) {
+// //error in query
+// NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Error while trying to get the current version number!\nBe sure that you are connected to the internet and try again later.", @"message of panel when check for current version number failed"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+// return;
+// }
+// version = [[tempResult fetchRowAsArray] objectAtIndex:0];
// //check versions
-// if ( [version isEqualToString:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] ) {
-// //no new version
-// NSRunInformationalAlertPanel(NSLocalizedString(@"No update available", @"title of panel when no update is available"), NSLocalizedString(@"There is no newer version available!", @"message of panel when no update is available"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
-// } else {
-// //new version available
-// code = NSRunInformationalAlertPanel(NSLocalizedString(@"Update available", @"title of panel when update is available"), [NSString stringWithFormat:NSLocalizedString(@"There is a newer version available (version %@)!\nClick OK to open the download site.", @"message of panel when update is available"), version], NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil);
-// if ( code == NSAlertDefaultReturn ) {
-// [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro/download.php"]];
-// }
-// }
-// [tempConnection disconnect];
-// [tempConnection release];
+// if ( [version isEqualToString:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] ) {
+// //no new version
+// NSRunInformationalAlertPanel(NSLocalizedString(@"No update available", @"title of panel when no update is available"), NSLocalizedString(@"There is no newer version available!", @"message of panel when no update is available"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+// } else {
+// //new version available
+// code = NSRunInformationalAlertPanel(NSLocalizedString(@"Update available", @"title of panel when update is available"), [NSString stringWithFormat:NSLocalizedString(@"There is a newer version available (version %@)!\nClick OK to open the download site.", @"message of panel when update is available"), version], NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil);
+// if ( code == NSAlertDefaultReturn ) {
+// [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://code.google.com/p/sequel-pro/download.php"]];
+// }
+// }
+// [tempConnection disconnect];
+// [tempConnection release];
}
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [favorites count];
+ return [favorites count];
}
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
return [[favorites objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
}
@@ -419,64 +419,64 @@ checks for updates and opens download page in default browser
//tableView drag&drop datasource methods
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard
{
- int originalRow;
- NSArray *pboardTypes;
+ int originalRow;
+ NSArray *pboardTypes;
- if ( [rows count] == 1 ) {
- pboardTypes=[NSArray arrayWithObjects:@"SequelProPreferencesPasteboard", nil];
- originalRow = [[rows objectAtIndex:0] intValue];
+ if ( [rows count] == 1 ) {
+ pboardTypes=[NSArray arrayWithObjects:@"SequelProPreferencesPasteboard", nil];
+ originalRow = [[rows objectAtIndex:0] intValue];
[pboard declareTypes:pboardTypes owner:nil];
[pboard setString:[[NSNumber numberWithInt:originalRow] stringValue] forType:@"SequelProPreferencesPasteboard"];
- return YES;
- } else {
- return NO;
- }
+ return YES;
+ } else {
+ return NO;
+ }
}
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation
+ proposedDropOperation:(NSTableViewDropOperation)operation
{
- NSArray *pboardTypes = [[info draggingPasteboard] types];
- int originalRow;
-
- if ([pboardTypes count] == 1 && row != -1)
- {
- if ([[pboardTypes objectAtIndex:0] isEqualToString:@"SequelProPreferencesPasteboard"]==YES && operation==NSTableViewDropAbove)
- {
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPreferencesPasteboard"] intValue];
-
- if (row != originalRow && row != (originalRow+1))
- {
- return NSDragOperationMove;
- }
- }
- }
-
- return NSDragOperationNone;
+ NSArray *pboardTypes = [[info draggingPasteboard] types];
+ int originalRow;
+
+ if ([pboardTypes count] == 1 && row != -1)
+ {
+ if ([[pboardTypes objectAtIndex:0] isEqualToString:@"SequelProPreferencesPasteboard"]==YES && operation==NSTableViewDropAbove)
+ {
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPreferencesPasteboard"] intValue];
+
+ if (row != originalRow && row != (originalRow+1))
+ {
+ return NSDragOperationMove;
+ }
+ }
+ }
+
+ return NSDragOperationNone;
}
- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
{
- int originalRow;
- int destinationRow;
- NSMutableDictionary *draggedRow;
+ int originalRow;
+ int destinationRow;
+ NSMutableDictionary *draggedRow;
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPreferencesPasteboard"] intValue];
- destinationRow = row;
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPreferencesPasteboard"] intValue];
+ destinationRow = row;
- if ( destinationRow > originalRow )
- destinationRow--;
+ if ( destinationRow > originalRow )
+ destinationRow--;
- draggedRow = [NSMutableDictionary dictionaryWithDictionary:[favorites objectAtIndex:originalRow]];
- [favorites removeObjectAtIndex:originalRow];
- [favorites insertObject:draggedRow atIndex:destinationRow];
-
- [tableView reloadData];
- [tableView selectRow:destinationRow byExtendingSelection:NO];
+ draggedRow = [NSMutableDictionary dictionaryWithDictionary:[favorites objectAtIndex:originalRow]];
+ [favorites removeObjectAtIndex:originalRow];
+ [favorites insertObject:draggedRow atIndex:destinationRow];
+
+ [tableView reloadData];
+ [tableView selectRow:destinationRow byExtendingSelection:NO];
- return YES;
+ return YES;
}
- (BOOL)tableView:(NSTableView *)aTableView shouldEditTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex
@@ -484,20 +484,20 @@ checks for updates and opens download page in default browser
opens sheet to edit favorite and saves favorite if user hit OK
*/
{
- int code;
- NSDictionary *favorite = [favorites objectAtIndex:rowIndex];
+ int code;
+ NSDictionary *favorite = [favorites objectAtIndex:rowIndex];
// set up fields
- [nameField setStringValue:[favorite objectForKey:@"name"]];
- [hostField setStringValue:[favorite objectForKey:@"host"]];
- [socketField setStringValue:[favorite objectForKey:@"socket"]];
- [userField setStringValue:[favorite objectForKey:@"user"]];
- [portField setStringValue:[favorite objectForKey:@"port"]];
- [databaseField setStringValue:[favorite objectForKey:@"database"]];
- [passwordField setStringValue:[keyChainInstance
- getPasswordForName:[NSString stringWithFormat:@"Sequel Pro : %@", [nameField stringValue]]
- account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
- [databaseField stringValue]]]];
+ [nameField setStringValue:[favorite objectForKey:@"name"]];
+ [hostField setStringValue:[favorite objectForKey:@"host"]];
+ [socketField setStringValue:[favorite objectForKey:@"socket"]];
+ [userField setStringValue:[favorite objectForKey:@"user"]];
+ [portField setStringValue:[favorite objectForKey:@"port"]];
+ [databaseField setStringValue:[favorite objectForKey:@"database"]];
+ [passwordField setStringValue:[keyChainInstance
+ getPasswordForName:[NSString stringWithFormat:@"Sequel Pro : %@", [nameField stringValue]]
+ account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
+ [databaseField stringValue]]]];
// set up ssh fields
if ( [[favorite objectForKey:@"useSSH"] intValue] == 1 ) {
[sshCheckbox setState:NSOnState];
@@ -526,19 +526,19 @@ opens sheet to edit favorite and saves favorite if user hit OK
// run sheet
- [NSApp beginSheet:favoriteSheet
- modalForWindow:preferencesWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:favoriteSheet];
-
- [NSApp endSheet:favoriteSheet];
- [favoriteSheet orderOut:nil];
-
- if ( code == 1 ) {
- if ( ![[socketField stringValue] isEqualToString:@""] ) {
- //set host to localhost if socket is used
- [hostField setStringValue:@"localhost"];
- }
+ [NSApp beginSheet:favoriteSheet
+ modalForWindow:preferencesWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ code = [NSApp runModalForWindow:favoriteSheet];
+
+ [NSApp endSheet:favoriteSheet];
+ [favoriteSheet orderOut:nil];
+
+ if ( code == 1 ) {
+ if ( ![[socketField stringValue] isEqualToString:@""] ) {
+ //set host to localhost if socket is used
+ [hostField setStringValue:@"localhost"];
+ }
//get ssh settings
NSString *sshHost, *sshUser, *sshPassword, *sshPort;
NSNumber *ssh;
@@ -572,14 +572,14 @@ opens sheet to edit favorite and saves favorite if user hit OK
ssh = [NSNumber numberWithInt:0];
}
//replace password
- [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro : %@", [favorite objectForKey:@"name"]]
- account:[NSString stringWithFormat:@"%@@%@/%@", [favorite objectForKey:@"user"],
- [favorite objectForKey:@"host"], [favorite objectForKey:@"database"]]];
- if ( ![[passwordField stringValue] isEqualToString:@""] )
- [keyChainInstance addPassword:[passwordField stringValue]
- forName:[NSString stringWithFormat:@"Sequel Pro : %@", [nameField stringValue]]
- account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
- [databaseField stringValue]]];
+ [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro : %@", [favorite objectForKey:@"name"]]
+ account:[NSString stringWithFormat:@"%@@%@/%@", [favorite objectForKey:@"user"],
+ [favorite objectForKey:@"host"], [favorite objectForKey:@"database"]]];
+ if ( ![[passwordField stringValue] isEqualToString:@""] )
+ [keyChainInstance addPassword:[passwordField stringValue]
+ forName:[NSString stringWithFormat:@"Sequel Pro : %@", [nameField stringValue]]
+ account:[NSString stringWithFormat:@"%@@%@/%@", [userField stringValue], [hostField stringValue],
+ [databaseField stringValue]]];
//replace ssh password
[keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"Sequel Pro SSHTunnel : %@", [favorite objectForKey:@"name"]]
account:[NSString stringWithFormat:@"%@@%@/%@", [favorite objectForKey:@"user"],
@@ -591,14 +591,14 @@ opens sheet to edit favorite and saves favorite if user hit OK
[databaseField stringValue]]];
}
//replace favorite
- favorite = [NSDictionary
- dictionaryWithObjects:[NSArray arrayWithObjects:[nameField stringValue], [hostField stringValue], [socketField stringValue], [userField stringValue], [portField stringValue], [databaseField stringValue], ssh, sshHost, sshUser, sshPort, nil]
- forKeys:[NSArray arrayWithObjects:@"name", @"host", @"socket", @"user", @"port", @"database", @"useSSH", @"sshHost", @"sshUser", @"sshPort", nil]];
- [favorites replaceObjectAtIndex:rowIndex withObject:favorite];
- [tableView reloadData];
- }
-
- return NO;
+ favorite = [NSDictionary
+ dictionaryWithObjects:[NSArray arrayWithObjects:[nameField stringValue], [hostField stringValue], [socketField stringValue], [userField stringValue], [portField stringValue], [databaseField stringValue], ssh, sshHost, sshUser, sshPort, nil]
+ forKeys:[NSArray arrayWithObjects:@"name", @"host", @"socket", @"user", @"port", @"database", @"useSSH", @"sshHost", @"sshUser", @"sshPort", nil]];
+ [favorites replaceObjectAtIndex:rowIndex withObject:favorite];
+ [tableView reloadData];
+ }
+
+ return NO;
}
@@ -608,58 +608,58 @@ opens sheet to edit favorite and saves favorite if user hit OK
saves the preferences
*/
{
- if ( sender == preferencesWindow ) {
- if ( [reloadAfterAddingSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"reloadAfterAdding"];
- } else {
- [prefs setBool:NO forKey:@"reloadAfterAdding"];
- }
- if ( [reloadAfterEditingSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"reloadAfterEditing"];
- } else {
- [prefs setBool:NO forKey:@"reloadAfterEditing"];
- }
- if ( [reloadAfterRemovingSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"reloadAfterRemoving"];
- } else {
- [prefs setBool:NO forKey:@"reloadAfterRemoving"];
- }
- if ( [showErrorSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"showError"];
- } else {
- [prefs setBool:NO forKey:@"showError"];
- }
- if ( [dontShowBlobSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"dontShowBlob"];
- } else {
- [prefs setBool:NO forKey:@"dontShowBlob"];
- }
- if ( [limitRowsSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"limitRows"];
- } else {
- [prefs setBool:NO forKey:@"limitRows"];
- }
- if ( [useMonospacedFontsSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"useMonospacedFonts"];
- } else {
- [prefs setBool:NO forKey:@"useMonospacedFonts"];
- }
- if ( [fetchRowCountSwitch state] == NSOnState ) {
- [prefs setBool:YES forKey:@"fetchRowCount"];
- } else {
- [prefs setBool:NO forKey:@"fetchRowCount"];
- }
- [prefs setObject:[nullValueField stringValue] forKey:@"nullValue"];
- if ( [limitRowsField intValue] > 0 ) {
- [prefs setInteger:[limitRowsField intValue] forKey:@"limitRowsValue"];
- } else {
- [prefs setInteger:1 forKey:@"limitRowsValue"];
- }
- [prefs setObject:[encodingPopUpButton titleOfSelectedItem] forKey:@"encoding"];
-
- [prefs setObject:favorites forKey:@"favorites"];
- }
- return YES;
+ if ( sender == preferencesWindow ) {
+ if ( [reloadAfterAddingSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"reloadAfterAdding"];
+ } else {
+ [prefs setBool:NO forKey:@"reloadAfterAdding"];
+ }
+ if ( [reloadAfterEditingSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"reloadAfterEditing"];
+ } else {
+ [prefs setBool:NO forKey:@"reloadAfterEditing"];
+ }
+ if ( [reloadAfterRemovingSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"reloadAfterRemoving"];
+ } else {
+ [prefs setBool:NO forKey:@"reloadAfterRemoving"];
+ }
+ if ( [showErrorSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"showError"];
+ } else {
+ [prefs setBool:NO forKey:@"showError"];
+ }
+ if ( [dontShowBlobSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"dontShowBlob"];
+ } else {
+ [prefs setBool:NO forKey:@"dontShowBlob"];
+ }
+ if ( [limitRowsSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"limitRows"];
+ } else {
+ [prefs setBool:NO forKey:@"limitRows"];
+ }
+ if ( [useMonospacedFontsSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"useMonospacedFonts"];
+ } else {
+ [prefs setBool:NO forKey:@"useMonospacedFonts"];
+ }
+ if ( [fetchRowCountSwitch state] == NSOnState ) {
+ [prefs setBool:YES forKey:@"fetchRowCount"];
+ } else {
+ [prefs setBool:NO forKey:@"fetchRowCount"];
+ }
+ [prefs setObject:[nullValueField stringValue] forKey:@"nullValue"];
+ if ( [limitRowsField intValue] > 0 ) {
+ [prefs setInteger:[limitRowsField intValue] forKey:@"limitRowsValue"];
+ } else {
+ [prefs setInteger:1 forKey:@"limitRowsValue"];
+ }
+ [prefs setObject:[encodingPopUpButton titleOfSelectedItem] forKey:@"encoding"];
+
+ [prefs setObject:favorites forKey:@"favorites"];
+ }
+ return YES;
}
@@ -669,13 +669,13 @@ saves the preferences
code that need to be executed when the nib file is loaded
*/
{
- NSEnumerator *enumerator;
- id favorite;
- NSString *name, *host, *user, *database, *password;
+ NSEnumerator *enumerator;
+ id favorite;
+ NSString *name, *host, *user, *database, *password;
// int code;
//register MainController as services provider
- [NSApp setServicesProvider:self];
+ [NSApp setServicesProvider:self];
//register MainController for AppleScript events
[[ NSScriptExecutionContext sharedScriptExecutionContext] setTopLevelObject: self ];
@@ -685,145 +685,145 @@ code that need to be executed when the nib file is loaded
prefs = [[NSUserDefaults standardUserDefaults] retain];
isNewFavorite = NO;
[prefs registerDefaults:[NSDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:YES], @"limitRows",
- [NSNumber numberWithInt:1000], @"limitRowsValue",
- nil]];
+ [NSNumber numberWithBool:YES], @"limitRows",
+ [NSNumber numberWithInt:1000], @"limitRowsValue",
+ nil]];
//set standard preferences if no preferences are found
- if ( [prefs objectForKey:@"reloadAfterAdding"] == nil )
- {
- [prefs setObject:@"0.3" forKey:@"version"];
- [prefs setBool:YES forKey:@"reloadAfterAdding"];
- [prefs setBool:YES forKey:@"reloadAfterEditing"];
- [prefs setBool:NO forKey:@"reloadAfterRemoving"];
- [prefs setObject:@"NULL" forKey:@"nullValue"];
-// [prefs setBool:YES forKey:@"showError"];
-// [prefs setBool:NO forKey:@"dontShowBlob"];
-// [prefs setBool:NO forKey:@"limitRows"];
-// [prefs setInteger:100 forKey:@"limitRowsValue"];
-// [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"savePath"];
-// [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"openPath"];
- }
+ if ( [prefs objectForKey:@"reloadAfterAdding"] == nil )
+ {
+ [prefs setObject:@"0.3" forKey:@"version"];
+ [prefs setBool:YES forKey:@"reloadAfterAdding"];
+ [prefs setBool:YES forKey:@"reloadAfterEditing"];
+ [prefs setBool:NO forKey:@"reloadAfterRemoving"];
+ [prefs setObject:@"NULL" forKey:@"nullValue"];
+// [prefs setBool:YES forKey:@"showError"];
+// [prefs setBool:NO forKey:@"dontShowBlob"];
+// [prefs setBool:NO forKey:@"limitRows"];
+// [prefs setInteger:100 forKey:@"limitRowsValue"];
+// [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"savePath"];
+// [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"openPath"];
+ }
//new preferences and changes in v0.4
- if ( [prefs objectForKey:@"showError"] == nil )
- {
- [prefs setObject:@"0.4" forKey:@"version"];
- //set standard values for new preferences
- [prefs setBool:YES forKey:@"showError"];
- [prefs setBool:NO forKey:@"dontShowBlob"];
-// [prefs setBool:NO forKey:@"limitRows"];
-// [prefs setInteger:100 forKey:@"limitRowsValue"];
- [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"savePath"];
- [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"openPath"];
- //remove old preferences
- [prefs removeObjectForKey:@"allowDragAndDropReordering"];
- //rewrite passwords to keychain (with new format)
- if ( [prefs objectForKey:@"favorites"] ) {
- NSRunAlertPanel(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"With version 0.4 Sequel Pro has introduced a new format to save passwords in the Keychain.\nPlease allow Sequel Pro to decrypt all passwords of your favorites. Otherwise you have to reenter all passwords of your saved favorites in the Preferences.", @"message of panel when passwords have to be updated for v0.4"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
- enumerator = [[prefs objectForKey:@"favorites"] objectEnumerator];
- while ( (favorite = [enumerator nextObject]) ) {
- //replace password
- name = [favorite objectForKey:@"name"];
- host = [favorite objectForKey:@"host"];
- user = [favorite objectForKey:@"user"];
- database = [favorite objectForKey:@"database"];
- password = [keyChainInstance getPasswordForName:[NSString stringWithFormat:@"%@/%@", host, database]
- account:user];
- [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"%@/%@", host, database] account:user];
- if ( ![password isEqualToString:@""] )
- [keyChainInstance addPassword:password
- forName:[NSString stringWithFormat:@"Sequel Pro : %@", name]
- account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
- }
- }
- }
+ if ( [prefs objectForKey:@"showError"] == nil )
+ {
+ [prefs setObject:@"0.4" forKey:@"version"];
+ //set standard values for new preferences
+ [prefs setBool:YES forKey:@"showError"];
+ [prefs setBool:NO forKey:@"dontShowBlob"];
+// [prefs setBool:NO forKey:@"limitRows"];
+// [prefs setInteger:100 forKey:@"limitRowsValue"];
+ [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"savePath"];
+ [prefs setObject:[NSString stringWithString:NSHomeDirectory()] forKey:@"openPath"];
+ //remove old preferences
+ [prefs removeObjectForKey:@"allowDragAndDropReordering"];
+ //rewrite passwords to keychain (with new format)
+ if ( [prefs objectForKey:@"favorites"] ) {
+ NSRunAlertPanel(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"With version 0.4 Sequel Pro has introduced a new format to save passwords in the Keychain.\nPlease allow Sequel Pro to decrypt all passwords of your favorites. Otherwise you have to reenter all passwords of your saved favorites in the Preferences.", @"message of panel when passwords have to be updated for v0.4"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+ enumerator = [[prefs objectForKey:@"favorites"] objectEnumerator];
+ while ( (favorite = [enumerator nextObject]) ) {
+ //replace password
+ name = [favorite objectForKey:@"name"];
+ host = [favorite objectForKey:@"host"];
+ user = [favorite objectForKey:@"user"];
+ database = [favorite objectForKey:@"database"];
+ password = [keyChainInstance getPasswordForName:[NSString stringWithFormat:@"%@/%@", host, database]
+ account:user];
+ [keyChainInstance deletePasswordForName:[NSString stringWithFormat:@"%@/%@", host, database] account:user];
+ if ( ![password isEqualToString:@""] )
+ [keyChainInstance addPassword:password
+ forName:[NSString stringWithFormat:@"Sequel Pro : %@", name]
+ account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
+ }
+ }
+ }
//new preferences and changes in v0.5
- if ( [[prefs objectForKey:@"version"] isEqualToString:@"0.4"] )
- {
- [prefs setObject:@"0.5" forKey:@"version"];
- //set standard values for new preferences
- [prefs setObject:@"ISO Latin 1" forKey:@"encoding"];
- [prefs setBool:NO forKey:@"useMonospacedFonts"];
- //add socket field to favorites
- if ( [prefs objectForKey:@"favorites"] ) {
- NSMutableArray *tempFavorites = [NSMutableArray array];
- NSMutableDictionary *tempFavorite;
- enumerator = [[prefs objectForKey:@"favorites"] objectEnumerator];
- while ( (favorite = [enumerator nextObject]) ) {
- tempFavorite = [NSMutableDictionary dictionaryWithDictionary:favorite];
- [tempFavorite setObject:@"" forKey:@"socket"];
- [tempFavorites addObject:[NSDictionary dictionaryWithDictionary:tempFavorite]];
- }
- [prefs setObject:tempFavorites forKey:@"favorites"];
- }
- }
+ if ( [[prefs objectForKey:@"version"] isEqualToString:@"0.4"] )
+ {
+ [prefs setObject:@"0.5" forKey:@"version"];
+ //set standard values for new preferences
+ [prefs setObject:@"ISO Latin 1" forKey:@"encoding"];
+ [prefs setBool:NO forKey:@"useMonospacedFonts"];
+ //add socket field to favorites
+ if ( [prefs objectForKey:@"favorites"] ) {
+ NSMutableArray *tempFavorites = [NSMutableArray array];
+ NSMutableDictionary *tempFavorite;
+ enumerator = [[prefs objectForKey:@"favorites"] objectEnumerator];
+ while ( (favorite = [enumerator nextObject]) ) {
+ tempFavorite = [NSMutableDictionary dictionaryWithDictionary:favorite];
+ [tempFavorite setObject:@"" forKey:@"socket"];
+ [tempFavorites addObject:[NSDictionary dictionaryWithDictionary:tempFavorite]];
+ }
+ [prefs setObject:tempFavorites forKey:@"favorites"];
+ }
+ }
//new preferences and changes in v0.7
- if ( [[prefs objectForKey:@"version"] isEqualToString:@"0.5"] ||
+ if ( [[prefs objectForKey:@"version"] isEqualToString:@"0.5"] ||
[[prefs objectForKey:@"version"] isEqualToString:@"0.6beta"] ||
[[prefs objectForKey:@"version"] isEqualToString:@"0.7b2"] )
- {
- [prefs setObject:@"0.7b3" forKey:@"version"];
- [prefs setObject:@"Autodetect" forKey:@"encoding"];
- [prefs setBool:YES forKey:@"fetchRowCount"];
+ {
+ [prefs setObject:@"0.7b3" forKey:@"version"];
+ [prefs setObject:@"Autodetect" forKey:@"encoding"];
+ [prefs setBool:YES forKey:@"fetchRowCount"];
}
//set up interface
/*
- enumerator = [tableColumns objectEnumerator];
- while ( (column = [enumerator nextObject]) )
- {
- [[column dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ enumerator = [tableColumns objectEnumerator];
+ while ( (column = [enumerator nextObject]) )
+ {
+ [[column dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
*/
- [tableView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPreferencesPasteboard", nil]];
- [tableView reloadData];
+ [tableView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPreferencesPasteboard", nil]];
+ [tableView reloadData];
}
// SSHTunnel methods
- (id)authenticate:(NSScriptCommand *)command {
- NSDictionary *args = [command evaluatedArguments];
- NSString *givenQuery = [ args objectForKey:@"query"];
- NSString *tunnelName = [ args objectForKey:@"tunnelName"];
- NSString *fifo = [ args objectForKey:@"fifo"];
+ NSDictionary *args = [command evaluatedArguments];
+ NSString *givenQuery = [ args objectForKey:@"query"];
+ NSString *tunnelName = [ args objectForKey:@"tunnelName"];
+ NSString *fifo = [ args objectForKey:@"fifo"];
NSLog(@"tunnel: %@ / query: %@ / fifo: %@",tunnelName,givenQuery,fifo);
- NSFileHandle *fh = [ NSFileHandle fileHandleForWritingAtPath: fifo ];
- [ fh writeData: [ @"xy" dataUsingEncoding: NSASCIIStringEncoding]];
- [ fh closeFile ];
+ NSFileHandle *fh = [ NSFileHandle fileHandleForWritingAtPath: fifo ];
+ [ fh writeData: [ @"xy" dataUsingEncoding: NSASCIIStringEncoding]];
+ [ fh closeFile ];
NSLog(@"password written");
return @"OK";
/*
- [ query setStringValue: givenQuery ];
- [NSApp beginSheet: alertSheet
- modalForWindow: mainWindow
- modalDelegate: nil
- didEndSelector: nil
- contextInfo: nil];
- [NSApp runModalForWindow: alertSheet];
- // Sheet is up here.
- [NSApp endSheet: alertSheet];
- [alertSheet orderOut: self];
- if ( sheetStatus == 0)
- {
- password = [ passwd stringValue ];
- [ passwd setStringValue: @"" ];
- return password ;
- }
- else
- {
- [[tunnelTask objectForKey: @"task" ] terminate ];
- }
- sheetStatus = nil;
- return @"";
+ [ query setStringValue: givenQuery ];
+ [NSApp beginSheet: alertSheet
+ modalForWindow: mainWindow
+ modalDelegate: nil
+ didEndSelector: nil
+ contextInfo: nil];
+ [NSApp runModalForWindow: alertSheet];
+ // Sheet is up here.
+ [NSApp endSheet: alertSheet];
+ [alertSheet orderOut: self];
+ if ( sheetStatus == 0)
+ {
+ password = [ passwd stringValue ];
+ [ passwd setStringValue: @"" ];
+ return password ;
+ }
+ else
+ {
+ [[tunnelTask objectForKey: @"task" ] terminate ];
+ }
+ sheetStatus = nil;
+ return @"";
*/
}
- (id)handleQuitScriptCommand:(NSScriptCommand *)command
/* what exactly is this for? */
{
- [ NSApp terminate: self ];
+ [ NSApp terminate: self ];
}
@end
diff --git a/SPTableInfo.m b/SPTableInfo.m
index 0885e96f..4b51b848 100644
--- a/SPTableInfo.m
+++ b/SPTableInfo.m
@@ -48,12 +48,12 @@
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [info count];
+ return [info count];
}
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ row:(int)rowIndex
{
return [info objectAtIndex:rowIndex];
}
diff --git a/SSHTunnel.h b/SSHTunnel.h
index b945f205..ffe29624 100644
--- a/SSHTunnel.h
+++ b/SSHTunnel.h
@@ -2,26 +2,26 @@
@interface SSHTunnel : NSObject
{
- int code;
- NSArray *tunnelsLocal;
- NSArray *tunnelsRemote;
-
- BOOL shouldStop;
- NSTask *task;
- BOOL connAuth;
- BOOL autoConnect;
- NSPipe *stdErrPipe;
- NSString *connName;
- NSString *status;
- NSString *connPort;
- BOOL connRemote;
- BOOL compression;
- BOOL v1;
- NSString * encryption;
- BOOL socks4;
- NSNumber *socks4p;
- NSString *connUser;
- NSString *connHost;
+ int code;
+ NSArray *tunnelsLocal;
+ NSArray *tunnelsRemote;
+
+ BOOL shouldStop;
+ NSTask *task;
+ BOOL connAuth;
+ BOOL autoConnect;
+ NSPipe *stdErrPipe;
+ NSString *connName;
+ NSString *status;
+ NSString *connPort;
+ BOOL connRemote;
+ BOOL compression;
+ BOOL v1;
+ NSString * encryption;
+ BOOL socks4;
+ NSNumber *socks4p;
+ NSString *connUser;
+ NSString *connHost;
}
-(id)initWithName:(NSString*)aName;
-(id)initWithDictionary:(NSDictionary*)aDictionary;
diff --git a/SSHTunnel.m b/SSHTunnel.m
index a2d8e1f7..617db8a7 100755
--- a/SSHTunnel.m
+++ b/SSHTunnel.m
@@ -34,11 +34,11 @@
#pragma mark Initialization
-(id)init
{
- return [ self initWithName:@"New Tunnel"];
+ return [ self initWithName:@"New Tunnel"];
}
-(id)initWithName:(NSString*)aName
{
- NSDictionary *dictionary = [ NSDictionary dictionaryWithObjectsAndKeys:
+ NSDictionary *dictionary = [ NSDictionary dictionaryWithObjectsAndKeys:
[ NSNumber numberWithBool: NO ],@"compression",
[ NSNumber numberWithBool: YES ],@"connAuth",
@"", @"connHost",
@@ -53,300 +53,300 @@
[ NSArray array ], @"tunnelsRemote",
[ NSNumber numberWithBool: NO ],@"v1", nil
];
- return [ self initWithDictionary: dictionary ];
+ return [ self initWithDictionary: dictionary ];
}
-(id)initWithDictionary:(NSDictionary*)aDictionary
{
- NSEnumerator *e;
- NSString *key;
+ NSEnumerator *e;
+ NSString *key;
- self = [ super init ];
- e = [[ aDictionary allKeys ] objectEnumerator ];
- while (key = [ e nextObject ])
- {
+ self = [ super init ];
+ e = [[ aDictionary allKeys ] objectEnumerator ];
+ while (key = [ e nextObject ])
+ {
[ self setValue: [ aDictionary objectForKey: key ] forKey: key ];
- }
- code = 0;
- if ([[ self valueForKey: @"autoConnect" ] boolValue ])
+ }
+ code = 0;
+ if ([[ self valueForKey: @"autoConnect" ] boolValue ])
[ self startTunnel ];
- return self;
+ return self;
}
+(id)tunnelWithName:(NSString*)aName
{
- return [[ SSHTunnel alloc ] initWithName: aName ];
+ return [[ SSHTunnel alloc ] initWithName: aName ];
}
+(SSHTunnel*)tunnelFromDictionary:(NSDictionary*)aDictionary
{
- return [[ SSHTunnel alloc ] initWithDictionary: aDictionary ];
+ return [[ SSHTunnel alloc ] initWithDictionary: aDictionary ];
}
+(NSArray*)tunnelsFromArray:(NSArray*)anArray
{
- NSMutableArray *newArray;
- SSHTunnel *currentTunnel;
- NSEnumerator *e;
- NSDictionary *currentTunnelDictionary;
-
- newArray = [ NSMutableArray array ];
- e = [ anArray objectEnumerator ];
- while (currentTunnelDictionary = [ e nextObject ])
- {
+ NSMutableArray *newArray;
+ SSHTunnel *currentTunnel;
+ NSEnumerator *e;
+ NSDictionary *currentTunnelDictionary;
+
+ newArray = [ NSMutableArray array ];
+ e = [ anArray objectEnumerator ];
+ while (currentTunnelDictionary = [ e nextObject ])
+ {
currentTunnel = [ SSHTunnel tunnelFromDictionary: currentTunnelDictionary ];
[ newArray addObject: currentTunnel ];
- }
- return [[ newArray copy ] autorelease ];
+ }
+ return [[ newArray copy ] autorelease ];
}
#pragma mark -
#pragma mark Adding and removing port redir.
-(void)addLocalTunnel:(NSDictionary*)aDictionary;
{
- NSMutableArray *tempTunnelsLocal = [ NSMutableArray arrayWithArray: tunnelsLocal ];
- [ tempTunnelsLocal addObject: aDictionary ];
- [ tunnelsLocal release ];
- tunnelsLocal = [ tempTunnelsLocal copy ];
+ NSMutableArray *tempTunnelsLocal = [ NSMutableArray arrayWithArray: tunnelsLocal ];
+ [ tempTunnelsLocal addObject: aDictionary ];
+ [ tunnelsLocal release ];
+ tunnelsLocal = [ tempTunnelsLocal copy ];
}
- (void)removeLocal:(int)index
{
- NSMutableArray *tempLocalTunnels = [ tunnelsLocal mutableCopy ];
- [ tempLocalTunnels removeObjectAtIndex: index ];
- [ tunnelsLocal release ];
- tunnelsLocal = [ tempLocalTunnels copy ];
- [ tempLocalTunnels release ];
+ NSMutableArray *tempLocalTunnels = [ tunnelsLocal mutableCopy ];
+ [ tempLocalTunnels removeObjectAtIndex: index ];
+ [ tunnelsLocal release ];
+ tunnelsLocal = [ tempLocalTunnels copy ];
+ [ tempLocalTunnels release ];
}
-(void)addRemoteTunnel:(NSDictionary*)aDictionary;
{
- NSMutableArray *tempTunnelsRemote = [ NSMutableArray arrayWithArray: tunnelsRemote ];
- [ tempTunnelsRemote addObject: aDictionary ];
- [ tunnelsRemote release ];
- tunnelsRemote = [ tempTunnelsRemote copy ];
+ NSMutableArray *tempTunnelsRemote = [ NSMutableArray arrayWithArray: tunnelsRemote ];
+ [ tempTunnelsRemote addObject: aDictionary ];
+ [ tunnelsRemote release ];
+ tunnelsRemote = [ tempTunnelsRemote copy ];
}
- (void)removeRemote:(int)index
{
- NSMutableArray *tempRemoteTunnels = [ tunnelsRemote mutableCopy ];
- [ tempRemoteTunnels removeObjectAtIndex: index ];
- [ tunnelsRemote release ];
- tunnelsRemote = [ tempRemoteTunnels copy ];
- [ tempRemoteTunnels release ];
+ NSMutableArray *tempRemoteTunnels = [ tunnelsRemote mutableCopy ];
+ [ tempRemoteTunnels removeObjectAtIndex: index ];
+ [ tunnelsRemote release ];
+ tunnelsRemote = [ tempRemoteTunnels copy ];
+ [ tempRemoteTunnels release ];
}
- (void)setLocalValue:(NSString*)aValue ofTunnel:(int)index forKey:(NSString*)key
{
- NSMutableArray *tempLocalTunnel;
- NSMutableDictionary *tempCurrentTunnel;
-
- tempLocalTunnel = [tunnelsLocal mutableCopy];
- tempCurrentTunnel = [[ tempLocalTunnel objectAtIndex: index ] mutableCopy ];
-
- [ tempCurrentTunnel setObject: aValue forKey: key ];
- [ tempLocalTunnel replaceObjectAtIndex:index withObject:[tempCurrentTunnel copy ]];
- [ tempCurrentTunnel release ];
- [ tunnelsLocal release ];
- tunnelsLocal = [ tempLocalTunnel copy ];
+ NSMutableArray *tempLocalTunnel;
+ NSMutableDictionary *tempCurrentTunnel;
+
+ tempLocalTunnel = [tunnelsLocal mutableCopy];
+ tempCurrentTunnel = [[ tempLocalTunnel objectAtIndex: index ] mutableCopy ];
+
+ [ tempCurrentTunnel setObject: aValue forKey: key ];
+ [ tempLocalTunnel replaceObjectAtIndex:index withObject:[tempCurrentTunnel copy ]];
+ [ tempCurrentTunnel release ];
+ [ tunnelsLocal release ];
+ tunnelsLocal = [ tempLocalTunnel copy ];
}
- (void)setRemoteValue:(NSString*)aValue ofTunnel:(int)index forKey:(NSString*)key
{
- NSMutableArray *tempRemoteTunnel;
- NSMutableDictionary *tempCurrentTunnel;
-
- tempRemoteTunnel = [tunnelsRemote mutableCopy];
- tempCurrentTunnel = [[ tempRemoteTunnel objectAtIndex: index ] mutableCopy ];
-
- [ tempCurrentTunnel setObject: aValue forKey: key ];
- [ tempRemoteTunnel replaceObjectAtIndex:index withObject:[tempCurrentTunnel copy ]];
- [ tempCurrentTunnel release ];
- [ tunnelsRemote release ];
- tunnelsRemote = [ tempRemoteTunnel copy ];
+ NSMutableArray *tempRemoteTunnel;
+ NSMutableDictionary *tempCurrentTunnel;
+
+ tempRemoteTunnel = [tunnelsRemote mutableCopy];
+ tempCurrentTunnel = [[ tempRemoteTunnel objectAtIndex: index ] mutableCopy ];
+
+ [ tempCurrentTunnel setObject: aValue forKey: key ];
+ [ tempRemoteTunnel replaceObjectAtIndex:index withObject:[tempCurrentTunnel copy ]];
+ [ tempCurrentTunnel release ];
+ [ tunnelsRemote release ];
+ tunnelsRemote = [ tempRemoteTunnel copy ];
}
#pragma mark -
#pragma mark Execution related
- (void)startTunnel
-{
-// NSDictionary *t;
-// NSEnumerator *e;
-// BOOL asRoot = NO;
-
- if ([ self isRunning ])
+{
+// NSDictionary *t;
+// NSEnumerator *e;
+// BOOL asRoot = NO;
+
+ if ([ self isRunning ])
return;
-
- shouldStop = NO;
- /*
- [ arguments addObject: @"-N" ];
- [ arguments addObject: @"-v" ];
- [ arguments addObject: @"-p" ];
- if ([ connPort length ])
+
+ shouldStop = NO;
+ /*
+ [ arguments addObject: @"-N" ];
+ [ arguments addObject: @"-v" ];
+ [ arguments addObject: @"-p" ];
+ if ([ connPort length ])
[ arguments addObject: connPort];
- else
+ else
[ arguments addObject: @"22" ];
-
- if (connRemote)
+
+ if (connRemote)
[ arguments addObject: @"-g" ];
- if (compression)
+ if (compression)
[ arguments addObject: @"-C" ];
- if (v1)
+ if (v1)
[ arguments addObject: @"-1" ];
-
- [ arguments addObject: @"-c"];
- if (encryption)
+
+ [ arguments addObject: @"-c"];
+ if (encryption)
[ arguments addObject: encryption];
- else
+ else
[ arguments addObject: @"3des"];
-
- if (socks4 && socks4p != nil)
- {
+
+ if (socks4 && socks4p != nil)
+ {
[ arguments addObject: @"-D" ];
[ arguments addObject: [ socks4p stringValue ]];
- }
- [ arguments addObject: [ NSString stringWithFormat: @"%@@%@",
+ }
+ [ arguments addObject: [ NSString stringWithFormat: @"%@@%@",
connUser, connHost ]
];
-
- NSString *hostPort;
- e = [ tunnelsLocal objectEnumerator ];
- while (t = [ e nextObject ])
- {
+
+ NSString *hostPort;
+ e = [ tunnelsLocal objectEnumerator ];
+ while (t = [ e nextObject ])
+ {
[ arguments addObject: @"-L" ];
if ([[ t objectForKey:@"hostport"] isEqualTo: @"" ])
- hostPort = [ t objectForKey:@"port" ];
+ hostPort = [ t objectForKey:@"port" ];
else
- hostPort = [ t objectForKey:@"hostport" ];
+ hostPort = [ t objectForKey:@"hostport" ];
[ arguments addObject: [NSString stringWithFormat:@"%@/%@/%@",
- [ t objectForKey:@"port"],
- [ t objectForKey:@"host"],
- hostPort
- ] ];
+ [ t objectForKey:@"port"],
+ [ t objectForKey:@"host"],
+ hostPort
+ ] ];
if ([[ t objectForKey:@"port"] intValue] < 1024)
- asRoot=YES;
- }
-
- e = [ tunnelsRemote objectEnumerator ];
- while (t = [ e nextObject ])
- {
+ asRoot=YES;
+ }
+
+ e = [ tunnelsRemote objectEnumerator ];
+ while (t = [ e nextObject ])
+ {
[ arguments addObject: @"-R" ];
if ([[ t objectForKey:@"hostport"] isEqualTo: @"" ])
- hostPort = [ t objectForKey:@"port" ];
+ hostPort = [ t objectForKey:@"port" ];
else
- hostPort = [ t objectForKey:@"hostport" ];
+ hostPort = [ t objectForKey:@"hostport" ];
[ arguments addObject: [NSString stringWithFormat:@"%@/%@/%@",
- [ t objectForKey:@"port"],
- [ t objectForKey:@"host"],
- hostPort
- ]];
- }
- args = [ NSMutableDictionary dictionary ];
- [ args setObject: arguments forKey:@"arguments" ];
- [ args setObject: [ NSNumber numberWithBool: connAuth ] forKey: @"handleAuth" ];
- [ args setObject: connName forKey:@"tunnelName" ];
- [ args setObject: [ NSNumber numberWithBool: asRoot ] forKey: @"asRoot" ];
-
-
- [ NSThread detachNewThreadSelector:@selector(launchTunnel:)
- toTarget: self
- withObject: args ];
- */
- [ NSThread detachNewThreadSelector:@selector(launchTunnel:)
- toTarget: self
- withObject: nil ];
-// [ arguments release ];
-
+ [ t objectForKey:@"port"],
+ [ t objectForKey:@"host"],
+ hostPort
+ ]];
+ }
+ args = [ NSMutableDictionary dictionary ];
+ [ args setObject: arguments forKey:@"arguments" ];
+ [ args setObject: [ NSNumber numberWithBool: connAuth ] forKey: @"handleAuth" ];
+ [ args setObject: connName forKey:@"tunnelName" ];
+ [ args setObject: [ NSNumber numberWithBool: asRoot ] forKey: @"asRoot" ];
+
+
+ [ NSThread detachNewThreadSelector:@selector(launchTunnel:)
+ toTarget: self
+ withObject: args ];
+ */
+ [ NSThread detachNewThreadSelector:@selector(launchTunnel:)
+ toTarget: self
+ withObject: nil ];
+// [ arguments release ];
+
}
- (void)stopTunnel
{
- if (! [ self isRunning ])
+ if (! [ self isRunning ])
return;
- shouldStop=YES;
- [ self setValue: nil forKey: @"status" ];
- [ task terminate ];
- code = 0;
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ shouldStop=YES;
+ [ self setValue: nil forKey: @"status" ];
+ [ task terminate ];
+ code = 0;
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
}
- (void)toggleTunnel
{
- if ([ self isRunning ])
+ if ([ self isRunning ])
[ self stopTunnel ];
- else
+ else
[ self startTunnel ];
}
- (void)launchTunnel:(id)foo;
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- if (task)
+ if (task)
[ task release ];
- task = [[ NSTask alloc ] init ];
- NSMutableDictionary *environment = [ NSMutableDictionary dictionaryWithDictionary: [[ NSProcessInfo processInfo ] environment ]];
- NSString *pathToAuthentifier = [[ NSBundle mainBundle ] pathForResource: @"askForPass" ofType: @"sh" ];
- if (socks4)
+ task = [[ NSTask alloc ] init ];
+ NSMutableDictionary *environment = [ NSMutableDictionary dictionaryWithDictionary: [[ NSProcessInfo processInfo ] environment ]];
+ NSString *pathToAuthentifier = [[ NSBundle mainBundle ] pathForResource: @"askForPass" ofType: @"sh" ];
+ if (socks4)
[ task setLaunchPath: [[ NSBundle mainBundle ] pathForResource: @"ssh" ofType: @"" ]];
- else
+ else
[ task setLaunchPath: @"/usr/bin/ssh" ];
- [ task setArguments: [ self arguments ]];
- if (connAuth)
- {
- [ environment removeObjectForKey: @"SSH_AGENT_PID" ];
- [ environment removeObjectForKey: @"SSH_AUTH_SOCK" ];
- [ environment setObject: pathToAuthentifier forKey: @"SSH_ASKPASS" ];
- [ environment setObject:@":0" forKey:@"DISPLAY" ];
- }
- [ environment setObject: connName forKey: @"TUNNEL_NAME" ];
- [ task setEnvironment: environment ];
+ [ task setArguments: [ self arguments ]];
+ if (connAuth)
+ {
+ [ environment removeObjectForKey: @"SSH_AGENT_PID" ];
+ [ environment removeObjectForKey: @"SSH_AUTH_SOCK" ];
+ [ environment setObject: pathToAuthentifier forKey: @"SSH_ASKPASS" ];
+ [ environment setObject:@":0" forKey:@"DISPLAY" ];
+ }
+ [ environment setObject: connName forKey: @"TUNNEL_NAME" ];
+ [ task setEnvironment: environment ];
- stdErrPipe = [[ NSPipe alloc ] init ];
- [ task setStandardError: stdErrPipe ];
-
- [[ NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(stdErr:)
+ stdErrPipe = [[ NSPipe alloc ] init ];
+ [ task setStandardError: stdErrPipe ];
+
+ [[ NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(stdErr:)
name: @"NSFileHandleDataAvailableNotification"
object:[ stdErrPipe fileHandleForReading]];
-
- [[ stdErrPipe fileHandleForReading] waitForDataInBackgroundAndNotify ];
+
+ [[ stdErrPipe fileHandleForReading] waitForDataInBackgroundAndNotify ];
- NSLog(T_START,connName);
- [ self setValue: S_CONNECTING forKey: @"status" ];
- code = 1;
- [ task launch ];
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
- [ task waitUntilExit ];
- sleep(1);
- code = 0;
- [ self setValue: S_IDLE forKey: @"status" ];
- NSLog(T_STOP,connName);
- [[ NSNotificationCenter defaultCenter] removeObserver:self
- name: @"NSFileHandleDataAvailableNotification"
- object:[ stdErrPipe fileHandleForReading]];
- [ task release ];
- task = nil;
- [ stdErrPipe release ];
- stdErrPipe = nil;
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
- if (! shouldStop)
+ NSLog(T_START,connName);
+ [ self setValue: S_CONNECTING forKey: @"status" ];
+ code = 1;
+ [ task launch ];
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ [ task waitUntilExit ];
+ sleep(1);
+ code = 0;
+ [ self setValue: S_IDLE forKey: @"status" ];
+ NSLog(T_STOP,connName);
+ [[ NSNotificationCenter defaultCenter] removeObserver:self
+ name: @"NSFileHandleDataAvailableNotification"
+ object:[ stdErrPipe fileHandleForReading]];
+ [ task release ];
+ task = nil;
+ [ stdErrPipe release ];
+ stdErrPipe = nil;
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ if (! shouldStop)
[ self startTunnel ];
- [ pool release ];
+ [ pool release ];
}
- (void)stdErr:(NSNotification*)aNotification
{
- NSData *data = [[ aNotification object ] availableData ];
- NSString *log = [[ NSString alloc ] initWithData: data encoding: NSASCIIStringEncoding ];
- BOOL wait = YES;
- if ([ log length ])
- {
+ NSData *data = [[ aNotification object ] availableData ];
+ NSString *log = [[ NSString alloc ] initWithData: data encoding: NSASCIIStringEncoding ];
+ BOOL wait = YES;
+ if ([ log length ])
+ {
//NSLog(log);
NSArray *lines = [ log componentsSeparatedByString:@"\n" ];
NSEnumerator *e = [ lines objectEnumerator ];
NSString *line;
while (line = [ e nextObject ])
{
- if ([ line rangeOfString:@"Entering interactive session." ].location != NSNotFound)
- {
+ if ([ line rangeOfString:@"Entering interactive session." ].location != NSNotFound)
+ {
code = 2;
[ self setValue: S_CONNECTED forKey: @"status"];
- }
- if ([ line rangeOfString:@"Authentication succeeded" ].location != NSNotFound)
+ }
+ if ([ line rangeOfString:@"Authentication succeeded" ].location != NSNotFound)
[ self setValue: S_AUTH forKey: @"status"];
- if ([ line rangeOfString:@"Connections to local port" ].location != NSNotFound)
- {
+ if ([ line rangeOfString:@"Connections to local port" ].location != NSNotFound)
+ {
NSScanner *s;
NSString *port;
s = [ NSScanner scannerWithString:log];
@@ -354,113 +354,113 @@
[ s scanString: @"Connections to local port " intoString: nil ];
[ s scanUpToString: @"forwarded" intoString:&port];
[ self setValue: [ NSString stringWithFormat: @"Port %@ forwarded", port ] forKey: @"status"];
- }
- if ([ line rangeOfString:@"closed by remote host." ].location != NSNotFound)
- {
+ }
+ if ([ line rangeOfString:@"closed by remote host." ].location != NSNotFound)
+ {
[ task terminate];
[ self setValue: @"Connection closed" forKey: @"status"];
wait = NO;
- }
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ }
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
}
if (wait)
- [[ stdErrPipe fileHandleForReading ] waitForDataInBackgroundAndNotify ];
- }
- [ log release] ;
+ [[ stdErrPipe fileHandleForReading ] waitForDataInBackgroundAndNotify ];
+ }
+ [ log release] ;
}
- (BOOL)isRunning
{
- if ([ task isRunning ])
+ if ([ task isRunning ])
return YES;
- return NO;
+ return NO;
}
#pragma mark -
#pragma mark Getting tunnel informations
- (NSString *)status
{
- if (status)
+ if (status)
return status;
- return S_IDLE;
+ return S_IDLE;
}
- (NSArray*)arguments
{
- NSMutableArray *arguments;
- NSEnumerator *e;
- NSDictionary *t;
- BOOL asRoot;
-
- arguments = [ NSMutableArray array ];
- [ arguments addObject: @"-N" ];
- [ arguments addObject: @"-v" ];
- [ arguments addObject: @"-p" ];
- if ([ connPort length ])
+ NSMutableArray *arguments;
+ NSEnumerator *e;
+ NSDictionary *t;
+ BOOL asRoot;
+
+ arguments = [ NSMutableArray array ];
+ [ arguments addObject: @"-N" ];
+ [ arguments addObject: @"-v" ];
+ [ arguments addObject: @"-p" ];
+ if ([ connPort length ])
[ arguments addObject: connPort];
- else
+ else
[ arguments addObject: @"22" ];
-
- if (connRemote)
+
+ if (connRemote)
[ arguments addObject: @"-g" ];
- if (compression)
+ if (compression)
[ arguments addObject: @"-C" ];
- if (v1)
+ if (v1)
[ arguments addObject: @"-1" ];
-
- [ arguments addObject: @"-c"];
- if (encryption)
+
+ [ arguments addObject: @"-c"];
+ if (encryption)
[ arguments addObject: encryption];
- else
+ else
[ arguments addObject: @"3des"];
-
- if (socks4 && socks4p != nil)
- {
+
+ if (socks4 && socks4p != nil)
+ {
[ arguments addObject: @"-D" ];
[ arguments addObject: [ socks4p stringValue ]];
- }
- [ arguments addObject: [ NSString stringWithFormat: @"%@@%@",
+ }
+ [ arguments addObject: [ NSString stringWithFormat: @"%@@%@",
connUser, connHost ]
];
-
- NSString *hostPort;
- e = [ tunnelsLocal objectEnumerator ];
- while (t = [ e nextObject ])
- {
+
+ NSString *hostPort;
+ e = [ tunnelsLocal objectEnumerator ];
+ while (t = [ e nextObject ])
+ {
[ arguments addObject: @"-L" ];
if ([[ t objectForKey:@"hostport"] isEqualTo: @"" ])
- hostPort = [ t objectForKey:@"port" ];
+ hostPort = [ t objectForKey:@"port" ];
else
- hostPort = [ t objectForKey:@"hostport" ];
+ hostPort = [ t objectForKey:@"hostport" ];
[ arguments addObject: [NSString stringWithFormat:@"%@/%@/%@",
- [ t objectForKey:@"port"],
- [ t objectForKey:@"host"],
- hostPort
- ] ];
+ [ t objectForKey:@"port"],
+ [ t objectForKey:@"host"],
+ hostPort
+ ] ];
if ([[ t objectForKey:@"port"] intValue] < 1024)
- asRoot=YES;
- }
-
- e = [ tunnelsRemote objectEnumerator ];
- while (t = [ e nextObject ])
- {
+ asRoot=YES;
+ }
+
+ e = [ tunnelsRemote objectEnumerator ];
+ while (t = [ e nextObject ])
+ {
[ arguments addObject: @"-R" ];
if ([[ t objectForKey:@"hostport"] isEqualTo: @"" ])
- hostPort = [ t objectForKey:@"port" ];
+ hostPort = [ t objectForKey:@"port" ];
else
- hostPort = [ t objectForKey:@"hostport" ];
+ hostPort = [ t objectForKey:@"hostport" ];
[ arguments addObject: [NSString stringWithFormat:@"%@/%@/%@",
- [ t objectForKey:@"port"],
- [ t objectForKey:@"host"],
- hostPort
- ]];
- }
-
- return [[ arguments copy ] autorelease ];
+ [ t objectForKey:@"port"],
+ [ t objectForKey:@"host"],
+ hostPort
+ ]];
+ }
+
+ return [[ arguments copy ] autorelease ];
}
- (NSDictionary*)dictionary
{
- return [ NSDictionary dictionaryWithObjectsAndKeys:
+ return [ NSDictionary dictionaryWithObjectsAndKeys:
[ NSNumber numberWithBool: compression ],@"compression",
[ NSNumber numberWithBool: connAuth ],@"connAuth",
[ NSNumber numberWithBool: autoConnect ],@"autoConnect",
@@ -483,47 +483,47 @@
#pragma mark Key/Value coding
- (NSImage*)icon
{
- switch (code)
- {
+ switch (code)
+ {
case 0:
- return [ NSImage imageNamed: @"offState" ];
- break;
+ return [ NSImage imageNamed: @"offState" ];
+ break;
case 1:
- return [ NSImage imageNamed: @"middleState" ];
- break;
+ return [ NSImage imageNamed: @"middleState" ];
+ break;
case 2:
- return [ NSImage imageNamed: @"onState" ];
- break;
- }
- return [ NSImage imageNamed: @"offState" ];
+ return [ NSImage imageNamed: @"onState" ];
+ break;
+ }
+ return [ NSImage imageNamed: @"offState" ];
}
- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
- NSLog(@"key %@ undefined",key);
+ NSLog(@"key %@ undefined",key);
}
- (id)valueForUndefinedKey:(NSString *)key
{
- return nil;
+ return nil;
}
#pragma mark -
#pragma mark Misc.
-(void)dealloc
{
- [ self stopTunnel ];
- [ tunnelsLocal release ];
- [ tunnelsRemote release ];
-
- [ task release ];
- [ stdErrPipe release ];
- [ connName release ];
- [ status release ];
- [ connPort release ];
- [ encryption release ];
- [ socks4p release ];
- [ connUser release ];
- [ connHost release ];
-
+ [ self stopTunnel ];
+ [ tunnelsLocal release ];
+ [ tunnelsRemote release ];
+
+ [ task release ];
+ [ stdErrPipe release ];
+ [ connName release ];
+ [ status release ];
+ [ connPort release ];
+ [ encryption release ];
+ [ socks4p release ];
+ [ connUser release ];
+ [ connHost release ];
+
// start diff lorenz textor
[super dealloc];
// end diff lorenz textor
diff --git a/SSHTunnel_old.h b/SSHTunnel_old.h
index f70d3a52..b1daa595 100755
--- a/SSHTunnel_old.h
+++ b/SSHTunnel_old.h
@@ -12,11 +12,11 @@ Modified by Lorenz Textor for use with Sequel Pro
@interface SSHTunnel : NSObject
{
BOOL shouldStop;
- NSTask *task;
- NSPipe *stdErrPipe;
- NSString *status;
+ NSTask *task;
+ NSPipe *stdErrPipe;
+ NSString *status;
- NSDictionary *tunnelArguments;
+ NSDictionary *tunnelArguments;
}
// initialization
diff --git a/SSHTunnel_old.m b/SSHTunnel_old.m
index 7657ba22..8080a9bf 100755
--- a/SSHTunnel_old.m
+++ b/SSHTunnel_old.m
@@ -34,10 +34,10 @@ Modified by Lorenz Textor for use with Sequel Pro
// initialization
- (id)init
{
- self = [super init];
+ self = [super init];
- // Make this class the root one for AppleEvent calls
-// [[ NSScriptExecutionContext sharedScriptExecutionContext] setTopLevelObject: self ];
+ // Make this class the root one for AppleEvent calls
+// [[ NSScriptExecutionContext sharedScriptExecutionContext] setTopLevelObject: self ];
return self;
}
@@ -46,14 +46,14 @@ Modified by Lorenz Textor for use with Sequel Pro
- (BOOL)isRunning
/* returns YES if tunnel is running */
{
- return [ task isRunning ];
+ return [ task isRunning ];
}
- (NSString*)status
{
- if (status)
+ if (status)
return status;
- return S_IDLE;
+ return S_IDLE;
}
// starting & stopping the tunnel
@@ -77,7 +77,7 @@ Modified by Lorenz Textor for use with Sequel Pro
// [self stopTunnel];
return;
- shouldStop = NO;
+ shouldStop = NO;
// get arguments
[ arguments addObject: @"-N" ];
@@ -95,9 +95,9 @@ Modified by Lorenz Textor for use with Sequel Pro
[ arguments addObject: @"-L" ];
[ arguments addObject: [NSString stringWithFormat:@"%@/%@/%@", [args objectForKey:@"localPort"], [args objectForKey:@"host"], [args objectForKey:@"remotePort"]] ];
- [ NSThread detachNewThreadSelector:@selector(launchTunnel:)
- toTarget: self
- withObject: arguments ];
+ [ NSThread detachNewThreadSelector:@selector(launchTunnel:)
+ toTarget: self
+ withObject: arguments ];
[ arguments release ];
}
@@ -105,74 +105,74 @@ Modified by Lorenz Textor for use with Sequel Pro
- (void)stopTunnel
/* stops the tunnel */
{
- if (! [ self isRunning ])
+ if (! [ self isRunning ])
return;
- shouldStop=YES;
- [ self setValue: nil forKey: @"status" ];
- [ task terminate ];
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ shouldStop=YES;
+ [ self setValue: nil forKey: @"status" ];
+ [ task terminate ];
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
}
- (void)launchTunnel:(NSArray*)arguments
/* launches the tunnel in a separate thread */
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- if (task)
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ if (task)
[ task release ];
- task = [[ NSTask alloc ] init ];
- NSMutableDictionary *environment = [ NSMutableDictionary dictionaryWithDictionary: [[ NSProcessInfo processInfo ] environment ]];
- NSString *pathToAuthentifier = [[ NSBundle mainBundle ] pathForResource: @"askForPass" ofType: @"sh" ];
-
- [ task setLaunchPath: @"/usr/bin/ssh" ];
- [ task setArguments: arguments ];
+ task = [[ NSTask alloc ] init ];
+ NSMutableDictionary *environment = [ NSMutableDictionary dictionaryWithDictionary: [[ NSProcessInfo processInfo ] environment ]];
+ NSString *pathToAuthentifier = [[ NSBundle mainBundle ] pathForResource: @"askForPass" ofType: @"sh" ];
+
+ [ task setLaunchPath: @"/usr/bin/ssh" ];
+ [ task setArguments: arguments ];
// really necessary???
[ environment removeObjectForKey: @"SSH_AGENT_PID" ];
[ environment removeObjectForKey: @"SSH_AUTH_SOCK" ];
[ environment setObject: pathToAuthentifier forKey: @"SSH_ASKPASS" ];
[ environment setObject:@":0" forKey:@"DISPLAY" ];
-
- [ environment setObject: @"Sequel Pro Tunnel" forKey: @"TUNNEL_NAME" ];
- [ task setEnvironment: environment ];
- stdErrPipe = [[ NSPipe alloc ] init ];
- [ task setStandardError: stdErrPipe ];
-
- [[ NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(stdErr:)
+ [ environment setObject: @"Sequel Pro Tunnel" forKey: @"TUNNEL_NAME" ];
+ [ task setEnvironment: environment ];
+
+ stdErrPipe = [[ NSPipe alloc ] init ];
+ [ task setStandardError: stdErrPipe ];
+
+ [[ NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(stdErr:)
name: @"NSFileHandleDataAvailableNotification"
object:[ stdErrPipe fileHandleForReading]];
-
- [[ stdErrPipe fileHandleForReading] waitForDataInBackgroundAndNotify ];
-
- NSLog(T_START,@"Sequel Pro Tunnel");
- [ self setValue: S_CONNECTING forKey: @"status" ];
- [ task launch ];
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
- [ task waitUntilExit ];
- sleep(1);
- [ self setValue: S_IDLE forKey: @"status" ];
- NSLog(T_STOP,@"Sequel Pro Tunnel");
- [[ NSNotificationCenter defaultCenter] removeObserver:self
- name: @"NSFileHandleDataAvailableNotification"
- object:[ stdErrPipe fileHandleForReading]];
- [ task release ];
- task = nil;
- [ stdErrPipe release ];
- stdErrPipe = nil;
- [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
- if (! shouldStop)
+
+ [[ stdErrPipe fileHandleForReading] waitForDataInBackgroundAndNotify ];
+
+ NSLog(T_START,@"Sequel Pro Tunnel");
+ [ self setValue: S_CONNECTING forKey: @"status" ];
+ [ task launch ];
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ [ task waitUntilExit ];
+ sleep(1);
+ [ self setValue: S_IDLE forKey: @"status" ];
+ NSLog(T_STOP,@"Sequel Pro Tunnel");
+ [[ NSNotificationCenter defaultCenter] removeObserver:self
+ name: @"NSFileHandleDataAvailableNotification"
+ object:[ stdErrPipe fileHandleForReading]];
+ [ task release ];
+ task = nil;
+ [ stdErrPipe release ];
+ stdErrPipe = nil;
+ [[ NSNotificationCenter defaultCenter] postNotificationName:@"STMStatusChanged" object:self ];
+ if (! shouldStop)
[ self startTunnel ];
- [ pool release ];
+ [ pool release ];
}
- (void)stdErr:(NSNotification*)aNotification
{
- NSData *data = [[ aNotification object ] availableData ];
- NSString *log = [[ NSString alloc ] initWithData: data encoding: NSASCIIStringEncoding ];
- BOOL wait = YES;
- if ([ log length ])
- {
+ NSData *data = [[ aNotification object ] availableData ];
+ NSString *log = [[ NSString alloc ] initWithData: data encoding: NSASCIIStringEncoding ];
+ BOOL wait = YES;
+ if ([ log length ])
+ {
NSLog(log);
NSArray *lines = [ log componentsSeparatedByString:@"\n" ];
NSEnumerator *e = [ lines objectEnumerator ];
@@ -205,8 +205,8 @@ Modified by Lorenz Textor for use with Sequel Pro
}
if (wait)
[[ stdErrPipe fileHandleForReading ] waitForDataInBackgroundAndNotify ];
- }
- [ log release] ;
+ }
+ [ log release] ;
}
// deallocation
@@ -215,11 +215,11 @@ Modified by Lorenz Textor for use with Sequel Pro
[self stopTunnel];
[task release];
- [stdErrPipe release];
- [status release];
+ [stdErrPipe release];
+ [status release];
[tunnelArguments release];
- [super dealloc];
+ [super dealloc];
}
@end
diff --git a/TableContent.h b/TableContent.h
index 3115a1a6..5302a174 100644
--- a/TableContent.h
+++ b/TableContent.h
@@ -112,7 +112,7 @@
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ row:(int)rowIndex;
- (void)tableView:(NSTableView *)aTableView
setObjectValue:(id)anObject
forTableColumn:(NSTableColumn *)aTableColumn
diff --git a/TableContent.m b/TableContent.m
index 70775a11..6c9c7341 100644
--- a/TableContent.m
+++ b/TableContent.m
@@ -54,170 +54,170 @@
loads aTable, put it in an array, update the tableViewColumns and reload the tableView
*/
{
- int i;
+ int i;
NSNumber *colWidth;
- NSArray *theColumns;
- NSTableColumn *theCol;
- // NSNumberFormatter *numberFormatter;
- NSString *query;
- CMMCPResult *queryResult;
-
- selectedTable = aTable;
- [tableContentView deselectAll:self];
- if ( isEditingRow )
- return;
-
- //query started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
-
- [limitRowsField setStringValue:@"1"];
-
- //reset keys
- if ( keys ) {
- keys = nil;
- }
+ NSArray *theColumns;
+ NSTableColumn *theCol;
+ // NSNumberFormatter *numberFormatter;
+ NSString *query;
+ CMMCPResult *queryResult;
+
+ selectedTable = aTable;
+ [tableContentView deselectAll:self];
+ if ( isEditingRow )
+ return;
+
+ //query started
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+
+ [limitRowsField setStringValue:@"1"];
+
+ //reset keys
+ if ( keys ) {
+ keys = nil;
+ }
[tableContentView scrollRowToVisible:0];
[tableContentView scrollColumnToVisible:0];
- if ( [aTable isEqualToString:@""] || !aTable ) {
+ if ( [aTable isEqualToString:@""] || !aTable ) {
//no table selected
//free tableView
- theColumns = [tableContentView tableColumns];
- while ([theColumns count]) {
- [tableContentView removeTableColumn:[theColumns objectAtIndex:0]];
- }
- // theCol = [[NSTableColumn alloc] initWithIdentifier:@""];
- // [[theCol headerCell] setStringValue:@""];
- // [tableContentView addTableColumn:theCol];
- // [tableContentView sizeLastColumnToFit];
- [fullResult removeAllObjects];
- [filteredResult removeAllObjects];
- [tableContentView reloadData];
- // [theCol release];
+ theColumns = [tableContentView tableColumns];
+ while ([theColumns count]) {
+ [tableContentView removeTableColumn:[theColumns objectAtIndex:0]];
+ }
+ // theCol = [[NSTableColumn alloc] initWithIdentifier:@""];
+ // [[theCol headerCell] setStringValue:@""];
+ // [tableContentView addTableColumn:theCol];
+ // [tableContentView sizeLastColumnToFit];
+ [fullResult removeAllObjects];
+ [filteredResult removeAllObjects];
+ [tableContentView reloadData];
+ // [theCol release];
//disable filter options
- [fieldField setEnabled:NO];
- [fieldField removeAllItems];
- [fieldField addItemWithTitle:NSLocalizedString(@"field", @"popup menuitem for field (showing only if disabled)")];
- [compareField setEnabled:NO];
- [compareField removeAllItems];
- [compareField addItemWithTitle:NSLocalizedString(@"is", @"popup menuitem for field IS value")];
- [argumentField setEnabled:NO];
- [argumentField setStringValue:@""];
- [filterButton setEnabled:NO];
- areShowingAllRows = YES;
+ [fieldField setEnabled:NO];
+ [fieldField removeAllItems];
+ [fieldField addItemWithTitle:NSLocalizedString(@"field", @"popup menuitem for field (showing only if disabled)")];
+ [compareField setEnabled:NO];
+ [compareField removeAllItems];
+ [compareField addItemWithTitle:NSLocalizedString(@"is", @"popup menuitem for field IS value")];
+ [argumentField setEnabled:NO];
+ [argumentField setStringValue:@""];
+ [filterButton setEnabled:NO];
+ areShowingAllRows = YES;
//disable limit fields
- if ( [prefs boolForKey:@"limitRows"] ) {
- [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
[prefs integerForKey:@"limitRowsValue"]]];
- } else {
- [limitRowsField setStringValue:@""];
- [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
- }
- [limitRowsField setEnabled:NO];
- [limitRowsButton setEnabled:NO];
- [limitRowsStepper setEnabled:NO];
+ } else {
+ [limitRowsField setStringValue:@""];
+ [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
+ }
+ [limitRowsField setEnabled:NO];
+ [limitRowsButton setEnabled:NO];
+ [limitRowsStepper setEnabled:NO];
//disable buttons
- [addButton setEnabled:NO];
- [copyButton setEnabled:NO];
- [removeButton setEnabled:NO];
+ [addButton setEnabled:NO];
+ [copyButton setEnabled:NO];
+ [removeButton setEnabled:NO];
- [countText setStringValue:@""];
+ [countText setStringValue:@""];
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
- return;
- }
+ return;
+ }
//make a fast query to get fieldNames and fieldTypes (used in fieldListForQuery method)
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@` LIMIT 0", selectedTable]];
- fieldTypes = [[queryResult fetchTypesAsArray] retain];
- fieldNames = [[queryResult fetchFieldNames] retain];
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@` LIMIT 0", selectedTable]];
+ fieldTypes = [[queryResult fetchTypesAsArray] retain];
+ fieldNames = [[queryResult fetchFieldNames] retain];
//perform query and load result in array (each row as a dictionary)
- // queryResult = [mySQLConnection queryString:[@"SELECT * FROM " stringByAppendingString:selectedTable]];
- query = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
- if ( [prefs boolForKey:@"limitRows"] ) {
- if ( [limitRowsField intValue] <= 0 ) {
- [limitRowsField setStringValue:@"1"];
- }
- query = [query stringByAppendingString:
+ // queryResult = [mySQLConnection queryString:[@"SELECT * FROM " stringByAppendingString:selectedTable]];
+ query = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ if ( [limitRowsField intValue] <= 0 ) {
+ [limitRowsField setStringValue:@"1"];
+ }
+ query = [query stringByAppendingString:
[NSString stringWithFormat:@" LIMIT %d,%d",
[limitRowsField intValue]-1, [prefs integerForKey:@"limitRowsValue"]]];
- }
+ }
// [queryResult release];
- queryResult = [mySQLConnection queryString:query];
- // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
- [fullResult setArray:[self fetchResultAsArray:queryResult]];
- [filteredResult setArray:fullResult];
- // fieldTypes = [[queryResult fetchTypesAsArray] retain];
- // fieldNames = [[queryResult fetchFieldNames] retain];
+ queryResult = [mySQLConnection queryString:query];
+ // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
+ [fullResult setArray:[self fetchResultAsArray:queryResult]];
+ [filteredResult setArray:fullResult];
+ // fieldTypes = [[queryResult fetchTypesAsArray] retain];
+ // fieldNames = [[queryResult fetchFieldNames] retain];
//set count text
numRows = [self getNumberOfRows];
- [countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows in table", @"text showing how many rows are in the result"), numRows]];
+ [countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows in table", @"text showing how many rows are in the result"), numRows]];
//clear sorting
- sortField = nil;
- isDesc = NO;
+ sortField = nil;
+ isDesc = NO;
- if ( queryResult == nil ) {
- NSLog(@"Loading table %@ failed, query string was: %@", aTable, query);
- return;
- }
+ if ( queryResult == nil ) {
+ NSLog(@"Loading table %@ failed, query string was: %@", aTable, query);
+ return;
+ }
//enable and initialize filter fields (with tags for position of menu item and field position)
- [fieldField setEnabled:YES];
- [fieldField removeAllItems];
- [fieldField addItemsWithTitles:fieldNames];
- for ( i = 0 ; i < [fieldField numberOfItems] ; i++ ) {
- [[fieldField itemAtIndex:i] setTag:i];
- }
- [compareField setEnabled:YES];
- [self setCompareTypes:self];
- [argumentField setEnabled:YES];
- [argumentField setStringValue:@""];
- [filterButton setEnabled:YES];
- areShowingAllRows = YES;
+ [fieldField setEnabled:YES];
+ [fieldField removeAllItems];
+ [fieldField addItemsWithTitles:fieldNames];
+ for ( i = 0 ; i < [fieldField numberOfItems] ; i++ ) {
+ [[fieldField itemAtIndex:i] setTag:i];
+ }
+ [compareField setEnabled:YES];
+ [self setCompareTypes:self];
+ [argumentField setEnabled:YES];
+ [argumentField setStringValue:@""];
+ [filterButton setEnabled:YES];
+ areShowingAllRows = YES;
//enable or disable limit fields
- if ( [prefs boolForKey:@"limitRows"] ) {
- [limitRowsField setEnabled:YES];
- [limitRowsButton setEnabled:YES];
- [limitRowsStepper setEnabled:YES];
- [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ [limitRowsField setEnabled:YES];
+ [limitRowsButton setEnabled:YES];
+ [limitRowsStepper setEnabled:YES];
+ [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
[prefs integerForKey:@"limitRowsValue"]]];
- } else {
- [limitRowsField setEnabled:NO];
- [limitRowsButton setEnabled:NO];
- [limitRowsStepper setEnabled:NO];
- [limitRowsField setStringValue:@""];
- [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
- }
+ } else {
+ [limitRowsField setEnabled:NO];
+ [limitRowsButton setEnabled:NO];
+ [limitRowsStepper setEnabled:NO];
+ [limitRowsField setStringValue:@""];
+ [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
+ }
//enable buttons
- [addButton setEnabled:YES];
- [copyButton setEnabled:YES];
- [removeButton setEnabled:YES];
+ [addButton setEnabled:YES];
+ [copyButton setEnabled:YES];
+ [removeButton setEnabled:YES];
//set columns
- //remove all columns from table
- theColumns = [tableContentView tableColumns];
- i=0;
- while ([theColumns count]) {
- [tableContentView removeTableColumn:[theColumns objectAtIndex:0]];
- i++;
- }
-
- //add columns, corresponding to the query result
- theColumns = fieldNames;
- for ( i = 0 ; i < [theColumns count] ; i++ ) {
- theCol = [[NSTableColumn alloc] initWithIdentifier:[theColumns objectAtIndex:i]];
- [theCol setEditable:YES];
+ //remove all columns from table
+ theColumns = [tableContentView tableColumns];
+ i=0;
+ while ([theColumns count]) {
+ [tableContentView removeTableColumn:[theColumns objectAtIndex:0]];
+ i++;
+ }
+
+ //add columns, corresponding to the query result
+ theColumns = fieldNames;
+ for ( i = 0 ; i < [theColumns count] ; i++ ) {
+ theCol = [[NSTableColumn alloc] initWithIdentifier:[theColumns objectAtIndex:i]];
+ [theCol setEditable:YES];
if ( [theCol respondsToSelector:@selector(setResizingMask:)] ) {
// os 10.4
[theCol setResizingMask:NSTableColumnUserResizingMask];
@@ -238,20 +238,20 @@
} else {
dataCell = [[[NSTextFieldCell alloc] initTextCell:@""] autorelease];
}
- [dataCell setEditable:YES];
- // [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- // [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
- } else {
- [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
+ [dataCell setEditable:YES];
+ // [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ // [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [dataCell setFont:[NSFont fontWithName:@"Monaco" size:10]];
+ } else {
+ [dataCell setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
if ( [dataCell respondsToSelector:@selector(setLineBreakMode:)] ) {
// os 10.4
[dataCell setLineBreakMode:NSLineBreakByTruncatingTail];
}
- [theCol setDataCell:dataCell];
- //set date and number formatters
+ [theCol setDataCell:dataCell];
+ //set date and number formatters
/*
if ([[fieldTypes objectAtIndex:i] isEqualToString:@"timestamp"]) {
[[theCol dataCell] setFormatter:[[NSDateFormatter alloc]
@@ -290,28 +290,28 @@
[[theCol dataCell] setFormatter:numberFormatter];
}
*/
- [[theCol headerCell] setStringValue:[theColumns objectAtIndex:i]];
+ [[theCol headerCell] setStringValue:[theColumns objectAtIndex:i]];
// set width of column to saved value if exists
colWidth = [[[[prefs objectForKey:@"tableColumnWidths"] objectForKey:[NSString stringWithFormat:@"%@@%@", [tableDocumentInstance database], [tableDocumentInstance host]]] objectForKey:[tablesListInstance table]] objectForKey:[theColumns objectAtIndex:i]];
if ( colWidth ) {
[theCol setWidth:[colWidth floatValue]];
}
- [tableContentView addTableColumn:theCol];
- [theCol release];
- }
-
- // [tableContentView sizeLastColumnToFit];
- //tries to fix problem with last row (otherwise to small)
- //sets last column to width of the first if smaller than 30
- //problem not fixed for resizing window
- // if ( [[tableContentView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]] width] < 30 )
- // [[tableContentView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]]
- // setWidth:[[tableContentView tableColumnWithIdentifier:[theColumns objectAtIndex:0]] width]];
-
- [tableContentView reloadData];
-
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ [tableContentView addTableColumn:theCol];
+ [theCol release];
+ }
+
+ // [tableContentView sizeLastColumnToFit];
+ //tries to fix problem with last row (otherwise to small)
+ //sets last column to width of the first if smaller than 30
+ //problem not fixed for resizing window
+ // if ( [[tableContentView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]] width] < 30 )
+ // [[tableContentView tableColumnWithIdentifier:[theColumns objectAtIndex:[theColumns count]-1]]
+ // setWidth:[[tableContentView tableColumnWithIdentifier:[theColumns objectAtIndex:0]] width]];
+
+ [tableContentView reloadData];
+
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
}
- (IBAction)reloadTable:(id)sender
@@ -319,7 +319,7 @@
reloads the table (performing a new mysql-query)
*/
{
- [self loadTable:selectedTable];
+ [self loadTable:selectedTable];
}
- (IBAction)reloadTableValues:(id)sender
@@ -327,59 +327,59 @@
reload the table values without reconfiguring the tableView (with filter and limit if set)
*/
{
- NSString *queryString;
- CMMCPResult *queryResult;
+ NSString *queryString;
+ CMMCPResult *queryResult;
- //query started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+ //query started
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
//enable or disable limit fields
- if ( [prefs boolForKey:@"limitRows"] ) {
- [limitRowsField setEnabled:YES];
- [limitRowsButton setEnabled:YES];
- [limitRowsStepper setEnabled:YES];
- [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ [limitRowsField setEnabled:YES];
+ [limitRowsButton setEnabled:YES];
+ [limitRowsStepper setEnabled:YES];
+ [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
[prefs integerForKey:@"limitRowsValue"]]];
- } else {
- [limitRowsField setEnabled:NO];
- [limitRowsButton setEnabled:NO];
- [limitRowsStepper setEnabled:NO];
- [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
- [limitRowsField setStringValue:@""];
- }
-
- // queryString = [@"SELECT * FROM " stringByAppendingString:selectedTable];
- queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
- if ( sortField ) {
- queryString = [NSString stringWithFormat:@"%@ ORDER BY `%@`", queryString, sortField];
- // queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
- if ( isDesc )
- queryString = [queryString stringByAppendingString:@" DESC"];
- }
- if ( [prefs boolForKey:@"limitRows"] ) {
- if ( [limitRowsField intValue] <= 0 ) {
- [limitRowsField setStringValue:@"1"];
- }
- queryString = [queryString stringByAppendingString:
+ } else {
+ [limitRowsField setEnabled:NO];
+ [limitRowsButton setEnabled:NO];
+ [limitRowsStepper setEnabled:NO];
+ [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
+ [limitRowsField setStringValue:@""];
+ }
+
+ // queryString = [@"SELECT * FROM " stringByAppendingString:selectedTable];
+ queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
+ if ( sortField ) {
+ queryString = [NSString stringWithFormat:@"%@ ORDER BY `%@`", queryString, sortField];
+ // queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
+ if ( isDesc )
+ queryString = [queryString stringByAppendingString:@" DESC"];
+ }
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ if ( [limitRowsField intValue] <= 0 ) {
+ [limitRowsField setStringValue:@"1"];
+ }
+ queryString = [queryString stringByAppendingString:
[NSString stringWithFormat:@" LIMIT %d,%d",
[limitRowsField intValue]-1, [prefs integerForKey:@"limitRowsValue"]]];
- [limitRowsField selectText:self];
- }
- queryResult = [mySQLConnection queryString:queryString];
- // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
- [fullResult setArray:[self fetchResultAsArray:queryResult]];
+ [limitRowsField selectText:self];
+ }
+ queryResult = [mySQLConnection queryString:queryString];
+ // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
+ [fullResult setArray:[self fetchResultAsArray:queryResult]];
numRows = [self getNumberOfRows];
- if ( !areShowingAllRows ) {
- [self filterTable:self];
- [countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows of %d selected", @"text showing how many rows are in the filtered result"), [filteredResult count], numRows]];
- } else {
- [filteredResult setArray:fullResult];
- [countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows in table", @"text showing how many rows are in the result"), numRows]];
- }
- [tableContentView reloadData];
-
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ if ( !areShowingAllRows ) {
+ [self filterTable:self];
+ [countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows of %d selected", @"text showing how many rows are in the filtered result"), [filteredResult count], numRows]];
+ } else {
+ [filteredResult setArray:fullResult];
+ [countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows in table", @"text showing how many rows are in the result"), numRows]];
+ }
+ [tableContentView reloadData];
+
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
}
/**
@@ -480,9 +480,9 @@
}
}
- // queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@` WHERE `%@` %@ '%@'",
- // [self fieldListForQuery], selectedTable, [fieldField titleOfSelectedItem],
- // compareOperator, argument];
+ // queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@` WHERE `%@` %@ '%@'",
+ // [self fieldListForQuery], selectedTable, [fieldField titleOfSelectedItem],
+ // compareOperator, argument];
if (doQuote) {
//escape special characters
for ( i = 0 ; i < [argument length] ; i++ ) {
@@ -494,14 +494,14 @@
[argument setString:[mySQLConnection prepareString:argument]];
queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@` WHERE `%@` %@ \"%@\"",
[self fieldListForQuery], selectedTable, [fieldField titleOfSelectedItem],
- compareOperator, argument];
+ compareOperator, argument];
} else {
queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@` WHERE `%@` %@ %@",
[self fieldListForQuery], selectedTable, [fieldField titleOfSelectedItem],
compareOperator, argument];
}
if ( sortField ) {
- // queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
+ // queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
queryString = [NSString stringWithFormat:@"%@ ORDER BY `%@`", queryString, sortField];
if ( isDesc )
queryString = [queryString stringByAppendingString:@" DESC"];
@@ -551,25 +551,25 @@
adds an empty row to the table-array and goes into edit mode
*/
{
- NSMutableDictionary *newRow = [NSMutableDictionary dictionary];
- int i;
+ NSMutableDictionary *newRow = [NSMutableDictionary dictionary];
+ int i;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
- for ( i = 0 ; i < [fieldNames count] ; i++ ) {
- // [newRow setObject:[prefs stringForKey:@"nullValue"] forKey:[fieldNames objectAtIndex:i]];
- [newRow setObject:[tableSourceInstance defaultValueForField:[fieldNames objectAtIndex:i]]
+ for ( i = 0 ; i < [fieldNames count] ; i++ ) {
+ // [newRow setObject:[prefs stringForKey:@"nullValue"] forKey:[fieldNames objectAtIndex:i]];
+ [newRow setObject:[tableSourceInstance defaultValueForField:[fieldNames objectAtIndex:i]]
forKey:[fieldNames objectAtIndex:i]];
- }
- [filteredResult addObject:newRow];
-
- isEditingRow = YES;
- isEditingNewRow = YES;
- [tableContentView reloadData];
- [tableContentView selectRow:[tableContentView numberOfRows]-1 byExtendingSelection:NO];
- if ( [multipleLineEditingButton state] == NSOffState )
- [tableContentView editColumn:0 row:[tableContentView numberOfRows]-1 withEvent:nil select:YES];
+ }
+ [filteredResult addObject:newRow];
+
+ isEditingRow = YES;
+ isEditingNewRow = YES;
+ [tableContentView reloadData];
+ [tableContentView selectRow:[tableContentView numberOfRows]-1 byExtendingSelection:NO];
+ if ( [multipleLineEditingButton state] == NSOffState )
+ [tableContentView editColumn:0 row:[tableContentView numberOfRows]-1 withEvent:nil select:YES];
}
- (IBAction)copyRow:(id)sender
@@ -577,39 +577,39 @@
copies a row of the table-array and goes into edit mode
*/
{
- NSMutableDictionary *tempRow;
- CMMCPResult *queryResult;
- NSDictionary *row;
- int i;
-
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
- if ( [tableContentView numberOfSelectedRows] < 1 )
- return;
- if ( [tableContentView numberOfSelectedRows] > 1 ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"You can only copy single rows.", @"message of panel when trying to copy multiple rows"));
- return;
- }
-
- //copy row
- tempRow = [NSMutableDictionary dictionaryWithDictionary:[filteredResult objectAtIndex:[tableContentView selectedRow]]];
- [filteredResult insertObject:tempRow atIndex:[tableContentView selectedRow]+1];
- isEditingRow = YES;
- isEditingNewRow = YES;
- //set autoincrement fields to NULL
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
- for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
- [queryResult dataSeek:i];
- row = [queryResult fetchRowAsDictionary];
- if ( [[row objectForKey:@"Extra"] isEqualToString:@"auto_increment"] ) {
- [tempRow setObject:[prefs stringForKey:@"nullValue"] forKey:[row objectForKey:@"Field"]];
- }
- }
- //select row and go in edit mode
- [tableContentView reloadData];
- [tableContentView selectRow:[tableContentView selectedRow]+1 byExtendingSelection:NO];
- if ( [multipleLineEditingButton state] == NSOffState )
- [tableContentView editColumn:0 row:[tableContentView selectedRow] withEvent:nil select:YES];
+ NSMutableDictionary *tempRow;
+ CMMCPResult *queryResult;
+ NSDictionary *row;
+ int i;
+
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
+ if ( [tableContentView numberOfSelectedRows] < 1 )
+ return;
+ if ( [tableContentView numberOfSelectedRows] > 1 ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"You can only copy single rows.", @"message of panel when trying to copy multiple rows"));
+ return;
+ }
+
+ //copy row
+ tempRow = [NSMutableDictionary dictionaryWithDictionary:[filteredResult objectAtIndex:[tableContentView selectedRow]]];
+ [filteredResult insertObject:tempRow atIndex:[tableContentView selectedRow]+1];
+ isEditingRow = YES;
+ isEditingNewRow = YES;
+ //set autoincrement fields to NULL
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
+ for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
+ [queryResult dataSeek:i];
+ row = [queryResult fetchRowAsDictionary];
+ if ( [[row objectForKey:@"Extra"] isEqualToString:@"auto_increment"] ) {
+ [tempRow setObject:[prefs stringForKey:@"nullValue"] forKey:[row objectForKey:@"Field"]];
+ }
+ }
+ //select row and go in edit mode
+ [tableContentView reloadData];
+ [tableContentView selectRow:[tableContentView selectedRow]+1 byExtendingSelection:NO];
+ if ( [multipleLineEditingButton state] == NSOffState )
+ [tableContentView editColumn:0 row:[tableContentView selectedRow] withEvent:nil select:YES];
}
- (IBAction)removeRow:(id)sender
@@ -617,35 +617,35 @@
asks user if he really wants to delete the selected rows
*/
{
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
- if ( ![tableContentView numberOfSelectedRows] )
- return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
+ if ( ![tableContentView numberOfSelectedRows] )
+ return;
/*
if ( ([tableContentView numberOfSelectedRows] == [self numberOfRowsInTableView:tableContentView]) &&
areShowingAllRows &&
(![prefs boolForKey:@"limitRows"] || ([tableContentView numberOfSelectedRows] < [prefs integerForKey:@"limitRowsValue"])) ) {
*/
- if ( ([tableContentView numberOfSelectedRows] == [tableContentView numberOfRows]) &&
+ if ( ([tableContentView numberOfSelectedRows] == [tableContentView numberOfRows]) &&
(([prefs boolForKey:@"limitRows"] && [tableContentView numberOfSelectedRows] == [self fetchNumberOfRows]) ||
(![prefs boolForKey:@"limitRows"] && [tableContentView numberOfSelectedRows] == [self getNumberOfRows])) ) {
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
nil, @"removeallrows", NSLocalizedString(@"Do you really want to delete all rows?", @"message of panel asking for confirmation for deleting all rows"));
- } else if ( [tableContentView numberOfSelectedRows] == 1 ) {
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ } else if ( [tableContentView numberOfSelectedRows] == 1 ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
nil, @"removerow", NSLocalizedString(@"Do you really want to delete the selected row?", @"message of panel asking for confirmation for deleting the selected row"));
- } else {
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ } else {
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
nil, @"removerow",
[NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the selected %d rows?", @"message of panel asking for confirmation for deleting the selected rows"), [tableContentView numberOfSelectedRows]]);
- }
+ }
}
//editSheet methods
- (IBAction)closeEditSheet:(id)sender
{
- [NSApp stopModalWithCode:[sender tag]];
+ [NSApp stopModalWithCode:[sender tag]];
}
- (IBAction)openEditSheet:(id)sender
@@ -653,26 +653,26 @@
loads a file into the editSheet
*/
{
- NSOpenPanel *panel = [NSOpenPanel openPanel];
-
- if ( [panel runModal] == NSOKButton ) {
- NSString *fileName = [panel filename];
+ NSOpenPanel *panel = [NSOpenPanel openPanel];
+
+ if ( [panel runModal] == NSOKButton ) {
+ NSString *fileName = [panel filename];
- // free old data
- if ( editData != nil ) {
- [editData release];
- }
+ // free old data
+ if ( editData != nil ) {
+ [editData release];
+ }
- // load new data/images
- editData = [[NSData alloc] initWithContentsOfFile:fileName];
- NSImage *image = [[[NSImage alloc] initByReferencingFile:fileName] autorelease];
- NSString *contents = [[NSString stringWithContentsOfFile:fileName] autorelease];
+ // load new data/images
+ editData = [[NSData alloc] initWithContentsOfFile:fileName];
+ NSImage *image = [[[NSImage alloc] initByReferencingFile:fileName] autorelease];
+ NSString *contents = [[NSString stringWithContentsOfFile:fileName] autorelease];
- // set the image preview, string contents and hex representation
- [editImage setImage:image];
- [editTextView setString:contents];
- [hexTextView setString:[self dataToHex:editData]];
- }
+ // set the image preview, string contents and hex representation
+ [editImage setImage:image];
+ [editTextView setString:contents];
+ [hexTextView setString:[self dataToHex:editData]];
+ }
}
- (IBAction)saveEditSheet:(id)sender
@@ -693,7 +693,7 @@
}
if ( [editData respondsToSelector:@selector(writeToFile:atomically:encoding:error:)] ) {
// mac os 10.4 or later
- [editData writeToFile:fileName atomically:YES encoding:[CMMCPConnection encodingForMySQLEncoding:[(NSString *)[tableDocumentInstance encoding] cString]] error:NULL];
+ [editData writeToFile:fileName atomically:YES encoding:[CMMCPConnection encodingForMySQLEncoding:[(NSString *)[tableDocumentInstance encoding] UTF8String]] error:NULL];
} else {
// mac os pre 10.4
[editData writeToFile:fileName atomically:YES];
@@ -706,17 +706,17 @@
invoked when user drag&drops image on imageView
*/
{
- // load new data/images
- if (nil != editData)
- {
- [editData release];
- }
- editData = [[[NSData alloc] initWithContentsOfFile:[sender draggedFilePath]] retain];
- NSString *contents = [NSString stringWithContentsOfFile:[sender draggedFilePath]];
-
- // set the string contents and hex representation
- [editTextView setString:contents];
- [hexTextView setString:[self dataToHex:editData]];
+ // load new data/images
+ if (nil != editData)
+ {
+ [editData release];
+ }
+ editData = [[[NSData alloc] initWithContentsOfFile:[sender draggedFilePath]] retain];
+ NSString *contents = [NSString stringWithContentsOfFile:[sender draggedFilePath]];
+
+ // set the string contents and hex representation
+ [editTextView setString:contents];
+ [hexTextView setString:[self dataToHex:editData]];
}
- (void)textDidChange:(NSNotification *)notification
@@ -724,17 +724,17 @@
invoked when the user changes the string in the editSheet
*/
{
- // clear the image and hex (since i doubt someone can "type" a gif)
- [editImage setImage:nil];
- [hexTextView setString:@""];
-
- // free old data
- if ( editData != nil ) {
- [editData release];
- }
-
- // set edit data to text
- editData = [[editTextView string] retain];
+ // clear the image and hex (since i doubt someone can "type" a gif)
+ [editImage setImage:nil];
+ [hexTextView setString:@""];
+
+ // free old data
+ if ( editData != nil ) {
+ [editData release];
+ }
+
+ // set edit data to text
+ editData = [[editTextView string] retain];
}
- (NSString *)dataToHex:(NSData *)data
@@ -742,86 +742,86 @@
returns the hex representation of the given data
*/
{
- unsigned i;
- unsigned totalLength = [data length];
- int bytesPerLine = 16;
- NSMutableString *retVal = [NSMutableString string];
- unsigned char *nodisplay = "\t\n\r\f";
-
- // get the length of the longest location
- int longest = [(NSString *)[NSString stringWithFormat:@"%X", totalLength - ( totalLength % bytesPerLine )] length];
-
- for ( i = 0; i < totalLength; i += bytesPerLine ) {
- int j;
- NSMutableString *hex = [[NSMutableString alloc] initWithCapacity:(3 * bytesPerLine - 1)];
- NSMutableString *location = [[NSMutableString alloc] initWithCapacity:(longest + 2)];
- NSMutableString *chars = [[NSMutableString alloc] init];
- unsigned char *buffer;
- int buffLength = bytesPerLine;
-
- // add hex value of location
- [location appendString:[NSString stringWithFormat:@"%X", i]];
-
- // pad it
- while( longest > [location length] ) {
- [location insertString:@"0" atIndex:0];
- }
-
- // get the chars from the NSData obj
- if ( i + buffLength >= totalLength ) {
- buffLength = totalLength - i;
- }
- buffer = (unsigned char*) malloc( sizeof( unsigned char ) * buffLength );
- NSRange range = { i, buffLength };
- [data getBytes:buffer range:range];
-
- // build the hex string
- for ( j = 0; j < buffLength; j++ ) {
- unsigned char byte = *(buffer + j);
- if ( byte < 16 ) {
- [hex appendString:@"0"];
- }
- [hex appendString:[NSString stringWithFormat:@"%X", byte]];
- [hex appendString:@" "];
-
- // if the char is undisplayable, replace it with "."
- unsigned char current;
- int count = 0;
- while ( ( current = *(nodisplay + count++) ) > 0 ) {
- if ( current == byte ) {
- *(buffer + j) = '.';
- break;
- }
- }
- }
-
- // add padding to missing hex values.
- for ( j = 0; j < bytesPerLine - buffLength; j++ ) {
- [hex appendString:@" "];
- }
-
- // remove extra ghost characters
- [chars appendString:[NSString stringWithCString:buffer]];
- if ( [chars length] > bytesPerLine ) {
- [chars deleteCharactersInRange:NSMakeRange( bytesPerLine, [chars length] - bytesPerLine )];
- }
-
- // build line
- [retVal appendString:location];
- [retVal appendString:@" "];
- [retVal appendString:hex];
- [retVal appendString:@" "];
- [retVal appendString:chars];
- [retVal appendString:@"\n"];
-
- // clean up
- [hex release];
- [chars release];
- [location release];
- free( buffer );
- }
-
- return retVal;
+ unsigned i;
+ unsigned totalLength = [data length];
+ int bytesPerLine = 16;
+ NSMutableString *retVal = [NSMutableString string];
+ unsigned char *nodisplay = "\t\n\r\f";
+
+ // get the length of the longest location
+ int longest = [(NSString *)[NSString stringWithFormat:@"%X", totalLength - ( totalLength % bytesPerLine )] length];
+
+ for ( i = 0; i < totalLength; i += bytesPerLine ) {
+ int j;
+ NSMutableString *hex = [[NSMutableString alloc] initWithCapacity:(3 * bytesPerLine - 1)];
+ NSMutableString *location = [[NSMutableString alloc] initWithCapacity:(longest + 2)];
+ NSMutableString *chars = [[NSMutableString alloc] init];
+ unsigned char *buffer;
+ int buffLength = bytesPerLine;
+
+ // add hex value of location
+ [location appendString:[NSString stringWithFormat:@"%X", i]];
+
+ // pad it
+ while( longest > [location length] ) {
+ [location insertString:@"0" atIndex:0];
+ }
+
+ // get the chars from the NSData obj
+ if ( i + buffLength >= totalLength ) {
+ buffLength = totalLength - i;
+ }
+ buffer = (unsigned char*) malloc( sizeof( unsigned char ) * buffLength );
+ NSRange range = { i, buffLength };
+ [data getBytes:buffer range:range];
+
+ // build the hex string
+ for ( j = 0; j < buffLength; j++ ) {
+ unsigned char byte = *(buffer + j);
+ if ( byte < 16 ) {
+ [hex appendString:@"0"];
+ }
+ [hex appendString:[NSString stringWithFormat:@"%X", byte]];
+ [hex appendString:@" "];
+
+ // if the char is undisplayable, replace it with "."
+ unsigned char current;
+ int count = 0;
+ while ( ( current = *(nodisplay + count++) ) > 0 ) {
+ if ( current == byte ) {
+ *(buffer + j) = '.';
+ break;
+ }
+ }
+ }
+
+ // add padding to missing hex values.
+ for ( j = 0; j < bytesPerLine - buffLength; j++ ) {
+ [hex appendString:@" "];
+ }
+
+ // remove extra ghost characters
+ [chars appendString:[NSString stringWithCString:buffer]];
+ if ( [chars length] > bytesPerLine ) {
+ [chars deleteCharactersInRange:NSMakeRange( bytesPerLine, [chars length] - bytesPerLine )];
+ }
+
+ // build line
+ [retVal appendString:location];
+ [retVal appendString:@" "];
+ [retVal appendString:hex];
+ [retVal appendString:@" "];
+ [retVal appendString:chars];
+ [retVal appendString:@"\n"];
+
+ // clean up
+ [hex release];
+ [chars release];
+ [location release];
+ free( buffer );
+ }
+
+ return retVal;
}
//getter methods
@@ -830,37 +830,37 @@
returns the current result (as shown in table content view) as array, the first object containing the field names as array, the following objects containing the rows as array
*/
{
- NSArray *tableColumns;
- NSEnumerator *enumerator;
- id tableColumn;
- NSMutableArray *currentResult = [NSMutableArray array];
- NSMutableArray *tempRow = [NSMutableArray array];
- int i;
-
- //load table if not already done
- if ( ![tablesListInstance contentLoaded] ) {
- [self loadTable:(NSString *)[tablesListInstance table]];
- }
-
- tableColumns = [tableContentView tableColumns];
- enumerator = [tableColumns objectEnumerator];
-
- //set field names as first line
- while ( (tableColumn = [enumerator nextObject]) ) {
- [tempRow addObject:[[tableColumn headerCell] stringValue]];
- }
- [currentResult addObject:[NSArray arrayWithArray:tempRow]];
-
- //add rows
- for ( i = 0 ; i < [self numberOfRowsInTableView:nil] ; i++) {
- [tempRow removeAllObjects];
- enumerator = [tableColumns objectEnumerator];
- while ( (tableColumn = [enumerator nextObject]) ) {
- [tempRow addObject:[self tableView:nil objectValueForTableColumn:tableColumn row:i]];
- }
- [currentResult addObject:[NSArray arrayWithArray:tempRow]];
- }
- return currentResult;
+ NSArray *tableColumns;
+ NSEnumerator *enumerator;
+ id tableColumn;
+ NSMutableArray *currentResult = [NSMutableArray array];
+ NSMutableArray *tempRow = [NSMutableArray array];
+ int i;
+
+ //load table if not already done
+ if ( ![tablesListInstance contentLoaded] ) {
+ [self loadTable:(NSString *)[tablesListInstance table]];
+ }
+
+ tableColumns = [tableContentView tableColumns];
+ enumerator = [tableColumns objectEnumerator];
+
+ //set field names as first line
+ while ( (tableColumn = [enumerator nextObject]) ) {
+ [tempRow addObject:[[tableColumn headerCell] stringValue]];
+ }
+ [currentResult addObject:[NSArray arrayWithArray:tempRow]];
+
+ //add rows
+ for ( i = 0 ; i < [self numberOfRowsInTableView:nil] ; i++) {
+ [tempRow removeAllObjects];
+ enumerator = [tableColumns objectEnumerator];
+ while ( (tableColumn = [enumerator nextObject]) ) {
+ [tempRow addObject:[self tableView:nil objectValueForTableColumn:tableColumn row:i]];
+ }
+ [currentResult addObject:[NSArray arrayWithArray:tempRow]];
+ }
+ return currentResult;
}
@@ -870,27 +870,27 @@
sets the connection (received from TableDocument) and makes things that have to be done only once
*/
{
- mySQLConnection = theConnection;
+ mySQLConnection = theConnection;
[tableContentView setVerticalMotionCanBeginDrag:NO];
- prefs = [[NSUserDefaults standardUserDefaults] retain];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [argumentField setFont:[NSFont fontWithName:@"Monaco" size:10]];
- [limitRowsField setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [editTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [editTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- [hexTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [limitRowsStepper setEnabled:NO];
- if ( [prefs boolForKey:@"limitRows"] ) {
- [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
+ prefs = [[NSUserDefaults standardUserDefaults] retain];
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [argumentField setFont:[NSFont fontWithName:@"Monaco" size:10]];
+ [limitRowsField setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [editTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ } else {
+ [editTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+ [hexTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [limitRowsStepper setEnabled:NO];
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ [limitRowsText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Limited to %d rows starting with row", @"text showing the number of rows the result is limited to"),
[prefs integerForKey:@"limitRowsValue"]]];
- } else {
- [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
- [limitRowsField setStringValue:@""];
- }
+ } else {
+ [limitRowsText setStringValue:NSLocalizedString(@"No limit", @"text showing that the result isn't limited")];
+ [limitRowsField setStringValue:@""];
+ }
}
- (IBAction)setCompareTypes:(id)sender
@@ -898,34 +898,34 @@
sets the compare types for the filter and the appropriate formatter for the textField
*/
{
- NSArray *stringFields = [NSArray arrayWithObjects:@"varstring", @"string", @"tinyblob", @"blob", @"mediumblob", @"longblob", @"set", @"enum", nil];
- NSArray *stringTypes = [NSArray arrayWithObjects:NSLocalizedString(@"is", @"popup menuitem for field IS value"), NSLocalizedString(@"is not", @"popup menuitem for field IS NOT value"), NSLocalizedString(@"contains", @"popup menuitem for field CONTAINS value"), NSLocalizedString(@"contains not", @"popup menuitem for field CONTAINS NOT value"), @"IN", nil];
- NSArray *numberFields = [NSArray arrayWithObjects:@"tiny", @"short", @"long", @"int24", @"longlong", @"decimal", @"float", @"double", nil];
- NSArray *numberTypes = [NSArray arrayWithObjects:@"=", @"­", @">", @"<", @"³", @"²", @"IN", nil];
- NSArray *dateFields = [NSArray arrayWithObjects:@"timestamp", @"date", @"time", @"datetime", @"year", nil];
- NSArray *dateTypes = [NSArray arrayWithObjects:NSLocalizedString(@"is", @"popup menuitem for field IS value"), NSLocalizedString(@"is not", @"popup menuitem for field IS NOT value"), NSLocalizedString(@"older than", @"popup menuitem for field OLDER THAN value"), NSLocalizedString(@"younger than", @"popup menuitem for field YOUNGER THAN value"), NSLocalizedString(@"older than or equal to", @"popup menuitem for field OLDER THAN OR EQUAL TO value"), NSLocalizedString(@"younger than or equal to", @"popup menuitem for field YOUNGER THAN OR EQUAL TO value"), nil];
- NSString *fieldType = [NSString stringWithString:[fieldTypes objectAtIndex:[[fieldField selectedItem] tag]]];
- // NSNumberFormatter *numberFormatter;
- int i;
-
- // numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
- // [numberFormatter setFormat:@"0.####################"];
-
- [compareField removeAllItems];
- // [argumentField setStringValue:@""];
-
+ NSArray *stringFields = [NSArray arrayWithObjects:@"varstring", @"string", @"tinyblob", @"blob", @"mediumblob", @"longblob", @"set", @"enum", nil];
+ NSArray *stringTypes = [NSArray arrayWithObjects:NSLocalizedString(@"is", @"popup menuitem for field IS value"), NSLocalizedString(@"is not", @"popup menuitem for field IS NOT value"), NSLocalizedString(@"contains", @"popup menuitem for field CONTAINS value"), NSLocalizedString(@"contains not", @"popup menuitem for field CONTAINS NOT value"), @"IN", nil];
+ NSArray *numberFields = [NSArray arrayWithObjects:@"tiny", @"short", @"long", @"int24", @"longlong", @"decimal", @"float", @"double", nil];
+ NSArray *numberTypes = [NSArray arrayWithObjects:@"=", @"≠", @">", @"<", @"≥", @"≤", @"IN", nil];
+ NSArray *dateFields = [NSArray arrayWithObjects:@"timestamp", @"date", @"time", @"datetime", @"year", nil];
+ NSArray *dateTypes = [NSArray arrayWithObjects:NSLocalizedString(@"is", @"popup menuitem for field IS value"), NSLocalizedString(@"is not", @"popup menuitem for field IS NOT value"), NSLocalizedString(@"older than", @"popup menuitem for field OLDER THAN value"), NSLocalizedString(@"younger than", @"popup menuitem for field YOUNGER THAN value"), NSLocalizedString(@"older than or equal to", @"popup menuitem for field OLDER THAN OR EQUAL TO value"), NSLocalizedString(@"younger than or equal to", @"popup menuitem for field YOUNGER THAN OR EQUAL TO value"), nil];
+ NSString *fieldType = [NSString stringWithString:[fieldTypes objectAtIndex:[[fieldField selectedItem] tag]]];
+ // NSNumberFormatter *numberFormatter;
+ int i;
+
+ // numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
+ // [numberFormatter setFormat:@"0.####################"];
+
+ [compareField removeAllItems];
+ // [argumentField setStringValue:@""];
+
//why do we get "string" for enum fields? (error in framework?)
- if ( [stringFields containsObject:fieldType] ) {
- [compareField addItemsWithTitles:stringTypes];
- compareType = @"string";
- // [argumentField setFormatter:nil];
- } else if ( [numberFields containsObject:fieldType] ) {
- [compareField addItemsWithTitles:numberTypes];
- compareType = @"number";
- // [argumentField setFormatter:numberFormatter];
- } else if ( [dateFields containsObject:fieldType] ) {
- [compareField addItemsWithTitles:dateTypes];
- compareType = @"date";
+ if ( [stringFields containsObject:fieldType] ) {
+ [compareField addItemsWithTitles:stringTypes];
+ compareType = @"string";
+ // [argumentField setFormatter:nil];
+ } else if ( [numberFields containsObject:fieldType] ) {
+ [compareField addItemsWithTitles:numberTypes];
+ compareType = @"number";
+ // [argumentField setFormatter:numberFormatter];
+ } else if ( [dateFields containsObject:fieldType] ) {
+ [compareField addItemsWithTitles:dateTypes];
+ compareType = @"date";
/*
if ([fieldType isEqualToString:@"timestamp"]) {
[argumentField setFormatter:[[NSDateFormatter alloc]
@@ -944,16 +944,16 @@
[argumentField setFormatter:[[NSDateFormatter alloc] initWithDateFormat:@"%Y" allowNaturalLanguage:YES]];
}
*/
- } else {
- NSLog(@"ERROR: unknown type for comparision: %@", fieldType);
- }
+ } else {
+ NSLog(@"ERROR: unknown type for comparision: %@", fieldType);
+ }
- for ( i = 0 ; i < [compareField numberOfItems] ; i++ ) {
- [[compareField itemAtIndex:i] setTag:i];
- }
+ for ( i = 0 ; i < [compareField numberOfItems] ; i++ ) {
+ [[compareField itemAtIndex:i] setTag:i];
+ }
// set focus on argumentField
- [argumentField selectText:self];
+ [argumentField selectText:self];
}
- (IBAction)stepLimitRows:(id)sender
@@ -961,16 +961,16 @@
steps the start row up or down (+/- limitRowsValue)
*/
{
- if ( [limitRowsStepper intValue] > 0 ) {
- [limitRowsField setIntValue:[limitRowsField intValue]+[prefs integerForKey:@"limitRowsValue"]];
- } else {
- if ( ([limitRowsField intValue]-[prefs integerForKey:@"limitRowsValue"]) < 1 ) {
- [limitRowsField setIntValue:1];
- } else {
- [limitRowsField setIntValue:[limitRowsField intValue]-[prefs integerForKey:@"limitRowsValue"]];
- }
- }
- [limitRowsStepper setIntValue:0];
+ if ( [limitRowsStepper intValue] > 0 ) {
+ [limitRowsField setIntValue:[limitRowsField intValue]+[prefs integerForKey:@"limitRowsValue"]];
+ } else {
+ if ( ([limitRowsField intValue]-[prefs integerForKey:@"limitRowsValue"]) < 1 ) {
+ [limitRowsField setIntValue:1];
+ } else {
+ [limitRowsField setIntValue:[limitRowsField intValue]-[prefs integerForKey:@"limitRowsValue"]];
+ }
+ }
+ [limitRowsStepper setIntValue:0];
}
- (NSArray *)fetchResultAsArray:(CMMCPResult *)theResult
@@ -978,20 +978,20 @@
fetches the result as an array with a dictionary for each row in it
*/
{
- NSMutableArray *tempResult = [NSMutableArray array];
- NSDictionary *tempRow;
- NSMutableDictionary *modifiedRow = [NSMutableDictionary dictionary];
- NSEnumerator *enumerator;
- id key;
- int i,j;
-
- for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
- tempRow = [theResult fetchRowAsDictionary];
- enumerator = [tempRow keyEnumerator];
- while ( key = [enumerator nextObject] ) {
- if ( [[tempRow objectForKey:key] isMemberOfClass:[NSNull class]] ) {
- [modifiedRow setObject:[prefs stringForKey:@"nullValue"] forKey:key];
+ NSMutableArray *tempResult = [NSMutableArray array];
+ NSDictionary *tempRow;
+ NSMutableDictionary *modifiedRow = [NSMutableDictionary dictionary];
+ NSEnumerator *enumerator;
+ id key;
+ int i,j;
+
+ for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
+ [theResult dataSeek:i];
+ tempRow = [theResult fetchRowAsDictionary];
+ enumerator = [tempRow keyEnumerator];
+ while ( key = [enumerator nextObject] ) {
+ if ( [[tempRow objectForKey:key] isMemberOfClass:[NSNull class]] ) {
+ [modifiedRow setObject:[prefs stringForKey:@"nullValue"] forKey:key];
/*
//NSData objects now decoded in tableView:objectValueForTableColumn:row
//object in result remains a NSData object
@@ -999,21 +999,21 @@
[modifiedRow setObject:[[NSString alloc] initWithData:[tempRow objectForKey:key] encoding:[mySQLConnection encoding]]
forKey:key];
*/
- } else {
- [modifiedRow setObject:[tempRow objectForKey:key] forKey:key];
- }
- //add values for hidden blob and text fields
- if ( [prefs boolForKey:@"dontShowBlob"] ) {
- for ( j = 0 ; j < [fieldTypes count] ; j++ ) {
- if ( [self isBlobOrText:[fieldTypes objectAtIndex:j]] ) {
- [modifiedRow setObject:NSLocalizedString(@"- blob or text -", @"value shown for hidden blob and text fields") forKey:[fieldNames objectAtIndex:j]];
- }
- }
- }
- }
- [tempResult addObject:[NSMutableDictionary dictionaryWithDictionary:modifiedRow]];
- }
- return tempResult;
+ } else {
+ [modifiedRow setObject:[tempRow objectForKey:key] forKey:key];
+ }
+ //add values for hidden blob and text fields
+ if ( [prefs boolForKey:@"dontShowBlob"] ) {
+ for ( j = 0 ; j < [fieldTypes count] ; j++ ) {
+ if ( [self isBlobOrText:[fieldTypes objectAtIndex:j]] ) {
+ [modifiedRow setObject:NSLocalizedString(@"- blob or text -", @"value shown for hidden blob and text fields") forKey:[fieldNames objectAtIndex:j]];
+ }
+ }
+ }
+ }
+ [tempResult addObject:[NSMutableDictionary dictionaryWithDictionary:modifiedRow]];
+ }
+ return tempResult;
}
- (BOOL)addRowToDB
@@ -1023,51 +1023,51 @@
returns YES if no row is beeing edited and nothing has to be written to db
*/
{
- int rowIndex = [tableContentView selectedRow];
- NSMutableArray *fieldValues = [[NSMutableArray alloc] init];
- NSMutableString *queryString;
- NSString *query;
- CMMCPResult *queryResult;
- id rowObject;
- NSMutableString *rowValue = [NSMutableString string];
- NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil];
- int i;
-
- if ( !isEditingRow || rowIndex == -1) {
- [fieldValues release];
- return YES;
- }
+ int rowIndex = [tableContentView selectedRow];
+ NSMutableArray *fieldValues = [[NSMutableArray alloc] init];
+ NSMutableString *queryString;
+ NSString *query;
+ CMMCPResult *queryResult;
+ id rowObject;
+ NSMutableString *rowValue = [NSMutableString string];
+ NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil];
+ int i;
+
+ if ( !isEditingRow || rowIndex == -1) {
+ [fieldValues release];
+ return YES;
+ }
//get field values
- for ( i=0 ; i < [fieldNames count] ; i++) {
- rowObject = [[filteredResult objectAtIndex:rowIndex] objectForKey:[fieldNames objectAtIndex:i]];
+ for ( i=0 ; i < [fieldNames count] ; i++) {
+ rowObject = [[filteredResult objectAtIndex:rowIndex] objectForKey:[fieldNames objectAtIndex:i]];
//convert the object to a string (here we can add special treatment for date-, number- and data-fields)
- if ( [[rowObject description] isEqualToString:[prefs stringForKey:@"nullValue"]] ||
- ([rowObject isMemberOfClass:[NSConstantString class]] && [[rowObject description] isEqualToString:@""]) ) {
+ if ( [[rowObject description] isEqualToString:[prefs stringForKey:@"nullValue"]] ||
+ ([rowObject isMemberOfClass:[NSString class]] && [[rowObject description] isEqualToString:@""]) ) {
//NULL when user entered the nullValue string defined in the prefs or when a number field isn't set
// problem: when a number isn't set, sequel-pro enters 0
// -> second if argument isn't necessary!
- [rowValue setString:@"NULL"];
+ [rowValue setString:@"NULL"];
} else {
- if ( [rowObject isKindOfClass:[NSCalendarDate class]] ) {
- // [rowValue setString:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareString:[rowObject description]]]];
- [rowValue setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:[rowObject description]]]];
- } else if ( [rowObject isKindOfClass:[NSNumber class]] ) {
- [rowValue setString:[rowObject stringValue]];
- } else if ( [rowObject isKindOfClass:[NSData class]] ) {
+ if ( [rowObject isKindOfClass:[NSCalendarDate class]] ) {
+ // [rowValue setString:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareString:[rowObject description]]]];
+ [rowValue setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:[rowObject description]]]];
+ } else if ( [rowObject isKindOfClass:[NSNumber class]] ) {
+ [rowValue setString:[rowObject stringValue]];
+ } else if ( [rowObject isKindOfClass:[NSData class]] ) {
//problem: if a blob field is edited, it becomes a string and is not more prepared as binary data
// but probably blob fields are corrupted before, when they decoded in the tableView method
- // [rowValue setString:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareBinaryData:rowObject]]];
- [rowValue setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareBinaryData:rowObject]]];
- } else {
- // [rowValue setString:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareString:[rowObject description]]]];
+ // [rowValue setString:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareBinaryData:rowObject]]];
+ [rowValue setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareBinaryData:rowObject]]];
+ } else {
+ // [rowValue setString:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareString:[rowObject description]]]];
if ( [[rowObject description] isEqualToString:@"CURRENT_TIMESTAMP"] ) {
[rowValue setString:@"CURRENT_TIMESTAMP"];
} else {
[rowValue setString:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:[rowObject description]]]];
}
- }
- }
+ }
+ }
//escape special characters -> now escaped by framework
/*
for ( j = 0 ; j < [rowValue length] ; j++ ) {
@@ -1080,100 +1080,100 @@
}
}
*/
- [fieldValues addObject:[NSString stringWithString:rowValue]];
- }
+ [fieldValues addObject:[NSString stringWithString:rowValue]];
+ }
- if ( isEditingNewRow ) {
+ if ( isEditingNewRow ) {
//INSERT syntax
- queryString = [NSString stringWithFormat:@"INSERT INTO `%@` (`%@`) VALUES (%@)",
+ queryString = [NSString stringWithFormat:@"INSERT INTO `%@` (`%@`) VALUES (%@)",
selectedTable, [fieldNames componentsJoinedByString:@"`,`"], [fieldValues componentsJoinedByString:@","]];
- } else {
+ } else {
//UPDATE syntax
- queryString = [NSMutableString stringWithFormat:@"UPDATE `%@` SET ", selectedTable];
- for ( i = 0 ; i < [fieldNames count] ; i++ ) {
- if ( i > 0 ) {
- [queryString appendString:@", "];
- }
- [queryString appendString:[NSString stringWithFormat:@"`%@`=%@",
+ queryString = [NSMutableString stringWithFormat:@"UPDATE `%@` SET ", selectedTable];
+ for ( i = 0 ; i < [fieldNames count] ; i++ ) {
+ if ( i > 0 ) {
+ [queryString appendString:@", "];
+ }
+ [queryString appendString:[NSString stringWithFormat:@"`%@`=%@",
[fieldNames objectAtIndex:i], [fieldValues objectAtIndex:i]]];
- }
- [fieldValues release];
- [queryString appendString:[NSString stringWithFormat:@" WHERE %@", [self argumentForRow:-2]]];
- }
- [mySQLConnection queryString:queryString];
+ }
+ [fieldValues release];
+ [queryString appendString:[NSString stringWithFormat:@" WHERE %@", [self argumentForRow:-2]]];
+ }
+ [mySQLConnection queryString:queryString];
//NSLog( @"%@", queryString );
- if ( ![mySQLConnection affectedRows] ) {
+ if ( ![mySQLConnection affectedRows] ) {
//no rows changed
- if ( [prefs boolForKey:@"showError"] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ if ( [prefs boolForKey:@"showError"] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"The row was not written to the MySQL database. You probably haven't changed anything.\nReload the table to be sure that the row exists and use a primary key for your table.\n(This error can be turned off in the preferences.)", @"message of panel when no rows have been affected after writing to the db"));
- } else {
- NSBeep();
- }
- [filteredResult replaceObjectAtIndex:rowIndex withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
- isEditingRow = NO;
- isEditingNewRow = NO;
- [tableDocumentInstance showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]];
- return YES;
- } else if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ } else {
+ NSBeep();
+ }
+ [filteredResult replaceObjectAtIndex:rowIndex withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
+ isEditingRow = NO;
+ isEditingNewRow = NO;
+ [tableDocumentInstance showErrorInConsole:[NSString stringWithFormat:NSLocalizedString(@"/* WARNING %@ No rows have been affected */\n", @"warning shown in the console when no rows have been affected after writing to the db"), currentTime]];
+ return YES;
+ } else if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
//added new row with success
- isEditingRow = NO;
- if ( isEditingNewRow ) {
- if ( [prefs boolForKey:@"reloadAfterAdding"] ) {
- [self reloadTableValues:self];
- // if ( sortField )
- [tableContentView deselectAll:self];
- } else {
+ isEditingRow = NO;
+ if ( isEditingNewRow ) {
+ if ( [prefs boolForKey:@"reloadAfterAdding"] ) {
+ [self reloadTableValues:self];
+ // if ( sortField )
+ [tableContentView deselectAll:self];
+ } else {
//set insertId for fields with auto_increment
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
- for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
- [queryResult dataSeek:i];
- rowObject = [queryResult fetchRowAsDictionary];
- if ( [[rowObject objectForKey:@"Extra"] isEqualToString:@"auto_increment"] ) {
- [[filteredResult objectAtIndex:rowIndex] setObject:[NSNumber numberWithLong:[mySQLConnection insertId]]
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
+ for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
+ [queryResult dataSeek:i];
+ rowObject = [queryResult fetchRowAsDictionary];
+ if ( [[rowObject objectForKey:@"Extra"] isEqualToString:@"auto_increment"] ) {
+ [[filteredResult objectAtIndex:rowIndex] setObject:[NSNumber numberWithLong:[mySQLConnection insertId]]
forKey:[rowObject objectForKey:@"Field"]];
- }
- }
- [fullResult addObject:[filteredResult objectAtIndex:rowIndex]];
- }
- isEditingNewRow = NO;
- } else {
+ }
+ }
+ [fullResult addObject:[filteredResult objectAtIndex:rowIndex]];
+ }
+ isEditingNewRow = NO;
+ } else {
//updated row with success
- if ( [prefs boolForKey:@"reloadAfterEditing"] ) {
- [self reloadTableValues:self];
- // if ( sortField )
- [tableContentView deselectAll:self];
- } else {
- // query = [@"SELECT * FROM " stringByAppendingString:selectedTable];
- query = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
- if ( sortField ) {
- // query = [query stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
- query = [NSString stringWithFormat:@"%@ ORDER BY `%@`", query, sortField];
- if ( isDesc )
- query = [query stringByAppendingString:@" DESC"];
- }
- if ( [prefs boolForKey:@"limitRows"] ) {
- if ( [limitRowsField intValue] <= 0 ) {
- [limitRowsField setStringValue:@"1"];
- }
- query = [query stringByAppendingString:
+ if ( [prefs boolForKey:@"reloadAfterEditing"] ) {
+ [self reloadTableValues:self];
+ // if ( sortField )
+ [tableContentView deselectAll:self];
+ } else {
+ // query = [@"SELECT * FROM " stringByAppendingString:selectedTable];
+ query = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
+ if ( sortField ) {
+ // query = [query stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
+ query = [NSString stringWithFormat:@"%@ ORDER BY `%@`", query, sortField];
+ if ( isDesc )
+ query = [query stringByAppendingString:@" DESC"];
+ }
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ if ( [limitRowsField intValue] <= 0 ) {
+ [limitRowsField setStringValue:@"1"];
+ }
+ query = [query stringByAppendingString:
[NSString stringWithFormat:@" LIMIT %d,%d",
[limitRowsField intValue]-1, [prefs integerForKey:@"limitRowsValue"]]];
- }
- queryResult = [mySQLConnection queryString:query];
- // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
- [fullResult setArray:[self fetchResultAsArray:queryResult]];
- }
- }
- return YES;
- } else {
+ }
+ queryResult = [mySQLConnection queryString:query];
+ // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
+ [fullResult setArray:[self fetchResultAsArray:queryResult]];
+ }
+ }
+ return YES;
+ } else {
//error in mysql-query
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addrow",
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addrow",
[NSString stringWithFormat:NSLocalizedString(@"Couldn't write row.\nMySQL said: %@", @"message of panel when error while adding row to db"), [mySQLConnection getLastErrorMessage]]);
- return NO;
- }
+ return NO;
+ }
}
- (NSString *)argumentForRow:(int)row
@@ -1183,19 +1183,19 @@
if there is one, it uses the primary key, otherwise uses all fields as argument and sets LIMIT to 1
*/
{
- CMMCPResult *theResult;
- NSDictionary *theRow;
- id tempValue;
- NSMutableString *value = [NSMutableString string];
- NSMutableString *argument = [NSMutableString string];
- int i,j;
- NSEnumerator *enumerator;
- id type;
- BOOL blob = NO;
- NSArray *numberFields = [NSArray arrayWithObjects:@"tiny", @"short", @"long", @"int24", @"longlong", @"decimal", @"float", @"double", nil];
-
- if ( row == -1 )
- return @"";
+ CMMCPResult *theResult;
+ NSDictionary *theRow;
+ id tempValue;
+ NSMutableString *value = [NSMutableString string];
+ NSMutableString *argument = [NSMutableString string];
+ int i,j;
+ NSEnumerator *enumerator;
+ id type;
+ BOOL blob = NO;
+ NSArray *numberFields = [NSArray arrayWithObjects:@"tiny", @"short", @"long", @"int24", @"longlong", @"decimal", @"float", @"double", nil];
+
+ if ( row == -1 )
+ return @"";
//get primary key if there is one
/*
@@ -1208,88 +1208,88 @@
}
}
*/
- if ( !keys ) {
- setLimit = NO;
- keys = [[NSMutableArray alloc] init];
- theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
- for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
- theRow = [theResult fetchRowAsDictionary];
- if ( [[theRow objectForKey:@"Key"] isEqualToString:@"PRI"] ) {
- [keys addObject:[theRow objectForKey:@"Field"]];
- }
- }
- }
-
- if ( ![keys count] ) {
+ if ( !keys ) {
+ setLimit = NO;
+ keys = [[NSMutableArray alloc] init];
+ theResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]];
+ for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
+ [theResult dataSeek:i];
+ theRow = [theResult fetchRowAsDictionary];
+ if ( [[theRow objectForKey:@"Key"] isEqualToString:@"PRI"] ) {
+ [keys addObject:[theRow objectForKey:@"Field"]];
+ }
+ }
+ }
+
+ if ( ![keys count] ) {
//if there is no primary key, take all fields as argument
//here we have a problem when dontShowBlob == YES (we don't have the right values to use in the WHERE statement)
- [keys setArray:fieldNames];
- setLimit = YES;
- enumerator = [fieldTypes objectEnumerator];
- while ( (type = [enumerator nextObject]) ) {
- if ( [self isBlobOrText:type] ) {
- blob = YES;
- }
- }
- if ( [prefs boolForKey:@"dontShowBlob"] && blob ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [keys setArray:fieldNames];
+ setLimit = YES;
+ enumerator = [fieldTypes objectEnumerator];
+ while ( (type = [enumerator nextObject]) ) {
+ if ( [self isBlobOrText:type] ) {
+ blob = YES;
+ }
+ }
+ if ( [prefs boolForKey:@"dontShowBlob"] && blob ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"You can't hide blob and text fields when working with tables without index.", @"message of panel when trying to edit tables without index and with hidden blob/text fields"));
- [keys removeAllObjects];
- [tableContentView deselectAll:self];
- return @"";
- }
- }
- for ( i = 0 ; i < [keys count] ; i++ ) {
- if ( i )
- [argument appendString:@" AND "];
- if ( row >= 0 ) {
+ [keys removeAllObjects];
+ [tableContentView deselectAll:self];
+ return @"";
+ }
+ }
+ for ( i = 0 ; i < [keys count] ; i++ ) {
+ if ( i )
+ [argument appendString:@" AND "];
+ if ( row >= 0 ) {
//use selected row
- tempValue = [[filteredResult objectAtIndex:row] objectForKey:[keys objectAtIndex:i]];
- } else {
+ tempValue = [[filteredResult objectAtIndex:row] objectForKey:[keys objectAtIndex:i]];
+ } else {
//use oldRow
- tempValue = [oldRow objectForKey:[keys objectAtIndex:i]];
- }
- if ( [tempValue isKindOfClass:[NSData class]] ) {
- [value setString:[[NSString alloc] initWithData:tempValue encoding:[mySQLConnection encoding]]];
- } else {
- [value setString:[tempValue description]];
- }
-
- if ( [value isEqualToString:[prefs stringForKey:@"nullValue"]] ) {
- [value setString:@"NULL"];
- } else {
- //escape special characters (in WHERE statement!)
- for ( j = 0 ; j < [value length] ; j++ ) {
- if ( [value characterAtIndex:j] == '\\' ) {
- [value insertString:@"\\" atIndex:j];
- j++;
- }
- }
- [value setString:[mySQLConnection prepareString:value]];
- for ( j = 0 ; j < [value length] ; j++ ) {
- if ( [value characterAtIndex:j] == '%' ||
+ tempValue = [oldRow objectForKey:[keys objectAtIndex:i]];
+ }
+ if ( [tempValue isKindOfClass:[NSData class]] ) {
+ [value setString:[[NSString alloc] initWithData:tempValue encoding:[mySQLConnection encoding]]];
+ } else {
+ [value setString:[tempValue description]];
+ }
+
+ if ( [value isEqualToString:[prefs stringForKey:@"nullValue"]] ) {
+ [value setString:@"NULL"];
+ } else {
+ //escape special characters (in WHERE statement!)
+ for ( j = 0 ; j < [value length] ; j++ ) {
+ if ( [value characterAtIndex:j] == '\\' ) {
+ [value insertString:@"\\" atIndex:j];
+ j++;
+ }
+ }
+ [value setString:[mySQLConnection prepareString:value]];
+ for ( j = 0 ; j < [value length] ; j++ ) {
+ if ( [value characterAtIndex:j] == '%' ||
[value characterAtIndex:j] == '_' ) {
- [value insertString:@"\\" atIndex:j];
- j++;
- }
- }
- // [value setString:[NSString stringWithFormat:@"\"%@\"", value]];
- [value setString:[NSString stringWithFormat:@"'%@'", value]];
- }
- if ( [value isEqualToString:@"NULL"] ) {
- [argument appendString:[NSString stringWithFormat:@"`%@` IS NULL", [keys objectAtIndex:i]]];
- } else {
- if ( [numberFields containsObject:[fieldTypes objectAtIndex:[fieldNames indexOfObject:[keys objectAtIndex:i]]]] ) {
- [argument appendString:[NSString stringWithFormat:@"`%@` = %@", [keys objectAtIndex:i], value]];
- } else {
- [argument appendString:[NSString stringWithFormat:@"`%@` LIKE %@", [keys objectAtIndex:i], value]];
- }
- }
- }
- if ( setLimit )
- [argument appendString:@" LIMIT 1"];
- return argument;
+ [value insertString:@"\\" atIndex:j];
+ j++;
+ }
+ }
+ // [value setString:[NSString stringWithFormat:@"\"%@\"", value]];
+ [value setString:[NSString stringWithFormat:@"'%@'", value]];
+ }
+ if ( [value isEqualToString:@"NULL"] ) {
+ [argument appendString:[NSString stringWithFormat:@"`%@` IS NULL", [keys objectAtIndex:i]]];
+ } else {
+ if ( [numberFields containsObject:[fieldTypes objectAtIndex:[fieldNames indexOfObject:[keys objectAtIndex:i]]]] ) {
+ [argument appendString:[NSString stringWithFormat:@"`%@` = %@", [keys objectAtIndex:i], value]];
+ } else {
+ [argument appendString:[NSString stringWithFormat:@"`%@` LIKE %@", [keys objectAtIndex:i], value]];
+ }
+ }
+ }
+ if ( setLimit )
+ [argument appendString:@" LIMIT 1"];
+ return argument;
}
- (BOOL)isBlobOrText:(NSString *)fieldType
@@ -1298,12 +1298,12 @@
it would be nice to know if it is blob or text, but mysql doesn't want to tell it...
*/
{
- if ( [fieldType isEqualToString:@"tinyblob"] || [fieldType isEqualToString:@"blob"] ||
+ if ( [fieldType isEqualToString:@"tinyblob"] || [fieldType isEqualToString:@"blob"] ||
[fieldType isEqualToString:@"mediumblob"] || [fieldType isEqualToString:@"longblob"] ) {
- return YES;
- } else {
- return NO;
- }
+ return YES;
+ } else {
+ return NO;
+ }
}
- (NSString *)fieldListForQuery
@@ -1312,23 +1312,23 @@
returns a comma-separated list of all fields which aren't of type blob or text if dontShowBlob == YES
*/
{
- int i;
- NSMutableArray *fields = [NSMutableArray array];
-
- if ( [prefs boolForKey:@"dontShowBlob"] ) {
- for ( i = 0 ; i < [fieldTypes count] ; i++ ) {
- if ( ![self isBlobOrText:[fieldTypes objectAtIndex:i]] ) {
- [fields addObject:[fieldNames objectAtIndex:i]];
- }
- }
- if ( [fields count] == 0 ) {
- return [NSString stringWithFormat:@"`%@`", [fieldNames objectAtIndex:0]];
- } else {
- return [NSString stringWithFormat:@"`%@`", [fields componentsJoinedByString:@"`,`"]];
- }
- } else {
- return @"*";
- }
+ int i;
+ NSMutableArray *fields = [NSMutableArray array];
+
+ if ( [prefs boolForKey:@"dontShowBlob"] ) {
+ for ( i = 0 ; i < [fieldTypes count] ; i++ ) {
+ if ( ![self isBlobOrText:[fieldTypes objectAtIndex:i]] ) {
+ [fields addObject:[fieldNames objectAtIndex:i]];
+ }
+ }
+ if ( [fields count] == 0 ) {
+ return [NSString stringWithFormat:@"`%@`", [fieldNames objectAtIndex:0]];
+ } else {
+ return [NSString stringWithFormat:@"`%@`", [fields componentsJoinedByString:@"`,`"]];
+ }
+ } else {
+ return @"*";
+ }
}
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
@@ -1337,34 +1337,34 @@
if contextInfo == removerow: removes row if user hits OK
*/
{
- NSEnumerator *enumerator = [tableContentView selectedRowEnumerator];
- NSNumber *index;
- NSMutableArray *tempArray = [NSMutableArray array];
- NSMutableArray *tempResult = [NSMutableArray array];
- NSString *queryString;
- CMMCPResult *queryResult;
- int i, errors;
-
- [sheet orderOut:self];
-
- if ( [contextInfo isEqualToString:@"addrow"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ NSEnumerator *enumerator = [tableContentView selectedRowEnumerator];
+ NSNumber *index;
+ NSMutableArray *tempArray = [NSMutableArray array];
+ NSMutableArray *tempResult = [NSMutableArray array];
+ NSString *queryString;
+ CMMCPResult *queryResult;
+ int i, errors;
+
+ [sheet orderOut:self];
+
+ if ( [contextInfo isEqualToString:@"addrow"] ) {
+ if ( returnCode == NSAlertDefaultReturn ) {
//problem: reenter edit mode doesn't function
- [tableContentView editColumn:0 row:[tableContentView selectedRow] withEvent:nil select:YES];
- } else {
- if ( !isEditingNewRow ) {
- [filteredResult replaceObjectAtIndex:[tableContentView selectedRow]
+ [tableContentView editColumn:0 row:[tableContentView selectedRow] withEvent:nil select:YES];
+ } else {
+ if ( !isEditingNewRow ) {
+ [filteredResult replaceObjectAtIndex:[tableContentView selectedRow]
withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
- isEditingRow = NO;
- } else {
- [filteredResult removeObjectAtIndex:[tableContentView selectedRow]];
- isEditingRow = NO;
- isEditingNewRow = NO;
- }
- }
- [tableContentView reloadData];
- } else if ( [contextInfo isEqualToString:@"removeallrows"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ isEditingRow = NO;
+ } else {
+ [filteredResult removeObjectAtIndex:[tableContentView selectedRow]];
+ isEditingRow = NO;
+ isEditingNewRow = NO;
+ }
+ }
+ [tableContentView reloadData];
+ } else if ( [contextInfo isEqualToString:@"removeallrows"] ) {
+ if ( returnCode == NSAlertDefaultReturn ) {
/*
if ( ([tableContentView numberOfSelectedRows] == [self numberOfRowsInTableView:tableContentView]) &&
areShowingAllRows &&
@@ -1379,8 +1379,8 @@
[mySQLConnection getLastErrorMessage]]);
}
}
- } else if ( [contextInfo isEqualToString:@"removerow"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ } else if ( [contextInfo isEqualToString:@"removerow"] ) {
+ if ( returnCode == NSAlertDefaultReturn ) {
errors = 0;
while ( (index = [enumerator nextObject]) ) {
@@ -1413,10 +1413,10 @@
[filteredResult setArray:tempResult];
numRows = [self getNumberOfRows];
if ( !areShowingAllRows ) {
- // queryString = [@"SELECT * FROM " stringByAppendingString:selectedTable];
+ // queryString = [@"SELECT * FROM " stringByAppendingString:selectedTable];
queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@`", [self fieldListForQuery], selectedTable];
if ( sortField ) {
- // queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
+ // queryString = [queryString stringByAppendingString:[NSString stringWithFormat:@" ORDER BY `%@`", sortField]];
queryString = [NSString stringWithFormat:@"%@ ORDER BY `%@`", queryString, sortField];
if ( isDesc )
queryString = [queryString stringByAppendingString:@" DESC"];
@@ -1430,7 +1430,7 @@
[limitRowsField intValue]-1, [prefs integerForKey:@"limitRowsValue"]]];
}
queryResult = [mySQLConnection queryString:queryString];
- // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
+ // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
[fullResult setArray:[self fetchResultAsArray:queryResult]];
[tableContentView reloadData];
[countText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"%d rows of %d selected", @"text showing how many rows are in the filtered result"),
@@ -1443,7 +1443,7 @@
}
[tableContentView deselectAll:self];
}
- }
+ }
}
- (int)getNumberOfRows
@@ -1472,29 +1472,29 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [filteredResult count];
+ return [filteredResult count];
}
- (id)tableView:(NSTableView *)aTableView
objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ row:(int)rowIndex
{
- id theRow, theValue;
-
- theRow = [filteredResult objectAtIndex:rowIndex];
- theValue = [theRow objectForKey:[aTableColumn identifier]];
+ id theRow, theValue;
- if ( [theValue isKindOfClass:[NSData class]] ) {
- theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
- //show only first 50 characters to speed up interface (but return everything when this method is used to return the current result)
- // if ( ([theValue length] > 100) && aTableView ) {
- }
+ theRow = [filteredResult objectAtIndex:rowIndex];
+ theValue = [theRow objectForKey:[aTableColumn identifier]];
+
+ if ( [theValue isKindOfClass:[NSData class]] ) {
+ theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
+ //show only first 50 characters to speed up interface (but return everything when this method is used to return the current result)
+ // if ( ([theValue length] > 100) && aTableView ) {
+ }
// if ( ([(NSString *)theValue length] > 100) && aTableView ) {
// theValue = [NSString stringWithFormat:@"%@(...)", [theValue substringToIndex:100]];
// }
- return theValue;
+ return theValue;
}
- (void)tableView:(NSTableView *)aTableView
@@ -1502,15 +1502,15 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
forTableColumn:(NSTableColumn *)aTableColumn
row:(int)rowIndex
{
- if ( !isEditingRow ) {
- [oldRow setDictionary:[filteredResult objectAtIndex:rowIndex]];
- isEditingRow = YES;
- }
- if ( anObject ) {
- [[filteredResult objectAtIndex:rowIndex] setObject:anObject forKey:[aTableColumn identifier]];
- } else {
- [[filteredResult objectAtIndex:rowIndex] setObject:@"" forKey:[aTableColumn identifier]];
- }
+ if ( !isEditingRow ) {
+ [oldRow setDictionary:[filteredResult objectAtIndex:rowIndex]];
+ isEditingRow = YES;
+ }
+ if ( anObject ) {
+ [[filteredResult objectAtIndex:rowIndex] setObject:anObject forKey:[aTableColumn identifier]];
+ } else {
+ [[filteredResult objectAtIndex:rowIndex] setObject:@"" forKey:[aTableColumn identifier]];
+ }
}
//tableView delegate methods
@@ -1520,79 +1520,79 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
if clicked twice, order is descending
*/
{
- NSString *queryString;
- NSImage *upSortImage;
- NSImage *downSortImage;
- CMMCPResult *queryResult;
+ NSString *queryString;
+ NSImage *upSortImage;
+ NSImage *downSortImage;
+ CMMCPResult *queryResult;
- if ( [selectedTable isEqualToString:@""] || !selectedTable )
- return;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
+ if ( [selectedTable isEqualToString:@""] || !selectedTable )
+ return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
//query started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
- upSortImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sort-up" ofType:@"tiff"]];
- [upSortImage autorelease];
+ upSortImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sort-up" ofType:@"tiff"]];
+ [upSortImage autorelease];
downSortImage = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"sort-down" ofType:@"tiff"]];
- [downSortImage autorelease];
+ [downSortImage autorelease];
//sets order descending if a header is clicked twice
- if ( [[tableColumn identifier] isEqualTo:sortField] ) {
- if ( isDesc ) {
- isDesc = NO;
- } else {
- isDesc = YES;
- }
- } else {
- isDesc = NO;
- [tableContentView setIndicatorImage:nil inTableColumn:[tableContentView tableColumnWithIdentifier:sortField]];
- }
- sortField = [tableColumn identifier];
+ if ( [[tableColumn identifier] isEqualTo:sortField] ) {
+ if ( isDesc ) {
+ isDesc = NO;
+ } else {
+ isDesc = YES;
+ }
+ } else {
+ isDesc = NO;
+ [tableContentView setIndicatorImage:nil inTableColumn:[tableContentView tableColumnWithIdentifier:sortField]];
+ }
+ sortField = [tableColumn identifier];
//make queryString and perform query
- queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@` ORDER BY `%@`", [self fieldListForQuery],
+ queryString = [NSString stringWithFormat:@"SELECT %@ FROM `%@` ORDER BY `%@`", [self fieldListForQuery],
selectedTable, sortField];
- if ( isDesc )
- queryString = [queryString stringByAppendingString:@" DESC"];
- if ( [prefs boolForKey:@"limitRows"] ) {
- if ( [limitRowsField intValue] <= 0 ) {
- [limitRowsField setStringValue:@"1"];
- }
- queryString = [queryString stringByAppendingString:
+ if ( isDesc )
+ queryString = [queryString stringByAppendingString:@" DESC"];
+ if ( [prefs boolForKey:@"limitRows"] ) {
+ if ( [limitRowsField intValue] <= 0 ) {
+ [limitRowsField setStringValue:@"1"];
+ }
+ queryString = [queryString stringByAppendingString:
[NSString stringWithFormat:@" LIMIT %d,%d",
[limitRowsField intValue]-1, [prefs integerForKey:@"limitRowsValue"]]];
- }
- queryResult = [mySQLConnection queryString:queryString];
+ }
+ queryResult = [mySQLConnection queryString:queryString];
- // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
- [fullResult setArray:[self fetchResultAsArray:queryResult]];
+ // [fullResult setArray:[[self fetchResultAsArray:queryResult] retain]];
+ [fullResult setArray:[self fetchResultAsArray:queryResult]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't sort table. MySQL said: %@", @"message of panel when sorting of table failed"), [mySQLConnection getLastErrorMessage]]);
- return;
- }
+ return;
+ }
//sets highlight and indicatorImage
- [tableContentView setHighlightedTableColumn:tableColumn];
- if ( isDesc ) {
- [tableContentView setIndicatorImage:downSortImage inTableColumn:tableColumn];
- } else {
- [tableContentView setIndicatorImage:upSortImage inTableColumn:tableColumn];
- }
+ [tableContentView setHighlightedTableColumn:tableColumn];
+ if ( isDesc ) {
+ [tableContentView setIndicatorImage:downSortImage inTableColumn:tableColumn];
+ } else {
+ [tableContentView setIndicatorImage:upSortImage inTableColumn:tableColumn];
+ }
//query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
//if filter is activated filters the result, otherwise shows fullResult
- if ( !areShowingAllRows ) {
+ if ( !areShowingAllRows ) {
[self filterTable:self];
- } else {
- [filteredResult setArray:fullResult];
- [tableContentView reloadData];
- }
+ } else {
+ [filteredResult setArray:fullResult];
+ [tableContentView reloadData];
+ }
}
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView
@@ -1656,52 +1656,52 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
opens sheet if multipleLineEditingButton is clicked or field is a hidden blob or text field
*/
{
- NSEnumerator *enumerator;
- id type;
- BOOL blob = NO;
- NSDictionary *tempRow;
- NSMutableDictionary *modifiedRow = [NSMutableDictionary dictionary];
- id key;
- int code;
- NSString *query;
- CMMCPResult *tempResult;
- id theValue;
- BOOL columnIsBlob = NO;
- // int i;
- // NSArray *columns = [aTableView tableColumns];
-
- if ( [prefs boolForKey:@"dontShowBlob"] && !isEditingRow ) {
+ NSEnumerator *enumerator;
+ id type;
+ BOOL blob = NO;
+ NSDictionary *tempRow;
+ NSMutableDictionary *modifiedRow = [NSMutableDictionary dictionary];
+ id key;
+ int code;
+ NSString *query;
+ CMMCPResult *tempResult;
+ id theValue;
+ BOOL columnIsBlob = NO;
+ // int i;
+ // NSArray *columns = [aTableView tableColumns];
+
+ if ( [prefs boolForKey:@"dontShowBlob"] && !isEditingRow ) {
//get all row values if dontShowBlob == YES and table contains blob or text field and isEditingRow = NO
- enumerator = [fieldTypes objectEnumerator];
- while ( (type = [enumerator nextObject]) ) {
- if ( [self isBlobOrText:type] ) {
- blob = YES;
- }
- }
-
- if ( blob ) {
- query = [NSString stringWithFormat:@"SELECT * FROM `%@` WHERE %@",
+ enumerator = [fieldTypes objectEnumerator];
+ while ( (type = [enumerator nextObject]) ) {
+ if ( [self isBlobOrText:type] ) {
+ blob = YES;
+ }
+ }
+
+ if ( blob ) {
+ query = [NSString stringWithFormat:@"SELECT * FROM `%@` WHERE %@",
selectedTable, [self argumentForRow:[tableContentView selectedRow]]];
- tempResult = [mySQLConnection queryString:query];
- if ( ![tempResult numOfRows] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ tempResult = [mySQLConnection queryString:query];
+ if ( ![tempResult numOfRows] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"Couldn't load the row. Reload the table to be sure that the row exists and use a primary key for your table.", @"message of panel when loading of row failed"));
- return NO;
- }
- tempRow = [tempResult fetchRowAsDictionary];
- enumerator = [tempRow keyEnumerator];
- while ( key = [enumerator nextObject] ) {
- if ( [[tempRow objectForKey:key] isMemberOfClass:[NSNull class]] ) {
- [modifiedRow setObject:[prefs stringForKey:@"nullValue"] forKey:key];
- } else {
- [modifiedRow setObject:[tempRow objectForKey:key] forKey:key];
- }
- }
- [filteredResult replaceObjectAtIndex:rowIndex
+ return NO;
+ }
+ tempRow = [tempResult fetchRowAsDictionary];
+ enumerator = [tempRow keyEnumerator];
+ while ( key = [enumerator nextObject] ) {
+ if ( [[tempRow objectForKey:key] isMemberOfClass:[NSNull class]] ) {
+ [modifiedRow setObject:[prefs stringForKey:@"nullValue"] forKey:key];
+ } else {
+ [modifiedRow setObject:[tempRow objectForKey:key] forKey:key];
+ }
+ }
+ [filteredResult replaceObjectAtIndex:rowIndex
withObject:[NSMutableDictionary dictionaryWithDictionary:modifiedRow]];
- [tableContentView reloadData];
- }
- }
+ [tableContentView reloadData];
+ }
+ }
/*
// find the column we're trying to edit
@@ -1713,88 +1713,88 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
}
}
*/
- //is the column a blob field -> if YES force sheet editing
- if ( [self isBlobOrText:[fieldTypes objectAtIndex:[fieldNames indexOfObject:[aTableColumn identifier]]]] ) {
- columnIsBlob = YES;
- }
-
- if ( [multipleLineEditingButton state] == NSOnState || columnIsBlob ) {
- theValue = [[filteredResult objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
- NSImage *image = nil;
- editData = [theValue retain];
-
- if ( [theValue isKindOfClass:[NSData class]] ) {
- image = [[NSImage alloc] initWithData:theValue];
- [hexTextView setString:[self dataToHex:theValue]];
+ //is the column a blob field -> if YES force sheet editing
+ if ( [self isBlobOrText:[fieldTypes objectAtIndex:[fieldNames indexOfObject:[aTableColumn identifier]]]] ) {
+ columnIsBlob = YES;
+ }
+
+ if ( [multipleLineEditingButton state] == NSOnState || columnIsBlob ) {
+ theValue = [[filteredResult objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
+ NSImage *image = nil;
+ editData = [theValue retain];
+
+ if ( [theValue isKindOfClass:[NSData class]] ) {
+ image = [[NSImage alloc] initWithData:theValue];
+ [hexTextView setString:[self dataToHex:theValue]];
/*
// update displayed font to monospace
NSFont *font = [NSFont fontWithName:@"Courier" size:12.0f];
NSRange hexRange = { 0, [[hexTextView string] length] - 1 };
[hexTextView setFont:font range:hexRange];
*/
- theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
- } else {
- [hexTextView setString:@""];
- theValue = [theValue description];
- }
-
- [editImage setImage:image];
- [editTextView setString:theValue];
- [editTextView setSelectedRange:NSMakeRange(0,[[editTextView string] length])];
+ theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
+ } else {
+ [hexTextView setString:@""];
+ theValue = [theValue description];
+ }
+
+ [editImage setImage:image];
+ [editTextView setString:theValue];
+ [editTextView setSelectedRange:NSMakeRange(0,[[editTextView string] length])];
//different sheets for date (with up/down arrows), number and text
- [NSApp beginSheet:editSheet
+ [NSApp beginSheet:editSheet
modalForWindow:tableWindow modalDelegate:self
didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:editSheet];
+ code = [NSApp runModalForWindow:editSheet];
- [NSApp endSheet:editSheet];
- [editSheet orderOut:nil];
+ [NSApp endSheet:editSheet];
+ [editSheet orderOut:nil];
if ( code ) {
- if ( !isEditingRow ) {
- [oldRow setDictionary:[filteredResult objectAtIndex:rowIndex]];
- isEditingRow = YES;
- }
+ if ( !isEditingRow ) {
+ [oldRow setDictionary:[filteredResult objectAtIndex:rowIndex]];
+ isEditingRow = YES;
+ }
- [[filteredResult objectAtIndex:rowIndex] setObject:[editData copy]
+ [[filteredResult objectAtIndex:rowIndex] setObject:[editData copy]
forKey:[aTableColumn identifier]];
- // clean up
- [editImage setImage:nil];
- [editTextView setString:@""];
- [hexTextView setString:@""];
- if ( editData ) {
- [editData release];
- }
- }
- return NO;
- } else {
- return YES;
- }
+ // clean up
+ [editImage setImage:nil];
+ [editTextView setString:@""];
+ [hexTextView setString:@""];
+ if ( editData ) {
+ [editData release];
+ }
+ }
+ return NO;
+ } else {
+ return YES;
+ }
}
- (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray*)rows
- toPasteboard:(NSPasteboard*)pboard
+ toPasteboard:(NSPasteboard*)pboard
/*
enable drag from tableview
*/
-{
- if ( tableView == tableContentView )
- {
- NSString *tmp = [tableContentView draggedRowsAsTabString:rows];
-
- if ( nil != tmp )
- {
- [pboard declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType,
+{
+ if ( tableView == tableContentView )
+ {
+ NSString *tmp = [tableContentView draggedRowsAsTabString:rows];
+
+ if ( nil != tmp )
+ {
+ [pboard declareTypes:[NSArray arrayWithObjects: NSTabularTextPboardType,
NSStringPboardType, nil]
owner:nil];
-
- [pboard setString:tmp forType:NSStringPboardType];
- [pboard setString:tmp forType:NSTabularTextPboardType];
- return YES;
- }
- }
- return NO;
+
+ [pboard setString:tmp forType:NSStringPboardType];
+ [pboard setString:tmp forType:NSTabularTextPboardType];
+ return YES;
+ }
+ }
+ return NO;
}
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
@@ -1802,18 +1802,18 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
traps enter and esc an make/cancel editing without entering next row
*/
{
- int row, column, i;
+ int row, column, i;
- row = [tableContentView editedRow];
- column = [tableContentView editedColumn];
+ row = [tableContentView editedRow];
+ column = [tableContentView editedColumn];
if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ||
[textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) //trap enter and tab
{
- //save current line
- [[control window] makeFirstResponder:control];
- if ( column == ( [tableContentView numberOfColumns] - 1 ) ) {
- [self addRowToDB];
+ //save current line
+ [[control window] makeFirstResponder:control];
+ if ( column == ( [tableContentView numberOfColumns] - 1 ) ) {
+ [self addRowToDB];
/*
if ( [self addRowToDB] &&
( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) &&
@@ -1824,41 +1824,41 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
[tableContentView editColumn:0 row:row+1 withEvent:nil select:YES];
} else {
[tableContentView selectRow:0 byExtendingSelection:NO];
- [tableContentView editColumn:0 row:0 withEvent:nil select:YES];
+ [tableContentView editColumn:0 row:0 withEvent:nil select:YES];
}
}
*/
- } else {
+ } else {
//check if next column is a blob column
- i = 1;
- while ( [self isBlobOrText:[fieldTypes objectAtIndex:[fieldNames indexOfObject:[[[tableContentView tableColumns] objectAtIndex:column+i] identifier]]]] ) {
- i++;
- if ( (column+i) >= [tableContentView numberOfColumns] ) {
+ i = 1;
+ while ( [self isBlobOrText:[fieldTypes objectAtIndex:[fieldNames indexOfObject:[[[tableContentView tableColumns] objectAtIndex:column+i] identifier]]]] ) {
+ i++;
+ if ( (column+i) >= [tableContentView numberOfColumns] ) {
//there is no other column after the blob column
- [self addRowToDB];
- return TRUE;
- }
- }
- //edit the column after the blob column
- [tableContentView editColumn:column+i row:row withEvent:nil select:YES];
- }
- return TRUE;
+ [self addRowToDB];
+ return TRUE;
+ }
+ }
+ //edit the column after the blob column
+ [tableContentView editColumn:column+i row:row withEvent:nil select:YES];
+ }
+ return TRUE;
}
else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
[textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] ) //trap esc
{
- //abort editing
- [control abortEditing];
- if ( isEditingRow && !isEditingNewRow ) {
- isEditingRow = NO;
- [filteredResult replaceObjectAtIndex:row withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
- } else if ( isEditingNewRow ) {
- isEditingRow = NO;
- isEditingNewRow = NO;
- [filteredResult removeObjectAtIndex:row];
- [tableContentView reloadData];
- }
- return TRUE;
+ //abort editing
+ [control abortEditing];
+ if ( isEditingRow && !isEditingNewRow ) {
+ isEditingRow = NO;
+ [filteredResult replaceObjectAtIndex:row withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
+ } else if ( isEditingNewRow ) {
+ isEditingRow = NO;
+ isEditingNewRow = NO;
+ [filteredResult removeObjectAtIndex:row];
+ [tableContentView reloadData];
+ }
+ return TRUE;
}
else
{
@@ -1873,17 +1873,17 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
traps enter and return key and closes editSheet instead of inserting a linebreak when user hits return
*/
{
- if ( aTextView == editTextView ) {
- if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] &&
+ if ( aTextView == editTextView ) {
+ if ( [aTextView methodForSelector:aSelector] == [aTextView methodForSelector:@selector(insertNewline:)] &&
[[[NSApp currentEvent] characters] isEqualToString:@"\003"] )
- {
- [NSApp stopModalWithCode:1];
- return YES;
- } else {
- return NO;
- }
- }
- return NO;
+ {
+ [NSApp stopModalWithCode:1];
+ return YES;
+ } else {
+ return NO;
+ }
+ }
+ return NO;
}
@@ -1891,20 +1891,20 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
- (void)dealloc
{
- // NSLog(@"TableContent dealloc");
-
- [editData release];
- [fullResult release];
- [filteredResult release];
- [keys release];
- [oldRow release];
- [fieldNames release];
- [fieldTypes release];
- [compareType release];
- [sortField release];
- [prefs release];
-
- [super dealloc];
+ // NSLog(@"TableContent dealloc");
+
+ [editData release];
+ [fullResult release];
+ [filteredResult release];
+ [keys release];
+ [oldRow release];
+ [fieldNames release];
+ [fieldTypes release];
+ [compareType release];
+ [sortField release];
+ [prefs release];
+
+ [super dealloc];
}
@end
diff --git a/TableDocument.h b/TableDocument.h
index aed99756..7b5426f2 100644
--- a/TableDocument.h
+++ b/TableDocument.h
@@ -103,13 +103,13 @@
- (NSString *)selectedFavoritePassword;
- (void)connectSheetAddToFavorites:(id)sender;
- (void)addToFavoritesHost:(NSString *)host socket:(NSString *)socket
- user:(NSString *)user password:(NSString *)password
- port:(NSString *)port database:(NSString *)database
- useSSH:(BOOL)useSSH // no-longer in use
- sshHost:(NSString *)sshHost // no-longer in use
- sshUser:(NSString *)sshUser // no-longer in use
- sshPassword:(NSString *)sshPassword // no-longer in use
- sshPort:(NSString *)sshPort; // no-longer in use
+ user:(NSString *)user password:(NSString *)password
+ port:(NSString *)port database:(NSString *)database
+ useSSH:(BOOL)useSSH // no-longer in use
+ sshHost:(NSString *)sshHost // no-longer in use
+ sshUser:(NSString *)sshUser // no-longer in use
+ sshPassword:(NSString *)sshPassword // no-longer in use
+ sshPort:(NSString *)sshPort; // no-longer in use
- (NSMutableArray *)favorites;
//alert sheets method
@@ -212,8 +212,8 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
//for freeing up memory
- (void)dealloc;
diff --git a/TableDocument.m b/TableDocument.m
index 44ee05df..e456aacd 100644
--- a/TableDocument.m
+++ b/TableDocument.m
@@ -42,7 +42,7 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
- (id)init
{
if (![super init])
- return nil;
+ return nil;
_encoding = [@"utf8" retain];
chooseDatabaseButton = nil;
@@ -72,7 +72,7 @@ NSString *TableDocumentFavoritesControllerFavoritesDidChange = @"TableDocumentFa
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if (context == TableDocumentFavoritesControllerSelectionIndexDidChange) {
- [self chooseFavorite:self];
+ [self chooseFavorite:self];
return;
}
@@ -133,32 +133,32 @@ stops modal session with code:
code = 0;
if ( [[hostField stringValue] isEqualToString:@""] && [[socketField stringValue] isEqualToString:@""] ) {
- code = 4;
+ code = 4;
} else {
- if ( ![[socketField stringValue] isEqualToString:@""] ) {
- //connect to socket
- mySQLConnection = [[CMMCPConnection alloc] initToSocket:[socketField stringValue]
- withLogin:[userField stringValue]
- password:[passwordField stringValue]];
- [hostField setStringValue:@"localhost"];
- } else {
- //connect to host
- mySQLConnection = [[CMMCPConnection alloc] initToHost:[hostField stringValue]
- withLogin:[userField stringValue]
- password:[passwordField stringValue]
- usingPort:[portField intValue]];
- }
- if ( ![mySQLConnection isConnected] )
- code = 2;
- if ( !code && ![[databaseField stringValue] isEqualToString:@""] ) {
- if ([mySQLConnection selectDB:[databaseField stringValue]]) {
- selectedDatabase = [[databaseField stringValue] retain];
- } else {
- code = 3;
- }
- }
- if ( !code )
- code = 1;
+ if ( ![[socketField stringValue] isEqualToString:@""] ) {
+ //connect to socket
+ mySQLConnection = [[CMMCPConnection alloc] initToSocket:[socketField stringValue]
+ withLogin:[userField stringValue]
+ password:[passwordField stringValue]];
+ [hostField setStringValue:@"localhost"];
+ } else {
+ //connect to host
+ mySQLConnection = [[CMMCPConnection alloc] initToHost:[hostField stringValue]
+ withLogin:[userField stringValue]
+ password:[passwordField stringValue]
+ usingPort:[portField intValue]];
+ }
+ if ( ![mySQLConnection isConnected] )
+ code = 2;
+ if ( !code && ![[databaseField stringValue] isEqualToString:@""] ) {
+ if ([mySQLConnection selectDB:[databaseField stringValue]]) {
+ selectedDatabase = [[databaseField stringValue] retain];
+ } else {
+ code = 3;
+ }
+ }
+ if ( !code )
+ code = 1;
}
// close sheet
@@ -188,7 +188,7 @@ stops modal session with code:
[self setEncoding:[self mysqlEncodingFromDisplayEncoding:encodingName]];
}
//get mysql version
- // theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE \"version\""];
+ // theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE \"version\""];
theResult = [mySQLConnection queryString:@"SHOW VARIABLES LIKE 'version'"];
version = [[theResult fetchRowAsArray] objectAtIndex:1];
if ( [version isKindOfClass:[NSData class]] ) {
@@ -284,12 +284,12 @@ reused when user hits the close button of the variablseSheet or of the createTab
{
// if no favorites, load from user defaults
if (!favorites) {
- favorites = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"favorites"]];
+ favorites = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:@"favorites"]];
}
// if no favorites in user defaults, load empty ones
if (!favorites) {
- favorites = [[NSMutableArray array] retain];
+ favorites = [[NSMutableArray array] retain];
}
return favorites;
@@ -334,35 +334,35 @@ reused when user hits the close button of the variablseSheet or of the createTab
* add actual connection to favorites
*/
- (void)addToFavoritesHost:(NSString *)host socket:(NSString *)socket
- user:(NSString *)user password:(NSString *)password
- port:(NSString *)port database:(NSString *)database
- useSSH:(BOOL)useSSH // no-longer in use
- sshHost:(NSString *)sshHost // no-longer in use
- sshUser:(NSString *)sshUser // no-longer in use
- sshPassword:(NSString *)sshPassword // no-longer in use
- sshPort:(NSString *)sshPort // no-longer in use
+ user:(NSString *)user password:(NSString *)password
+ port:(NSString *)port database:(NSString *)database
+ useSSH:(BOOL)useSSH // no-longer in use
+ sshHost:(NSString *)sshHost // no-longer in use
+ sshUser:(NSString *)sshUser // no-longer in use
+ sshPassword:(NSString *)sshPassword // no-longer in use
+ sshPort:(NSString *)sshPort // no-longer in use
{
NSString *favoriteName = [NSString stringWithFormat:@"%@@%@", user, host];
if (![database isEqualToString:@""])
- favoriteName = [NSString stringWithFormat:@"%@ %@", database, favoriteName];
+ favoriteName = [NSString stringWithFormat:@"%@ %@", database, favoriteName];
// test if host and socket are not nil
if ([host isEqualToString:@""] && [socket isEqualToString:@""]) {
- NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Please enter at least a host or socket.", @"message of panel when host/socket are missing"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
- return;
+ NSRunAlertPanel(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"Please enter at least a host or socket.", @"message of panel when host/socket are missing"), NSLocalizedString(@"OK", @"OK button"), nil, nil);
+ return;
}
[self willChangeValueForKey:@"favorites"];
// write favorites and password
- NSDictionary *newFavorite = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:favoriteName, host, socket, user, port, database, nil]
- forKeys:[NSArray arrayWithObjects:@"name", @"host", @"socket", @"user", @"port", @"database", nil]];
+ NSDictionary *newFavorite = [NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:favoriteName, host, socket, user, port, database, nil]
+ forKeys:[NSArray arrayWithObjects:@"name", @"host", @"socket", @"user", @"port", @"database", nil]];
[favorites addObject:newFavorite];
if (![password isEqualToString:@""]) {
- [keyChainInstance addPassword:password
- forName:[NSString stringWithFormat:@"Sequel Pro : %@", favoriteName]
- account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
+ [keyChainInstance addPassword:password
+ forName:[NSString stringWithFormat:@"Sequel Pro : %@", favoriteName]
+ account:[NSString stringWithFormat:@"%@@%@/%@", user, host, database]];
}
// select new favorite
@@ -382,27 +382,27 @@ reused when user hits the close button of the variablseSheet or of the createTab
[sheet orderOut:self];
if ([contextInfo isEqualToString:@"connect"]) {
- [self connectToDB:nil];
- return;
+ [self connectToDB:nil];
+ return;
}
if ([contextInfo isEqualToString:@"removedatabase"]) {
- if (returnCode != NSAlertDefaultReturn)
- return;
-
- [mySQLConnection queryString:[NSString stringWithFormat:@"DROP DATABASE `%@`", [self database]]];
- if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
- // error while deleting db
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove database.\nMySQL said: %@", @"message of panel when removing db failed"), [mySQLConnection getLastErrorMessage]]);
- return;
- }
-
- // db deleted with success
- selectedDatabase = nil;
- [self setDatabases:self];
- [tablesListInstance setConnection:mySQLConnection];
- [tableDumpInstance setConnection:mySQLConnection];
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/", mySQLVersion, [userField stringValue], [hostField stringValue]]];
+ if (returnCode != NSAlertDefaultReturn)
+ return;
+
+ [mySQLConnection queryString:[NSString stringWithFormat:@"DROP DATABASE `%@`", [self database]]];
+ if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
+ // error while deleting db
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove database.\nMySQL said: %@", @"message of panel when removing db failed"), [mySQLConnection getLastErrorMessage]]);
+ return;
+ }
+
+ // db deleted with success
+ selectedDatabase = nil;
+ [self setDatabases:self];
+ [tablesListInstance setConnection:mySQLConnection];
+ [tableDumpInstance setConnection:mySQLConnection];
+ [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/", mySQLVersion, [userField stringValue], [hostField stringValue]]];
}
}
@@ -415,7 +415,7 @@ reused when user hits the close button of the variablseSheet or of the createTab
- (IBAction)setDatabases:(id)sender;
{
if (!chooseDatabaseButton)
- return;
+ return;
[chooseDatabaseButton removeAllItems];
[chooseDatabaseButton addItemWithTitle:NSLocalizedString(@"Choose Database...", @"menu item for choose db")];
@@ -427,13 +427,13 @@ reused when user hits the close button of the variablseSheet or of the createTab
MCPResult *queryResult = [mySQLConnection listDBs];
int i;
for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
- [queryResult dataSeek:i];
- [chooseDatabaseButton addItemWithTitle:[[queryResult fetchRowAsArray] objectAtIndex:0]];
+ [queryResult dataSeek:i];
+ [chooseDatabaseButton addItemWithTitle:[[queryResult fetchRowAsArray] objectAtIndex:0]];
}
if ( ![self database] ) {
- [chooseDatabaseButton selectItemAtIndex:0];
+ [chooseDatabaseButton selectItemAtIndex:0];
} else {
- [chooseDatabaseButton selectItemWithTitle:[self database]];
+ [chooseDatabaseButton selectItemWithTitle:[self database]];
}
}
@@ -444,22 +444,22 @@ reused when user hits the close button of the variablseSheet or of the createTab
- (IBAction)chooseDatabase:(id)sender
{
if (![tablesListInstance selectionShouldChangeInTableView:nil]) {
- [chooseDatabaseButton selectItemWithTitle:[self database]];
- return;
+ [chooseDatabaseButton selectItemWithTitle:[self database]];
+ return;
}
if ( [chooseDatabaseButton indexOfSelectedItem] == 0 ) {
- if ([self database]) {
- [chooseDatabaseButton selectItemWithTitle:[self database]];
- }
- return;
+ if ([self database]) {
+ [chooseDatabaseButton selectItemWithTitle:[self database]];
+ }
+ return;
}
// show error on connection failed
if ( ![mySQLConnection selectDB:[chooseDatabaseButton titleOfSelectedItem]] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"), [chooseDatabaseButton titleOfSelectedItem]]);
- [self setDatabases:self];
- return;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"), [chooseDatabaseButton titleOfSelectedItem]]);
+ [self setDatabases:self];
+ return;
}
//setConnection of TablesList and TablesDump to reload tables in db
@@ -479,39 +479,39 @@ reused when user hits the close button of the variablseSheet or of the createTab
int code = 0;
if (![tablesListInstance selectionShouldChangeInTableView:nil])
- return;
+ return;
[databaseNameField setStringValue:@""];
[NSApp beginSheet:databaseSheet
- modalForWindow:tableWindow
- modalDelegate:self
- didEndSelector:nil
- contextInfo:nil];
+ modalForWindow:tableWindow
+ modalDelegate:self
+ didEndSelector:nil
+ contextInfo:nil];
code = [NSApp runModalForWindow:databaseSheet];
[NSApp endSheet:databaseSheet];
[databaseSheet orderOut:nil];
if (!code)
- return;
+ return;
if ([[databaseNameField stringValue] isEqualToString:@""]) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given"));
- return;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Database must have a name.", @"message of panel when no db name is given"));
+ return;
}
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE DATABASE `%@`", [databaseNameField stringValue]]];
if (![[mySQLConnection getLastErrorMessage] isEqualToString:@""]) {
- //error while creating db
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't create database.\nMySQL said: %@", @"message of panel when creation of db failed"), [mySQLConnection getLastErrorMessage]]);
- return;
+ //error while creating db
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't create database.\nMySQL said: %@", @"message of panel when creation of db failed"), [mySQLConnection getLastErrorMessage]]);
+ return;
}
if (![mySQLConnection selectDB:[databaseNameField stringValue]] ) { //error while selecting new db (is this possible?!)
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"),
- [databaseNameField stringValue]]);
- [self setDatabases:self];
- return;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Unable to connect to database %@.\nBe sure that you have the necessary privileges.", @"message of panel when connection to db failed after selecting from popupbutton"),
+ [databaseNameField stringValue]]);
+ [self setDatabases:self];
+ return;
}
//select new db
@@ -538,9 +538,9 @@ reused when user hits the close button of the variablseSheet or of the createTab
- (IBAction)removeDatabase:(id)sender
{
if ([chooseDatabaseButton indexOfSelectedItem] == 0)
- return;
+ return;
if (![tablesListInstance selectionShouldChangeInTableView:nil])
- return;
+ return;
NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, nil, @selector(sheetDidEnd:returnCode:contextInfo:), @"removedatabase", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the database %@?", @"message of panel asking for confirmation for deleting db"), [self database]]);
}
@@ -555,10 +555,10 @@ reused when user hits the close button of the variablseSheet or of the createTab
{
NSDrawerState state = [consoleDrawer state];
if (NSDrawerOpeningState == state || NSDrawerOpenState == state) {
- [consoleDrawer close];
+ [consoleDrawer close];
} else {
- [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]];
- [consoleDrawer openOnEdge:NSMinYEdge];
+ [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]];
+ [consoleDrawer openOnEdge:NSMinYEdge];
}
}
@@ -591,8 +591,8 @@ reused when user hits the close button of the variablseSheet or of the createTab
end = [[consoleTextView string] length];
[consoleTextView setTextColor:[NSColor blackColor] range:NSMakeRange(begin,end-begin)];
if ([self consoleIsOpened]) {
- [consoleTextView displayIfNeeded];
- [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]];
+ [consoleTextView displayIfNeeded];
+ [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]];
}
}
@@ -609,8 +609,8 @@ reused when user hits the close button of the variablseSheet or of the createTab
end = [[consoleTextView string] length];
[consoleTextView setTextColor:[NSColor redColor] range:NSMakeRange(begin,end-begin)];
if ([self consoleIsOpened]) {
- [consoleTextView displayIfNeeded];
- [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]];
+ [consoleTextView displayIfNeeded];
+ [consoleTextView scrollRangeToVisible:[consoleTextView selectedRange]];
}
}
@@ -624,9 +624,9 @@ reused when user hits the close button of the variablseSheet or of the createTab
// set encoding of connection and client
[mySQLConnection queryString:[NSString stringWithFormat:@"SET NAMES '%@'", mysqlEncoding]];
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [mySQLConnection setEncoding:[CMMCPConnection encodingForMySQLEncoding:[mysqlEncoding cString]]];
- [_encoding autorelease];
- _encoding = [mysqlEncoding retain];
+ [mySQLConnection setEncoding:[CMMCPConnection encodingForMySQLEncoding:[mysqlEncoding UT]]];
+ [_encoding autorelease];
+ _encoding = [mysqlEncoding retain];
} else {
[self detectEncoding];
}
@@ -659,12 +659,12 @@ reused when user hits the close button of the variablseSheet or of the createTab
id menuItem;
int correctStateForMenuItem;
while (menuItem = [dbEncodingMenuEn nextObject]) {
- correctStateForMenuItem = [[menuItem title] isEqualToString:encoding] ? NSOnState : NSOffState;
-
- if ([menuItem state] == correctStateForMenuItem) // don't re-apply state incase it causes performance issues
- continue;
-
- [menuItem setState:correctStateForMenuItem];
+ correctStateForMenuItem = [[menuItem title] isEqualToString:encoding] ? NSOnState : NSOffState;
+
+ if ([menuItem state] == correctStateForMenuItem) // don't re-apply state incase it causes performance issues
+ continue;
+
+ [menuItem setState:correctStateForMenuItem];
}
}
@@ -674,27 +674,27 @@ reused when user hits the close button of the variablseSheet or of the createTab
- (NSString *)encodingNameFromMySQLEncoding:(NSString *)mysqlEncoding
{
NSDictionary *translationMap = [NSDictionary dictionaryWithObjectsAndKeys:
- @"UCS-2 Unicode (ucs2)", @"ucs2",
- @"UTF-8 Unicode (utf8)", @"utf8",
- @"US ASCII (ascii)", @"ascii",
- @"ISO Latin 1 (latin1)", @"latin1",
- @"Mac Roman (macroman)", @"macroman",
- @"Windows Latin 2 (cp1250)", @"cp1250",
- @"ISO Latin 2 (latin2)", @"latin2",
- @"Windows Arabic (cp1256)", @"cp1256",
- @"ISO Greek (greek)", @"greek",
- @"ISO Hebrew (hebrew)", @"hebrew",
- @"ISO Turkish (latin5)", @"latin5",
- @"Windows Baltic (cp1257)", @"cp1257",
- @"Windows Cyrillic (cp1251)", @"cp1251",
- @"Big5 Traditional Chinese (big5)", @"big5",
- @"Shift-JIS Japanese (sjis)", @"sjis",
- @"EUC-JP Japanese (ujis)", @"ujis",
- nil];
+ @"UCS-2 Unicode (ucs2)", @"ucs2",
+ @"UTF-8 Unicode (utf8)", @"utf8",
+ @"US ASCII (ascii)", @"ascii",
+ @"ISO Latin 1 (latin1)", @"latin1",
+ @"Mac Roman (macroman)", @"macroman",
+ @"Windows Latin 2 (cp1250)", @"cp1250",
+ @"ISO Latin 2 (latin2)", @"latin2",
+ @"Windows Arabic (cp1256)", @"cp1256",
+ @"ISO Greek (greek)", @"greek",
+ @"ISO Hebrew (hebrew)", @"hebrew",
+ @"ISO Turkish (latin5)", @"latin5",
+ @"Windows Baltic (cp1257)", @"cp1257",
+ @"Windows Cyrillic (cp1251)", @"cp1251",
+ @"Big5 Traditional Chinese (big5)", @"big5",
+ @"Shift-JIS Japanese (sjis)", @"sjis",
+ @"EUC-JP Japanese (ujis)", @"ujis",
+ nil];
NSString *encodingName = [translationMap valueForKey:mysqlEncoding];
if (!encodingName)
- return [NSString stringWithFormat:@"Unknown Encoding (%@)", mysqlEncoding, nil];
+ return [NSString stringWithFormat:@"Unknown Encoding (%@)", mysqlEncoding, nil];
return encodingName;
}
@@ -705,27 +705,27 @@ reused when user hits the close button of the variablseSheet or of the createTab
- (NSString *)mysqlEncodingFromDisplayEncoding:(NSString *)encodingName
{
NSDictionary *translationMap = [NSDictionary dictionaryWithObjectsAndKeys:
- @"ucs2", @"UCS-2 Unicode (ucs2)",
- @"utf8", @"UTF-8 Unicode (utf8)",
- @"ascii", @"US ASCII (ascii)",
- @"latin1", @"ISO Latin 1 (latin1)",
- @"macroman", @"Mac Roman (macroman)",
- @"cp1250", @"Windows Latin 2 (cp1250)",
- @"latin2", @"ISO Latin 2 (latin2)",
- @"cp1256", @"Windows Arabic (cp1256)",
- @"greek", @"ISO Greek (greek)",
- @"hebrew", @"ISO Hebrew (hebrew)",
- @"latin5", @"ISO Turkish (latin5)",
- @"cp1257", @"Windows Baltic (cp1257)",
- @"cp1251", @"Windows Cyrillic (cp1251)",
- @"big5", @"Big5 Traditional Chinese (big5)",
- @"sjis", @"Shift-JIS Japanese (sjis)",
- @"ujis", @"EUC-JP Japanese (ujis)",
- nil];
+ @"ucs2", @"UCS-2 Unicode (ucs2)",
+ @"utf8", @"UTF-8 Unicode (utf8)",
+ @"ascii", @"US ASCII (ascii)",
+ @"latin1", @"ISO Latin 1 (latin1)",
+ @"macroman", @"Mac Roman (macroman)",
+ @"cp1250", @"Windows Latin 2 (cp1250)",
+ @"latin2", @"ISO Latin 2 (latin2)",
+ @"cp1256", @"Windows Arabic (cp1256)",
+ @"greek", @"ISO Greek (greek)",
+ @"hebrew", @"ISO Hebrew (hebrew)",
+ @"latin5", @"ISO Turkish (latin5)",
+ @"cp1257", @"Windows Baltic (cp1257)",
+ @"cp1251", @"Windows Cyrillic (cp1251)",
+ @"big5", @"Big5 Traditional Chinese (big5)",
+ @"sjis", @"Shift-JIS Japanese (sjis)",
+ @"ujis", @"EUC-JP Japanese (ujis)",
+ nil];
NSString *mysqlEncoding = [translationMap valueForKey:encodingName];
if (!mysqlEncoding)
- return @"utf8";
+ return @"utf8";
return mysqlEncoding;
}
@@ -979,12 +979,12 @@ reused when user hits the close button of the variablseSheet or of the createTab
[mySQLConnection queryString:@"FLUSH PRIVILEGES"];
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- //flushed privileges without errors
- NSBeginAlertSheet(NSLocalizedString(@"Flushed Privileges", @"title of panel when successfully flushed privs"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Succesfully flushed privileges.", @"message of panel when successfully flushed privs"));
+ //flushed privileges without errors
+ NSBeginAlertSheet(NSLocalizedString(@"Flushed Privileges", @"title of panel when successfully flushed privs"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Succesfully flushed privileges.", @"message of panel when successfully flushed privs"));
} else {
- //error while flushing privileges
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't flush privileges.\nMySQL said: %@", @"message of panel when flushing privs failed"),
- [mySQLConnection getLastErrorMessage]]);
+ //error while flushing privileges
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, [NSString stringWithFormat:NSLocalizedString(@"Couldn't flush privileges.\nMySQL said: %@", @"message of panel when flushing privs failed"),
+ [mySQLConnection getLastErrorMessage]]);
}
}
@@ -993,35 +993,35 @@ reused when user hits the close button of the variablseSheet or of the createTab
shows the mysql variables
*/
{
- CMMCPResult *theResult;
- NSMutableArray *tempResult = [NSMutableArray array];
- int i;
-
- if ( variables ) {
- [variables release];
- variables = nil;
- }
- //get variables
- theResult = [mySQLConnection queryString:@"SHOW VARIABLES"];
- for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
- [tempResult addObject:[theResult fetchRowAsDictionary]];
- }
- variables = [[NSArray arrayWithArray:tempResult] retain];
- [variablesTableView reloadData];
- //show variables sheet
- [NSApp beginSheet:variablesSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:variablesSheet];
-
- [NSApp endSheet:variablesSheet];
- [variablesSheet orderOut:nil];
+ CMMCPResult *theResult;
+ NSMutableArray *tempResult = [NSMutableArray array];
+ int i;
+
+ if ( variables ) {
+ [variables release];
+ variables = nil;
+ }
+ //get variables
+ theResult = [mySQLConnection queryString:@"SHOW VARIABLES"];
+ for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
+ [theResult dataSeek:i];
+ [tempResult addObject:[theResult fetchRowAsDictionary]];
+ }
+ variables = [[NSArray arrayWithArray:tempResult] retain];
+ [variablesTableView reloadData];
+ //show variables sheet
+ [NSApp beginSheet:variablesSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:variablesSheet];
+
+ [NSApp endSheet:variablesSheet];
+ [variablesSheet orderOut:nil];
}
- (void)closeConnection
{
- [mySQLConnection disconnect];
+ [mySQLConnection disconnect];
// Disconnected Growl Notification
[GrowlApplicationBridge notifyWithTitle:@"Disconnected"
@@ -1041,7 +1041,7 @@ shows the mysql variables
returns the currently selected database
*/
{
- return selectedDatabase;
+ return selectedDatabase;
}
- (NSString *)table
@@ -1049,7 +1049,7 @@ returns the currently selected database
returns the currently selected table (passing the request to TablesList)
*/
{
- return (NSString *)[tablesListInstance table];
+ return (NSString *)[tablesListInstance table];
}
- (NSString *)mySQLVersion
@@ -1057,7 +1057,7 @@ returns the currently selected table (passing the request to TablesList)
returns the mysql version
*/
{
- return mySQLVersion;
+ return mySQLVersion;
}
- (NSString *)user
@@ -1065,7 +1065,7 @@ returns the mysql version
returns the mysql version
*/
{
- return [userField stringValue];
+ return [userField stringValue];
}
@@ -1075,7 +1075,7 @@ returns the mysql version
invoked before a query is performed
*/
{
- [queryProgressBar startAnimation:self];
+ [queryProgressBar startAnimation:self];
}
- (void)hasPerformedQuery:(NSNotification *)notification
@@ -1083,7 +1083,7 @@ invoked before a query is performed
invoked after a query has been performed
*/
{
- [queryProgressBar stopAnimation:self];
+ [queryProgressBar stopAnimation:self];
}
- (void)applicationWillTerminate:(NSNotification *)notification
@@ -1091,7 +1091,7 @@ invoked after a query has been performed
invoked when the application will terminate
*/
{
- [tablesListInstance selectionShouldChangeInTableView:nil];
+ [tablesListInstance selectionShouldChangeInTableView:nil];
}
- (void)tunnelStatusChanged:(NSNotification *)notification
@@ -1107,7 +1107,7 @@ the status of the tunnel has changed
passes the request to the tableDump object
*/
{
- [tableDumpInstance importFile:[sender tag]];
+ [tableDumpInstance importFile:[sender tag]];
}
- (IBAction)importCSV:(id)sender
@@ -1120,7 +1120,7 @@ passes the request to the tableDump object
passes the request to the tableDump object
*/
{
- [tableDumpInstance exportFile:[sender tag]];
+ [tableDumpInstance exportFile:[sender tag]];
}
- (IBAction)exportTable:(id)sender
@@ -1332,19 +1332,19 @@ passes the request to the tableDump object
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar*)toolbar
{
return [NSArray arrayWithObjects:
- @"DatabaseSelectToolbarItemIdentifier",
- @"ToggleConsoleIdentifier",
- @"ClearConsoleIdentifier",
- @"FlushPrivilegesIdentifier",
- @"SwitchToTableStructureToolbarItemIdentifier",
- @"SwitchToTableContentToolbarItemIdentifier",
- @"SwitchToRunQueryToolbarItemIdentifier",
- @"SwitchToTableStatusToolbarItemIdentifier",
+ @"DatabaseSelectToolbarItemIdentifier",
+ @"ToggleConsoleIdentifier",
+ @"ClearConsoleIdentifier",
+ @"FlushPrivilegesIdentifier",
+ @"SwitchToTableStructureToolbarItemIdentifier",
+ @"SwitchToTableContentToolbarItemIdentifier",
+ @"SwitchToRunQueryToolbarItemIdentifier",
+ @"SwitchToTableStatusToolbarItemIdentifier",
NSToolbarCustomizeToolbarItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier,
NSToolbarSpaceItemIdentifier,
NSToolbarSeparatorItemIdentifier,
- nil];
+ nil];
}
/**
@@ -1354,23 +1354,23 @@ passes the request to the tableDump object
{
return [NSArray arrayWithObjects:
@"DatabaseSelectToolbarItemIdentifier",
- NSToolbarFlexibleSpaceItemIdentifier,
- @"SwitchToTableStructureToolbarItemIdentifier",
- @"SwitchToTableContentToolbarItemIdentifier",
- @"SwitchToRunQueryToolbarItemIdentifier",
NSToolbarFlexibleSpaceItemIdentifier,
- nil];
+ @"SwitchToTableStructureToolbarItemIdentifier",
+ @"SwitchToTableContentToolbarItemIdentifier",
+ @"SwitchToRunQueryToolbarItemIdentifier",
+ NSToolbarFlexibleSpaceItemIdentifier,
+ nil];
}
- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
{
return [NSArray arrayWithObjects:
- @"SwitchToTableStructureToolbarItemIdentifier",
- @"SwitchToTableContentToolbarItemIdentifier",
- @"SwitchToRunQueryToolbarItemIdentifier",
- @"SwitchToTableStatusToolbarItemIdentifier",
- nil];
-
+ @"SwitchToTableStructureToolbarItemIdentifier",
+ @"SwitchToTableContentToolbarItemIdentifier",
+ @"SwitchToRunQueryToolbarItemIdentifier",
+ @"SwitchToTableStatusToolbarItemIdentifier",
+ nil];
+
}
/**
@@ -1398,7 +1398,7 @@ passes the request to the tableDump object
returns the name of the nib file
*/
{
- return @"DBView";
+ return @"DBView";
}
- (void)windowControllerDidLoadNib:(NSWindowController *) aController
@@ -1407,53 +1407,53 @@ code that need to be executed once the windowController has loaded the document'
sets upt the interface (small fonts)
*/
{
- [aController setShouldCascadeWindows:YES];
- [super windowControllerDidLoadNib:aController];
-
- NSEnumerator *theCols = [[variablesTableView tableColumns] objectEnumerator];
- NSTableColumn *theCol;
-
-// [tableWindow makeKeyAndOrderFront:self];
-
- prefs = [[NSUserDefaults standardUserDefaults] retain];
- selectedFavorite = [[NSString alloc] initWithString:NSLocalizedString(@"Custom", @"menu item for custom connection")];
-
- //register for notifications
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willPerformQuery:)
- name:@"SMySQLQueryWillBePerformed" object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hasPerformedQuery:)
- name:@"SMySQLQueryHasBeenPerformed" object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:)
- name:@"NSApplicationWillTerminateNotification" object:nil];
-
- //set up interface
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [consoleTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [syntaxViewContent setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [aController setShouldCascadeWindows:YES];
+ [super windowControllerDidLoadNib:aController];
+
+ NSEnumerator *theCols = [[variablesTableView tableColumns] objectEnumerator];
+ NSTableColumn *theCol;
+
+// [tableWindow makeKeyAndOrderFront:self];
+
+ prefs = [[NSUserDefaults standardUserDefaults] retain];
+ selectedFavorite = [[NSString alloc] initWithString:NSLocalizedString(@"Custom", @"menu item for custom connection")];
+
+ //register for notifications
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willPerformQuery:)
+ name:@"SMySQLQueryWillBePerformed" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hasPerformedQuery:)
+ name:@"SMySQLQueryHasBeenPerformed" object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:)
+ name:@"NSApplicationWillTerminateNotification" object:nil];
+
+ //set up interface
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [consoleTextView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [syntaxViewContent setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- while ( (theCol = [theCols nextObject]) ) {
- [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
- }
- } else {
- [consoleTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [syntaxViewContent setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- while ( (theCol = [theCols nextObject]) ) {
- [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
- }
- [consoleDrawer setContentSize:NSMakeSize(110,110)];
-
- //set up toolbar
- [self setupToolbar];
-// [self connectToDB:nil];
+ while ( (theCol = [theCols nextObject]) ) {
+ [[theCol dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
+ }
+ } else {
+ [consoleTextView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [syntaxViewContent setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ while ( (theCol = [theCols nextObject]) ) {
+ [[theCol dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+ }
+ [consoleDrawer setContentSize:NSMakeSize(110,110)];
+
+ //set up toolbar
+ [self setupToolbar];
+// [self connectToDB:nil];
[self performSelector:@selector(connectToDB:) withObject:tableWindow afterDelay:0.0f];
}
- (void)windowWillClose:(NSNotification *)aNotification
{
- [self closeConnection];
+ [self closeConnection];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
}
@@ -1463,11 +1463,11 @@ sets upt the interface (small fonts)
invoked when the document window should close
*/
{
- if ( ![tablesListInstance selectionShouldChangeInTableView:nil] ) {
- return NO;
- } else {
- return YES;
- }
+ if ( ![tablesListInstance selectionShouldChangeInTableView:nil] ) {
+ return NO;
+ } else {
+ return YES;
+ }
}
@@ -1478,9 +1478,9 @@ invoked when the document window should close
invoked when framework will perform a query
*/
{
- NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil];
-
- [self showMessageInConsole:[NSString stringWithFormat:@"/* MySQL %@ */ %@;\n", currentTime, query]];
+ NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil];
+
+ [self showMessageInConsole:[NSString stringWithFormat:@"/* MySQL %@ */ %@;\n", currentTime, query]];
}
- (void)queryGaveError:(NSString *)error
@@ -1488,9 +1488,9 @@ invoked when framework will perform a query
invoked when query gave an error
*/
{
- NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil];
-
- [self showErrorInConsole:[NSString stringWithFormat:@"/* ERROR %@ */ %@;\n", currentTime, error]];
+ NSString *currentTime = [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:nil];
+
+ [self showErrorInConsole:[NSString stringWithFormat:@"/* ERROR %@ */ %@;\n", currentTime, error]];
}
#pragma mark SplitView delegate methods
@@ -1537,7 +1537,7 @@ invoked when query gave an error
{
// make sure the toolbar item is actually in the toolbar
if (!chooseDatabaseToolbarItem)
- return;
+ return;
// grab the width of the left pane
float leftPaneWidth = [dbTablesTableView frame].size.width;
@@ -1547,9 +1547,9 @@ invoked when query gave an error
// make sure it's not too small or to big
if (leftPaneWidth < 130)
- leftPaneWidth = 130;
+ leftPaneWidth = 130;
if (leftPaneWidth > 360)
- leftPaneWidth = 360;
+ leftPaneWidth = 360;
// apply the size
[chooseDatabaseToolbarItem setMinSize:NSMakeSize(leftPaneWidth, 26)];
@@ -1560,22 +1560,22 @@ invoked when query gave an error
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [variables count];
+ return [variables count];
}
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
id theValue;
theValue = [[variables objectAtIndex:rowIndex] objectForKey:[aTableColumn identifier]];
- if ( [theValue isKindOfClass:[NSData class]] ) {
- theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
- }
+ if ( [theValue isKindOfClass:[NSData class]] ) {
+ theValue = [[NSString alloc] initWithData:theValue encoding:[mySQLConnection encoding]];
+ }
- return theValue;
+ return theValue;
}
- (IBAction)terminate:(id)sender
diff --git a/TableDump.h b/TableDump.h
index 80492492..b45dc5a8 100644
--- a/TableDump.h
+++ b/TableDump.h
@@ -30,59 +30,59 @@
@interface TableDump : NSObject {
- IBOutlet id tableDocumentInstance;
- IBOutlet id tablesListInstance;
- IBOutlet id tableSourceInstance;
- IBOutlet id tableContentInstance;
- IBOutlet id customQueryInstance;
+ IBOutlet id tableDocumentInstance;
+ IBOutlet id tablesListInstance;
+ IBOutlet id tableSourceInstance;
+ IBOutlet id tableContentInstance;
+ IBOutlet id customQueryInstance;
- IBOutlet id tableWindow;
- IBOutlet id exportDumpView;
- IBOutlet id exportCSVView;
- IBOutlet id exportMultipleCSVView;
- IBOutlet id exportMultipleXMLView;
- IBOutlet id exportDumpTableView;
- IBOutlet id exportMultipleCSVTableView;
- IBOutlet id exportMultipleXMLTableView;
- IBOutlet id exportFieldNamesSwitch;
- IBOutlet id exportFieldsTerminatedField;
- IBOutlet id exportFieldsEnclosedField;
- IBOutlet id exportFieldsEscapedField;
- IBOutlet id exportLinesTerminatedField;
- IBOutlet id exportMultipleFieldNamesSwitch;
- IBOutlet id exportMultipleFieldsTerminatedField;
- IBOutlet id exportMultipleFieldsEnclosedField;
- IBOutlet id exportMultipleFieldsEscapedField;
- IBOutlet id exportMultipleLinesTerminatedField;
- IBOutlet id importCSVView;
- IBOutlet id importFieldNamesSwitch;
- IBOutlet id importFieldsTerminatedField;
- IBOutlet id importFieldsEnclosedField;
- IBOutlet id importFieldsEscapedField;
- IBOutlet id importLinesTerminatedField;
- IBOutlet id addDropTableSwitch;
- IBOutlet id addCreateTableSwitch;
- IBOutlet id addTableContentSwitch;
- IBOutlet id addErrorsSwitch;
- IBOutlet id errorsSheet;
- IBOutlet id errorsView;
- IBOutlet id singleProgressSheet;
- IBOutlet id singleProgressBar;
- IBOutlet id singleProgressText;
- IBOutlet id fieldMappingSheet;
- IBOutlet id rowUpButton;
- IBOutlet id rowDownButton;
- IBOutlet id fieldMappingTableView;
+ IBOutlet id tableWindow;
+ IBOutlet id exportDumpView;
+ IBOutlet id exportCSVView;
+ IBOutlet id exportMultipleCSVView;
+ IBOutlet id exportMultipleXMLView;
+ IBOutlet id exportDumpTableView;
+ IBOutlet id exportMultipleCSVTableView;
+ IBOutlet id exportMultipleXMLTableView;
+ IBOutlet id exportFieldNamesSwitch;
+ IBOutlet id exportFieldsTerminatedField;
+ IBOutlet id exportFieldsEnclosedField;
+ IBOutlet id exportFieldsEscapedField;
+ IBOutlet id exportLinesTerminatedField;
+ IBOutlet id exportMultipleFieldNamesSwitch;
+ IBOutlet id exportMultipleFieldsTerminatedField;
+ IBOutlet id exportMultipleFieldsEnclosedField;
+ IBOutlet id exportMultipleFieldsEscapedField;
+ IBOutlet id exportMultipleLinesTerminatedField;
+ IBOutlet id importCSVView;
+ IBOutlet id importFieldNamesSwitch;
+ IBOutlet id importFieldsTerminatedField;
+ IBOutlet id importFieldsEnclosedField;
+ IBOutlet id importFieldsEscapedField;
+ IBOutlet id importLinesTerminatedField;
+ IBOutlet id addDropTableSwitch;
+ IBOutlet id addCreateTableSwitch;
+ IBOutlet id addTableContentSwitch;
+ IBOutlet id addErrorsSwitch;
+ IBOutlet id errorsSheet;
+ IBOutlet id errorsView;
+ IBOutlet id singleProgressSheet;
+ IBOutlet id singleProgressBar;
+ IBOutlet id singleProgressText;
+ IBOutlet id fieldMappingSheet;
+ IBOutlet id rowUpButton;
+ IBOutlet id rowDownButton;
+ IBOutlet id fieldMappingTableView;
- CMMCPConnection *mySQLConnection;
+ CMMCPConnection *mySQLConnection;
- NSMutableArray *tables;
- NSArray *importArray;
- NSMutableArray *fieldMappingArray;
- int currentRow;
- NSString *savePath;
- NSString *openPath;
- NSUserDefaults *prefs;
+ NSMutableArray *tables;
+ NSArray *importArray;
+ NSMutableArray *fieldMappingArray;
+ int currentRow;
+ NSString *savePath;
+ NSString *openPath;
+ NSUserDefaults *prefs;
}
//IBAction methods
@@ -106,14 +106,14 @@
//format methods
- (NSString *)dumpForSelectedTables;
- (NSString *)csvForArray:(NSArray *)array useFirstLine:(BOOL)firstLine terminatedBy:(NSString *)terminated
- enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds silently:(BOOL)silently;
+ enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds silently:(BOOL)silently;
- (NSArray *)arrayForCSV:(NSString *)csv terminatedBy:(NSString *)terminated
- enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds;
+ enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds;
- (NSString *)xmlForArray:(NSArray *)array tableName:(NSString *)table withHeader:(BOOL)header silently:(BOOL)silently;
- (NSString *)stringForSelectedTablesWithType:(NSString *)type;
- (NSString *)htmlEscapeString:(NSString *)string;
- (NSArray *)arrayForString:(NSString *)string enclosed:(NSString *)enclosed
- escaped:(NSString *)escaped terminated:(NSString *)terminated;
+ escaped:(NSString *)escaped terminated:(NSString *)terminated;
- (NSArray *)splitQueries:(NSString *)query;
//additional methods
@@ -122,12 +122,12 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
//last but not least
- (id)init;
diff --git a/TableDump.m b/TableDump.m
index d5d0eaa3..5687eab1 100644
--- a/TableDump.m
+++ b/TableDump.m
@@ -39,33 +39,33 @@
get the tables in db
*/
{
- CMMCPResult *queryResult;
- int i;
+ CMMCPResult *queryResult;
+ int i;
//get tables
- [tables removeAllObjects];
- queryResult = [mySQLConnection listTables];
- for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
- [queryResult dataSeek:i];
- [tables addObject:[NSMutableArray arrayWithObjects:
- [NSNumber numberWithBool:YES], [[queryResult fetchRowAsArray] objectAtIndex:0], nil]];
- }
-
- [exportDumpTableView reloadData];
- [exportMultipleCSVTableView reloadData];
- [exportMultipleXMLTableView reloadData];
+ [tables removeAllObjects];
+ queryResult = [mySQLConnection listTables];
+ for ( i = 0 ; i < [queryResult numOfRows] ; i++ ) {
+ [queryResult dataSeek:i];
+ [tables addObject:[NSMutableArray arrayWithObjects:
+ [NSNumber numberWithBool:YES], [[queryResult fetchRowAsArray] objectAtIndex:0], nil]];
+ }
+
+ [exportDumpTableView reloadData];
+ [exportMultipleCSVTableView reloadData];
+ [exportMultipleXMLTableView reloadData];
/*
//disable buttons if there are no tables in db (or no db is selected)
- if ( ![tables count] ) {
- [dumpButton setEnabled:NO];
- } else {
- [dumpButton setEnabled:YES];
- }
- if ( ![tableDocumentInstance database] ) {
- [readButton setEnabled:NO];
- } else {
- [readButton setEnabled:YES];
- }
+ if ( ![tables count] ) {
+ [dumpButton setEnabled:NO];
+ } else {
+ [dumpButton setEnabled:YES];
+ }
+ if ( ![tableDocumentInstance database] ) {
+ [readButton setEnabled:NO];
+ } else {
+ [readButton setEnabled:YES];
+ }
*/
}
@@ -74,23 +74,23 @@ get the tables in db
selects or deselects all tables
*/
{
- NSEnumerator *enumerator;
- id theObject;
-
- [self reloadTables:self];
-
- enumerator = [tables objectEnumerator];
- while ( (theObject = [enumerator nextObject]) ) {
- if ( [sender tag] ) {
- [theObject replaceObjectAtIndex:0 withObject:[NSNumber numberWithBool:YES]];
- } else {
- [theObject replaceObjectAtIndex:0 withObject:[NSNumber numberWithBool:NO]];
- }
- }
-
- [exportDumpTableView reloadData];
- [exportMultipleCSVTableView reloadData];
- [exportMultipleXMLTableView reloadData];
+ NSEnumerator *enumerator;
+ id theObject;
+
+ [self reloadTables:self];
+
+ enumerator = [tables objectEnumerator];
+ while ( (theObject = [enumerator nextObject]) ) {
+ if ( [sender tag] ) {
+ [theObject replaceObjectAtIndex:0 withObject:[NSNumber numberWithBool:YES]];
+ } else {
+ [theObject replaceObjectAtIndex:0 withObject:[NSNumber numberWithBool:NO]];
+ }
+ }
+
+ [exportDumpTableView reloadData];
+ [exportMultipleCSVTableView reloadData];
+ [exportMultipleXMLTableView reloadData];
}
- (IBAction)closeSheet:(id)sender
@@ -98,7 +98,7 @@ selects or deselects all tables
ends the modal session
*/
{
- [NSApp stopModalWithCode:[sender tag]];
+ [NSApp stopModalWithCode:[sender tag]];
}
- (IBAction)stepRow:(id)sender
@@ -106,25 +106,25 @@ ends the modal session
displays next/previous row in fieldMapping tableView
*/
{
- if ( [sender tag] == 0 ) {
- currentRow--;
- [self setupFieldMappingArray];
- } else {
- currentRow++;
- [self setupFieldMappingArray];
- }
-
- //enable/disable buttons
- if ( currentRow == 0 ) {
- [rowDownButton setEnabled:NO];
- [rowUpButton setEnabled:YES];
- } else if ( currentRow == ([importArray count]-1) ) {
- [rowDownButton setEnabled:YES];
- [rowUpButton setEnabled:NO];
- } else {
- [rowDownButton setEnabled:YES];
- [rowUpButton setEnabled:YES];
- }
+ if ( [sender tag] == 0 ) {
+ currentRow--;
+ [self setupFieldMappingArray];
+ } else {
+ currentRow++;
+ [self setupFieldMappingArray];
+ }
+
+ //enable/disable buttons
+ if ( currentRow == 0 ) {
+ [rowDownButton setEnabled:NO];
+ [rowUpButton setEnabled:YES];
+ } else if ( currentRow == ([importArray count]-1) ) {
+ [rowDownButton setEnabled:YES];
+ [rowUpButton setEnabled:NO];
+ } else {
+ [rowDownButton setEnabled:YES];
+ [rowUpButton setEnabled:YES];
+ }
}
@@ -134,64 +134,64 @@ displays next/previous row in fieldMapping tableView
invoked when user clicks on an export menuItem
*/
{
- NSString *file;
- NSString *contextInfo;
- NSSavePanel *savePanel = [NSSavePanel savePanel];
- NSString *currentDate = [[NSDate date] descriptionWithCalendarFormat:@"%d.%m.%Y" timeZone:nil locale:nil];
-
- switch ( tag ) {
- case 5:
- //export dump
- [self reloadTables:self];
- file = [NSString stringWithFormat:@"%@_dump %@.sql", [tableDocumentInstance database], currentDate];
- [savePanel setAccessoryView:exportDumpView];
- contextInfo = @"exportDump";
- break;
- case 6:
- //export table content as CSV
- file = [NSString stringWithFormat:@"%@.csv", [tableDocumentInstance table]];
- [savePanel setAccessoryView:exportCSVView];
- contextInfo = @"exportTableContentAsCSV";
- break;
- case 7:
- //export table content as XML
- file = [NSString stringWithFormat:@"%@.xml", [tableDocumentInstance table]];
- contextInfo = @"exportTableContentAsXML";
- break;
- case 8:
- //export custom result as CSV
- file = @"customresult.csv";
- [savePanel setAccessoryView:exportCSVView];
- contextInfo = @"exportCustomResultAsCSV";
- break;
- case 9:
- //export custom result as XML
- file = @"customresult.xml";
- contextInfo = @"exportCustomResultAsXML";
- break;
- case 10:
- //export multiple tables as CSV
- [self reloadTables:self];
- file = [NSString stringWithFormat:@"%@.csv", [tableDocumentInstance database]];
- [savePanel setAccessoryView:exportMultipleCSVView];
- contextInfo = @"exportMultipleTablesAsCSV";
- break;
- case 11:
- //export multiple tables as XML
- [self reloadTables:self];
- file = [NSString stringWithFormat:@"%@.xml", [tableDocumentInstance database]];
- [savePanel setAccessoryView:exportMultipleXMLView];
- contextInfo = @"exportMultipleTablesAsXML";
- break;
- default:
- NSLog(@"ERROR: unknown export item with tag %d", tag);
- return;
- break;
- }
- //open savePanel
- [savePanel beginSheetForDirectory:[prefs objectForKey:@"savePath"]
- file:file modalForWindow:tableWindow modalDelegate:self
- didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo];
+ NSString *file;
+ NSString *contextInfo;
+ NSSavePanel *savePanel = [NSSavePanel savePanel];
+ NSString *currentDate = [[NSDate date] descriptionWithCalendarFormat:@"%d.%m.%Y" timeZone:nil locale:nil];
+
+ switch ( tag ) {
+ case 5:
+ //export dump
+ [self reloadTables:self];
+ file = [NSString stringWithFormat:@"%@_dump %@.sql", [tableDocumentInstance database], currentDate];
+ [savePanel setAccessoryView:exportDumpView];
+ contextInfo = @"exportDump";
+ break;
+ case 6:
+ //export table content as CSV
+ file = [NSString stringWithFormat:@"%@.csv", [tableDocumentInstance table]];
+ [savePanel setAccessoryView:exportCSVView];
+ contextInfo = @"exportTableContentAsCSV";
+ break;
+ case 7:
+ //export table content as XML
+ file = [NSString stringWithFormat:@"%@.xml", [tableDocumentInstance table]];
+ contextInfo = @"exportTableContentAsXML";
+ break;
+ case 8:
+ //export custom result as CSV
+ file = @"customresult.csv";
+ [savePanel setAccessoryView:exportCSVView];
+ contextInfo = @"exportCustomResultAsCSV";
+ break;
+ case 9:
+ //export custom result as XML
+ file = @"customresult.xml";
+ contextInfo = @"exportCustomResultAsXML";
+ break;
+ case 10:
+ //export multiple tables as CSV
+ [self reloadTables:self];
+ file = [NSString stringWithFormat:@"%@.csv", [tableDocumentInstance database]];
+ [savePanel setAccessoryView:exportMultipleCSVView];
+ contextInfo = @"exportMultipleTablesAsCSV";
+ break;
+ case 11:
+ //export multiple tables as XML
+ [self reloadTables:self];
+ file = [NSString stringWithFormat:@"%@.xml", [tableDocumentInstance database]];
+ [savePanel setAccessoryView:exportMultipleXMLView];
+ contextInfo = @"exportMultipleTablesAsXML";
+ break;
+ default:
+ NSLog(@"ERROR: unknown export item with tag %d", tag);
+ return;
+ break;
+ }
+ //open savePanel
+ [savePanel beginSheetForDirectory:[prefs objectForKey:@"savePath"]
+ file:file modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo];
}
- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
@@ -199,87 +199,88 @@ invoked when user clicks on an export menuItem
saves the export file
*/
{
- NSString *testString = @"";
+ NSString *testString = @"";
NSError **errorStr;
- id fileContent;
+ id fileContent;
BOOL success;
-
- [sheet orderOut:self];
- if ( returnCode != NSOKButton )
- return;
+
+ [sheet orderOut:self];
+ if ( returnCode != NSOKButton )
+ return;
//save path to preferences
- [prefs setObject:[sheet directory] forKey:@"savePath"];
+ [prefs setObject:[sheet directory] forKey:@"savePath"];
//error if file exists and is not writable
- if ( [[NSFileManager defaultManager] fileExistsAtPath:[sheet filename]] ) {
- if ( ![[NSFileManager defaultManager] isWritableFileAtPath:[sheet filename]] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"Couldn't replace the file. Be sure that you have the necessary privileges.", @"message of panel when file cannot be replaced"));
- return;
- }
- } else {
+ if ( [[NSFileManager defaultManager] fileExistsAtPath:[sheet filename]] ) {
+ if ( ![[NSFileManager defaultManager] isWritableFileAtPath:[sheet filename]] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"Couldn't replace the file. Be sure that you have the necessary privileges.", @"message of panel when file cannot be replaced"));
+ return;
+ }
+ } else {
//error if file cannot be written
- if ( ![testString writeToFile:[sheet filename] atomically:YES] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"Couldn't write to file. Be sure that you have the necessary privileges.", @"message of panel when file cannot be written"));
- return;
- }
- }
-
- if ( [contextInfo isEqualToString:@"exportDump"] ) {
- //export dump of selected database
- fileContent = [self dumpForSelectedTables];
- } else if ( [contextInfo isEqualToString:@"exportCustomResultAsCSV"] ) {
- //export custom query result as csv
- fileContent = [self csvForArray:[customQueryInstance currentResult] useFirstLine:[exportFieldNamesSwitch state]
- terminatedBy:[exportFieldsTerminatedField stringValue]
- enclosedBy:[exportFieldsEnclosedField stringValue]
- escapedBy:[exportFieldsEscapedField stringValue]
- lineEnds:[exportLinesTerminatedField stringValue]
- silently:NO];
- } else if ( [contextInfo isEqualToString:@"exportTableContentAsCSV"] ) {
- //export table content as csv
- fileContent = [self csvForArray:[tableContentInstance currentResult] useFirstLine:[exportFieldNamesSwitch state]
- terminatedBy:[exportFieldsTerminatedField stringValue]
- enclosedBy:[exportFieldsEnclosedField stringValue]
- escapedBy:[exportFieldsEscapedField stringValue]
- lineEnds:[exportLinesTerminatedField stringValue]
- silently:NO];
- } else if ( [contextInfo isEqualToString:@"exportMultipleTablesAsCSV"] ) {
- //export multiple tables as CSV
- fileContent = [self stringForSelectedTablesWithType:@"csv"];
- } else if ( [contextInfo isEqualToString:@"exportCustomResultAsXML"] ) {
- //export custom query result as XML
- fileContent = [self xmlForArray:[customQueryInstance currentResult]
- tableName:@"custom"
- withHeader:YES
- silently:NO];
- } else if ( [contextInfo isEqualToString:@"exportTableContentAsXML"] ) {
- //export table content as XML
- fileContent = [self xmlForArray:[tableContentInstance currentResult]
- tableName:[tableDocumentInstance table]
- withHeader:YES
- silently:NO];
- } else if ( [contextInfo isEqualToString:@"exportMultipleTablesAsXML"] ) {
- //export multiple tables as XML
- fileContent = [self stringForSelectedTablesWithType:@"xml"];
- } else {
- //unknown operation
- NSLog(@"unknown operation %@", [contextInfo description]);
- fileContent = @"";
- }
+ // MLT: Need to use make use of NSError here
+ if ( ![testString writeToFile:[sheet filename] atomically:YES encoding:NSUTF8StringEncoding error:nil] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"Couldn't write to file. Be sure that you have the necessary privileges.", @"message of panel when file cannot be written"));
+ return;
+ }
+ }
+
+ if ( [contextInfo isEqualToString:@"exportDump"] ) {
+ //export dump of selected database
+ fileContent = [self dumpForSelectedTables];
+ } else if ( [contextInfo isEqualToString:@"exportCustomResultAsCSV"] ) {
+ //export custom query result as csv
+ fileContent = [self csvForArray:[customQueryInstance currentResult] useFirstLine:[exportFieldNamesSwitch state]
+ terminatedBy:[exportFieldsTerminatedField stringValue]
+ enclosedBy:[exportFieldsEnclosedField stringValue]
+ escapedBy:[exportFieldsEscapedField stringValue]
+ lineEnds:[exportLinesTerminatedField stringValue]
+ silently:NO];
+ } else if ( [contextInfo isEqualToString:@"exportTableContentAsCSV"] ) {
+ //export table content as csv
+ fileContent = [self csvForArray:[tableContentInstance currentResult] useFirstLine:[exportFieldNamesSwitch state]
+ terminatedBy:[exportFieldsTerminatedField stringValue]
+ enclosedBy:[exportFieldsEnclosedField stringValue]
+ escapedBy:[exportFieldsEscapedField stringValue]
+ lineEnds:[exportLinesTerminatedField stringValue]
+ silently:NO];
+ } else if ( [contextInfo isEqualToString:@"exportMultipleTablesAsCSV"] ) {
+ //export multiple tables as CSV
+ fileContent = [self stringForSelectedTablesWithType:@"csv"];
+ } else if ( [contextInfo isEqualToString:@"exportCustomResultAsXML"] ) {
+ //export custom query result as XML
+ fileContent = [self xmlForArray:[customQueryInstance currentResult]
+ tableName:@"custom"
+ withHeader:YES
+ silently:NO];
+ } else if ( [contextInfo isEqualToString:@"exportTableContentAsXML"] ) {
+ //export table content as XML
+ fileContent = [self xmlForArray:[tableContentInstance currentResult]
+ tableName:[tableDocumentInstance table]
+ withHeader:YES
+ silently:NO];
+ } else if ( [contextInfo isEqualToString:@"exportMultipleTablesAsXML"] ) {
+ //export multiple tables as XML
+ fileContent = [self stringForSelectedTablesWithType:@"xml"];
+ } else {
+ //unknown operation
+ NSLog(@"unknown operation %@", [contextInfo description]);
+ fileContent = @"";
+ }
if ( [fileContent respondsToSelector:@selector(writeToFile:atomically:encoding:error:)] ) {
// mac os 10.4 or later
- success = [fileContent writeToFile:[sheet filename] atomically:YES encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance encoding] cString]] error:errorStr];
+ success = [fileContent writeToFile:[sheet filename] atomically:YES encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance encoding] UTF8String]] error:errorStr];
} else {
// mac os pre 10.4
success = [fileContent writeToFile:[sheet filename] atomically:YES];
}
- if ( !success ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"Couldn't write to file. Be sure that you have the necessary privileges.", @"message of panel when file cannot be written"));
- }
+ if ( !success ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"Couldn't write to file. Be sure that you have the necessary privileges.", @"message of panel when file cannot be written"));
+ }
// Export Finished Growl Notification
[GrowlApplicationBridge notifyWithTitle:@"Export Finished"
@@ -300,9 +301,9 @@ saves the export file
opens the NSOpenPanel
{
- [[NSOpenPanel openPanel] beginSheetForDirectory:[prefs objectForKey:@"openPath"] file:nil types:nil
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
+ [[NSOpenPanel openPanel] beginSheetForDirectory:[prefs objectForKey:@"openPath"] file:nil types:nil
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:nil];
}
*/
@@ -311,28 +312,28 @@ opens the NSOpenPanel
invoked when user clicks on an export menuItem
*/
{
- NSString *contextInfo;
- NSOpenPanel *openPanel = [NSOpenPanel openPanel];
-
- switch ( tag ) {
- case 1:
- //import dump
- contextInfo = @"importDump";
- break;
- case 2:
- //import CSV file
- [openPanel setAccessoryView:importCSVView];
- contextInfo = @"importCSVFile";
- break;
- default:
- NSLog(@"ERROR: unknown import item with tag %d", tag);
- return;
- break;
- }
- //open savePanel
- [openPanel beginSheetForDirectory:[prefs objectForKey:@"openPath"]
- file:nil modalForWindow:tableWindow modalDelegate:self
- didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo];
+ NSString *contextInfo;
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+
+ switch ( tag ) {
+ case 1:
+ //import dump
+ contextInfo = @"importDump";
+ break;
+ case 2:
+ //import CSV file
+ [openPanel setAccessoryView:importCSVView];
+ contextInfo = @"importCSVFile";
+ break;
+ default:
+ NSLog(@"ERROR: unknown import item with tag %d", tag);
+ return;
+ break;
+ }
+ //open savePanel
+ [openPanel beginSheetForDirectory:[prefs objectForKey:@"openPath"]
+ file:nil modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:contextInfo];
}
- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
@@ -340,205 +341,205 @@ invoked when user clicks on an export menuItem
reads mysql-dumpfile
*/
{
- NSString *dumpFile;
+ NSString *dumpFile;
NSError **errorStr;
- NSMutableString *errors = [NSMutableString string];
+ NSMutableString *errors = [NSMutableString string];
- [sheet orderOut:self];
- if ( returnCode != NSOKButton )
- return;
+ [sheet orderOut:self];
+ if ( returnCode != NSOKButton )
+ return;
//save path to preferences
- [prefs setObject:[sheet directory] forKey:@"openPath"];
+ [prefs setObject:[sheet directory] forKey:@"openPath"];
//load file into string
if ( [NSString respondsToSelector:@selector(stringWithContentsOfFile:encoding:error:)] ) {
// mac os 10.4 or later
- dumpFile = [NSString stringWithContentsOfFile:[sheet filename] encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance encoding] cString]] error:errorStr];
+ dumpFile = [NSString stringWithContentsOfFile:[sheet filename] encoding:[CMMCPConnection encodingForMySQLEncoding:[[tableDocumentInstance encoding] UTF8String]] error:errorStr];
} else {
// mac os pre 10.4
dumpFile = [NSString stringWithContentsOfFile:[sheet filename]];
}
- if ( !dumpFile ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"Couldn't open file. Be sure that the path is correct and that you have the necessary privileges.", @"message of panel when file cannot be opened"));
- return;
- }
+ if ( !dumpFile ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"Couldn't open file. Be sure that the path is correct and that you have the necessary privileges.", @"message of panel when file cannot be opened"));
+ return;
+ }
//reset interface
- [errorsView setString:@""];
- [errorsView displayIfNeeded];
- [singleProgressText setStringValue:NSLocalizedString(@"Reading...", @"text showing that app is reading dump")];
- [singleProgressText displayIfNeeded];
- [singleProgressBar setDoubleValue:0];
- [singleProgressBar displayIfNeeded];
-
- if ( [contextInfo isEqualToString:@"importDump"] ) {
+ [errorsView setString:@""];
+ [errorsView displayIfNeeded];
+ [singleProgressText setStringValue:NSLocalizedString(@"Reading...", @"text showing that app is reading dump")];
+ [singleProgressText displayIfNeeded];
+ [singleProgressBar setDoubleValue:0];
+ [singleProgressBar displayIfNeeded];
+
+ if ( [contextInfo isEqualToString:@"importDump"] ) {
//import dump file
- NSArray *queries;
- int i;
-
- //open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [singleProgressBar setIndeterminate:YES];
- [singleProgressBar setUsesThreadedAnimation:YES];
- [singleProgressBar startAnimation:self];
- //get array with an object for each mysql-query
-// queries = [dumpFile componentsSeparatedByString:@";\n"];
- queries = [self splitQueries:dumpFile];
-
- [singleProgressBar stopAnimation:self];
- [singleProgressBar setUsesThreadedAnimation:NO];
- [singleProgressBar setIndeterminate:NO];
- //perform all mysql-queries
- for ( i = 0 ; i < [queries count] ; i++ ) {
- [singleProgressBar setDoubleValue:((i+1)*100/[queries count])];
- [singleProgressBar displayIfNeeded];
- [mySQLConnection queryString:[queries objectAtIndex:i]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""]
- && ![[mySQLConnection getLastErrorMessage] isEqualToString:@"Query was empty"])
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"), (i+1),[mySQLConnection getLastErrorMessage]]];
- }
- //close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
- //display errors
- if ( [errors length] ) {
- [errorsView setString:errors];
- [NSApp beginSheet:errorsSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:errorsSheet];
-
- [NSApp endSheet:errorsSheet];
- [errorsSheet orderOut:nil];
- }
- } else if ( [contextInfo isEqualToString:@"importCSVFile"] ) {
+ NSArray *queries;
+ int i;
+
+ //open progress sheet
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [singleProgressBar setIndeterminate:YES];
+ [singleProgressBar setUsesThreadedAnimation:YES];
+ [singleProgressBar startAnimation:self];
+ //get array with an object for each mysql-query
+// queries = [dumpFile componentsSeparatedByString:@";\n"];
+ queries = [self splitQueries:dumpFile];
+
+ [singleProgressBar stopAnimation:self];
+ [singleProgressBar setUsesThreadedAnimation:NO];
+ [singleProgressBar setIndeterminate:NO];
+ //perform all mysql-queries
+ for ( i = 0 ; i < [queries count] ; i++ ) {
+ [singleProgressBar setDoubleValue:((i+1)*100/[queries count])];
+ [singleProgressBar displayIfNeeded];
+ [mySQLConnection queryString:[queries objectAtIndex:i]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""]
+ && ![[mySQLConnection getLastErrorMessage] isEqualToString:@"Query was empty"])
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in query %d] %@\n", @"error text when multiple custom query failed"), (i+1),[mySQLConnection getLastErrorMessage]]];
+ }
+ //close progress sheet
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+ //display errors
+ if ( [errors length] ) {
+ [errorsView setString:errors];
+ [NSApp beginSheet:errorsSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:errorsSheet];
+
+ [NSApp endSheet:errorsSheet];
+ [errorsSheet orderOut:nil];
+ }
+ } else if ( [contextInfo isEqualToString:@"importCSVFile"] ) {
//import csv file
- int code;
- NSPopUpButtonCell *buttonCell = [[NSPopUpButtonCell alloc] init];
-
- //open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [singleProgressBar setIndeterminate:YES];
- [singleProgressBar setUsesThreadedAnimation:YES];
- [singleProgressBar startAnimation:self];
- //put file in array
- if ( importArray )
- [importArray release];
- importArray = [[self arrayForCSV:dumpFile
- terminatedBy:[importFieldsTerminatedField stringValue]
- enclosedBy:[importFieldsEnclosedField stringValue]
- escapedBy:[importFieldsEscapedField stringValue]
- lineEnds:[importLinesTerminatedField stringValue]] retain];
- //close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
- [singleProgressBar stopAnimation:self];
- [singleProgressBar setUsesThreadedAnimation:NO];
- [singleProgressBar setIndeterminate:NO];
- //show fieldMapping sheet
- //set up tableView
- currentRow = 0;
- fieldMappingArray = nil;
- [self setupFieldMappingArray];
- [rowDownButton setEnabled:NO];
- if ( [importArray count] > 1 ) {
- [rowUpButton setEnabled:YES];
- } else {
- [rowUpButton setEnabled:NO];
- }
- //set up tableView buttons
- [buttonCell setControlSize:NSSmallControlSize];
- [buttonCell setFont:[NSFont labelFontOfSize:[NSFont smallSystemFontSize]]];
- [buttonCell addItemWithTitle:NSLocalizedString(@"Do not import", @"text for csv import drop downs")];
- [buttonCell addItemsWithTitles:[tableSourceInstance fieldNames]];
- [[fieldMappingTableView tableColumnWithIdentifier:@"1"] setDataCell:buttonCell];
- [NSApp beginSheet:fieldMappingSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:fieldMappingSheet];
-
- [NSApp endSheet:fieldMappingSheet];
- [fieldMappingSheet orderOut:nil];
-
- if ( code ) {
- //import array into db
- NSMutableString *fNames = [NSMutableString string];
- NSMutableArray *fValuesIndexes = [NSMutableArray array];
- NSMutableString *fValues = [NSMutableString string];
- int i,j;
-
- //open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
-
- //get fields to be imported
- for ( i = 0 ; i < [fieldMappingArray count] ; i++ ) {
- if ( [[[fieldMappingArray objectAtIndex:i] objectAtIndex:1] intValue] > 0 ) {
- //field marked for import
- if ( [fNames length] )
- [fNames appendString:@","];
- [fNames appendString:[NSString stringWithFormat:@"`%@`",
- [[tableSourceInstance fieldNames] objectAtIndex:([[[fieldMappingArray objectAtIndex:i] objectAtIndex:1] intValue]-1)]]];
- [fValuesIndexes addObject:[NSNumber numberWithInt:i]];
- }
- }
- //import array
- for ( i = 0 ; i < [importArray count] ; i++ ) {
- //show progress bar
- [singleProgressBar setDoubleValue:((i+1)*100/[importArray count])];
- [singleProgressBar displayIfNeeded];
- if ( ![importFieldNamesSwitch state] || (i != 0) ) {
- //put values in string
- [fValues setString:@""];
- for ( j = 0 ; j < [fValuesIndexes count] ; j++ ) {
- if ( [fValues length] )
- [fValues appendString:@","];
- if ( [[[importArray objectAtIndex:i] objectAtIndex:[[fValuesIndexes objectAtIndex:j] intValue]]
- isMemberOfClass:[NSNull class]] ) {
- [fValues appendString:@"NULL"];
- } else {
- [fValues appendString:[NSString stringWithFormat:@"'%@'",
- [mySQLConnection prepareString:
- [[importArray objectAtIndex:i] objectAtIndex:[[fValuesIndexes objectAtIndex:j] intValue]]]]];
-// [fValues appendString:[NSString stringWithFormat:@"\"%@\"",
-// [mySQLConnection prepareString:
-// [[importArray objectAtIndex:i] objectAtIndex:[[fValuesIndexes objectAtIndex:j] intValue]]]]];
- }
- }
- //perform query
- [mySQLConnection queryString:[NSString stringWithFormat:@"INSERT INTO `%@` (%@) VALUES (%@)",
- [tablesListInstance table],
- fNames,
- fValues]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] )
- [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in line %d] %@\n", @"error text when reading of csv file gave errors"), (i+1),[mySQLConnection getLastErrorMessage]]];
- }
- }
- //close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
- }
- //display errors
- if ( [errors length] ) {
- [errorsView setString:errors];
- [NSApp beginSheet:errorsSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:errorsSheet];
-
- [NSApp endSheet:errorsSheet];
- [errorsSheet orderOut:nil];
- }
- //free arrays
- fieldMappingArray = nil;
- importArray = nil;
- }
+ int code;
+ NSPopUpButtonCell *buttonCell = [[NSPopUpButtonCell alloc] init];
+
+ //open progress sheet
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [singleProgressBar setIndeterminate:YES];
+ [singleProgressBar setUsesThreadedAnimation:YES];
+ [singleProgressBar startAnimation:self];
+ //put file in array
+ if ( importArray )
+ [importArray release];
+ importArray = [[self arrayForCSV:dumpFile
+ terminatedBy:[importFieldsTerminatedField stringValue]
+ enclosedBy:[importFieldsEnclosedField stringValue]
+ escapedBy:[importFieldsEscapedField stringValue]
+ lineEnds:[importLinesTerminatedField stringValue]] retain];
+ //close progress sheet
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+ [singleProgressBar stopAnimation:self];
+ [singleProgressBar setUsesThreadedAnimation:NO];
+ [singleProgressBar setIndeterminate:NO];
+ //show fieldMapping sheet
+ //set up tableView
+ currentRow = 0;
+ fieldMappingArray = nil;
+ [self setupFieldMappingArray];
+ [rowDownButton setEnabled:NO];
+ if ( [importArray count] > 1 ) {
+ [rowUpButton setEnabled:YES];
+ } else {
+ [rowUpButton setEnabled:NO];
+ }
+ //set up tableView buttons
+ [buttonCell setControlSize:NSSmallControlSize];
+ [buttonCell setFont:[NSFont labelFontOfSize:[NSFont smallSystemFontSize]]];
+ [buttonCell addItemWithTitle:NSLocalizedString(@"Do not import", @"text for csv import drop downs")];
+ [buttonCell addItemsWithTitles:[tableSourceInstance fieldNames]];
+ [[fieldMappingTableView tableColumnWithIdentifier:@"1"] setDataCell:buttonCell];
+ [NSApp beginSheet:fieldMappingSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ code = [NSApp runModalForWindow:fieldMappingSheet];
+
+ [NSApp endSheet:fieldMappingSheet];
+ [fieldMappingSheet orderOut:nil];
+
+ if ( code ) {
+ //import array into db
+ NSMutableString *fNames = [NSMutableString string];
+ NSMutableArray *fValuesIndexes = [NSMutableArray array];
+ NSMutableString *fValues = [NSMutableString string];
+ int i,j;
+
+ //open progress sheet
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+
+ //get fields to be imported
+ for ( i = 0 ; i < [fieldMappingArray count] ; i++ ) {
+ if ( [[[fieldMappingArray objectAtIndex:i] objectAtIndex:1] intValue] > 0 ) {
+ //field marked for import
+ if ( [fNames length] )
+ [fNames appendString:@","];
+ [fNames appendString:[NSString stringWithFormat:@"`%@`",
+ [[tableSourceInstance fieldNames] objectAtIndex:([[[fieldMappingArray objectAtIndex:i] objectAtIndex:1] intValue]-1)]]];
+ [fValuesIndexes addObject:[NSNumber numberWithInt:i]];
+ }
+ }
+ //import array
+ for ( i = 0 ; i < [importArray count] ; i++ ) {
+ //show progress bar
+ [singleProgressBar setDoubleValue:((i+1)*100/[importArray count])];
+ [singleProgressBar displayIfNeeded];
+ if ( ![importFieldNamesSwitch state] || (i != 0) ) {
+ //put values in string
+ [fValues setString:@""];
+ for ( j = 0 ; j < [fValuesIndexes count] ; j++ ) {
+ if ( [fValues length] )
+ [fValues appendString:@","];
+ if ( [[[importArray objectAtIndex:i] objectAtIndex:[[fValuesIndexes objectAtIndex:j] intValue]]
+ isMemberOfClass:[NSNull class]] ) {
+ [fValues appendString:@"NULL"];
+ } else {
+ [fValues appendString:[NSString stringWithFormat:@"'%@'",
+ [mySQLConnection prepareString:
+ [[importArray objectAtIndex:i] objectAtIndex:[[fValuesIndexes objectAtIndex:j] intValue]]]]];
+// [fValues appendString:[NSString stringWithFormat:@"\"%@\"",
+// [mySQLConnection prepareString:
+// [[importArray objectAtIndex:i] objectAtIndex:[[fValuesIndexes objectAtIndex:j] intValue]]]]];
+ }
+ }
+ //perform query
+ [mySQLConnection queryString:[NSString stringWithFormat:@"INSERT INTO `%@` (%@) VALUES (%@)",
+ [tablesListInstance table],
+ fNames,
+ fValues]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] )
+ [errors appendString:[NSString stringWithFormat:NSLocalizedString(@"[ERROR in line %d] %@\n", @"error text when reading of csv file gave errors"), (i+1),[mySQLConnection getLastErrorMessage]]];
+ }
+ }
+ //close progress sheet
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+ }
+ //display errors
+ if ( [errors length] ) {
+ [errorsView setString:errors];
+ [NSApp beginSheet:errorsSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:errorsSheet];
+
+ [NSApp endSheet:errorsSheet];
+ [errorsSheet orderOut:nil];
+ }
+ //free arrays
+ fieldMappingArray = nil;
+ importArray = nil;
+ }
// Import Finished Growl Notification
[GrowlApplicationBridge notifyWithTitle:@"Import Finished"
@@ -557,33 +558,33 @@ reads mysql-dumpfile
sets up the fieldMapping array to be shown in the tableView
*/
{
- int i, value;
-
- if ( fieldMappingArray ) {
- for ( i = 0 ; i < [fieldMappingArray count] ; i++ ) {
- if ( [[[importArray objectAtIndex:currentRow] objectAtIndex:i] isKindOfClass:[NSNull class]] ) {
- [[fieldMappingArray objectAtIndex:i] replaceObjectAtIndex:0 withObject:@"NULL"];
- } else {
- [[fieldMappingArray objectAtIndex:i] replaceObjectAtIndex:0 withObject:[[importArray objectAtIndex:currentRow] objectAtIndex:i]];
- }
- }
- } else {
- fieldMappingArray = [NSMutableArray array];
- for ( i = 0 ; i < [[importArray objectAtIndex:currentRow] count] ; i++ ) {
- if ( i < [[tableSourceInstance fieldNames] count] ) {
- value = i + 1;
- } else {
- value = 0;
- }
- if ( [[[importArray objectAtIndex:currentRow] objectAtIndex:i] isKindOfClass:[NSNull class]] ) {
- [fieldMappingArray addObject:[NSMutableArray arrayWithObjects:@"NULL", [NSNumber numberWithInt:value], nil]];
- } else {
- [fieldMappingArray addObject:[NSMutableArray arrayWithObjects:[[importArray objectAtIndex:currentRow] objectAtIndex:i], [NSNumber numberWithInt:value], nil]];
- }
- }
- [fieldMappingArray retain];
- }
- [fieldMappingTableView reloadData];
+ int i, value;
+
+ if ( fieldMappingArray ) {
+ for ( i = 0 ; i < [fieldMappingArray count] ; i++ ) {
+ if ( [[[importArray objectAtIndex:currentRow] objectAtIndex:i] isKindOfClass:[NSNull class]] ) {
+ [[fieldMappingArray objectAtIndex:i] replaceObjectAtIndex:0 withObject:@"NULL"];
+ } else {
+ [[fieldMappingArray objectAtIndex:i] replaceObjectAtIndex:0 withObject:[[importArray objectAtIndex:currentRow] objectAtIndex:i]];
+ }
+ }
+ } else {
+ fieldMappingArray = [NSMutableArray array];
+ for ( i = 0 ; i < [[importArray objectAtIndex:currentRow] count] ; i++ ) {
+ if ( i < [[tableSourceInstance fieldNames] count] ) {
+ value = i + 1;
+ } else {
+ value = 0;
+ }
+ if ( [[[importArray objectAtIndex:currentRow] objectAtIndex:i] isKindOfClass:[NSNull class]] ) {
+ [fieldMappingArray addObject:[NSMutableArray arrayWithObjects:@"NULL", [NSNumber numberWithInt:value], nil]];
+ } else {
+ [fieldMappingArray addObject:[NSMutableArray arrayWithObjects:[[importArray objectAtIndex:currentRow] objectAtIndex:i], [NSNumber numberWithInt:value], nil]];
+ }
+ }
+ [fieldMappingArray retain];
+ }
+ [fieldMappingTableView reloadData];
}
@@ -593,380 +594,380 @@ sets up the fieldMapping array to be shown in the tableView
returns a dump string for the selected tables
*/
{
- int i,j,k,t,rowCount,tableCount;
- CMMCPResult *queryResult;
- NSString *tableName;
- NSArray *fieldNames;
- NSArray *theRow;
- NSMutableString *rowValue = [NSMutableString string];
- NSMutableArray *fieldValues;
- NSMutableString *dump = [NSMutableString string];
- NSMutableString *errors = [NSMutableString string];
+ int i,j,k,t,rowCount,tableCount;
+ CMMCPResult *queryResult;
+ NSString *tableName;
+ NSArray *fieldNames;
+ NSArray *theRow;
+ NSMutableString *rowValue = [NSMutableString string];
+ NSMutableArray *fieldValues;
+ NSMutableString *dump = [NSMutableString string];
+ NSMutableString *errors = [NSMutableString string];
id createTableSyntax;
//reset interface
- [errorsView setString:@""];
- [errorsView displayIfNeeded];
- [singleProgressText setStringValue:NSLocalizedString(@"Dumping...", @"text showing that app is writing dump")];
- [singleProgressText displayIfNeeded];
- [singleProgressBar setDoubleValue:0];
- [singleProgressBar displayIfNeeded];
+ [errorsView setString:@""];
+ [errorsView displayIfNeeded];
+ [singleProgressText setStringValue:NSLocalizedString(@"Dumping...", @"text showing that app is writing dump")];
+ [singleProgressText displayIfNeeded];
+ [singleProgressBar setDoubleValue:0];
+ [singleProgressBar displayIfNeeded];
//open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
//count tables
- tableCount = 0;
- for ( i = 0 ; i < [tables count] ; i++ ) {
- if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
- tableCount++;
- }
- }
- k = 0;
+ tableCount = 0;
+ for ( i = 0 ; i < [tables count] ; i++ ) {
+ if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
+ tableCount++;
+ }
+ }
+ k = 0;
//add header of dump-file
-// [dump appendString:[NSString stringWithFormat:@"# Tables dumped %@\n# Created by Sequel Pro (Copyright (c) 2002-2003 Lorenz Textor)\n#\n# Host: %@ Database: %@\n# ******************************\n\n", [NSDate date], [tableDocumentInstance host], [tableDocumentInstance database]]];
- [dump appendString:@"# Sequel Pro dump\n"];
- [dump appendString:[NSString stringWithFormat:@"# Version %@\n",
- [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
- [dump appendString:@"# http://code.google.com/p/sequel-pro\n#\n"];
- [dump appendString:[NSString stringWithFormat:@"# Host: %@ (MySQL %@)\n",
- [tableDocumentInstance host], [tableDocumentInstance mySQLVersion]]];
- [dump appendString:[NSString stringWithFormat:@"# Database: %@\n", [tableDocumentInstance database]]];
- [dump appendString:[NSString stringWithFormat:@"# Generation Time: %@\n", [NSDate date]]];
- [dump appendString:@"# ************************************************************\n\n"];
-
- for ( i = 0 ; i < [tables count] ; i++ ) {
- if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
- k++;
+// [dump appendString:[NSString stringWithFormat:@"# Tables dumped %@\n# Created by Sequel Pro (Copyright (c) 2002-2003 Lorenz Textor)\n#\n# Host: %@ Database: %@\n# ******************************\n\n", [NSDate date], [tableDocumentInstance host], [tableDocumentInstance database]]];
+ [dump appendString:@"# Sequel Pro dump\n"];
+ [dump appendString:[NSString stringWithFormat:@"# Version %@\n",
+ [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
+ [dump appendString:@"# http://code.google.com/p/sequel-pro\n#\n"];
+ [dump appendString:[NSString stringWithFormat:@"# Host: %@ (MySQL %@)\n",
+ [tableDocumentInstance host], [tableDocumentInstance mySQLVersion]]];
+ [dump appendString:[NSString stringWithFormat:@"# Database: %@\n", [tableDocumentInstance database]]];
+ [dump appendString:[NSString stringWithFormat:@"# Generation Time: %@\n", [NSDate date]]];
+ [dump appendString:@"# ************************************************************\n\n"];
+
+ for ( i = 0 ; i < [tables count] ; i++ ) {
+ if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
+ k++;
//set progressbar and text
- tableName = [[tables objectAtIndex:i] objectAtIndex:1];
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Dumping table %@...", @"text showing that app is dumping table"), tableName]];
- [singleProgressText displayIfNeeded];
+ tableName = [[tables objectAtIndex:i] objectAtIndex:1];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Dumping table %@...", @"text showing that app is dumping table"), tableName]];
+ [singleProgressText displayIfNeeded];
//add name of table
- [dump appendString:[NSString stringWithFormat:@"# Dump of table %@\n# ------------------------------------------------------------\n\n", tableName]];
+ [dump appendString:[NSString stringWithFormat:@"# Dump of table %@\n# ------------------------------------------------------------\n\n", tableName]];
//add drop table
- if ( [addDropTableSwitch state] == NSOnState )
- [dump appendString:[NSString stringWithFormat:@"DROP TABLE IF EXISTS `%@`;\n\n", tableName]];
+ if ( [addDropTableSwitch state] == NSOnState )
+ [dump appendString:[NSString stringWithFormat:@"DROP TABLE IF EXISTS `%@`;\n\n", tableName]];
//add create syntax for table
- if ( [addCreateTableSwitch state] == NSOnState ) {
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE TABLE `%@`", tableName]];
- if ( [queryResult numOfRows] ) {
+ if ( [addCreateTableSwitch state] == NSOnState ) {
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE TABLE `%@`", tableName]];
+ if ( [queryResult numOfRows] ) {
createTableSyntax = [[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"];
if ( [createTableSyntax isKindOfClass:[NSData class]] ) {
createTableSyntax = [[[NSString alloc] initWithData:createTableSyntax encoding:[mySQLConnection encoding]] autorelease];
}
- [dump appendString:[NSString stringWithFormat:@"%@;\n\n", createTableSyntax]];
+ [dump appendString:[NSString stringWithFormat:@"%@;\n\n", createTableSyntax]];
}
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
- if ( [addErrorsSwitch state] == NSOnState ) {
- [dump appendString:[NSString stringWithFormat:@"# Error: %@\n", [mySQLConnection getLastErrorMessage]]];
- }
- }
- }
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
+ if ( [addErrorsSwitch state] == NSOnState ) {
+ [dump appendString:[NSString stringWithFormat:@"# Error: %@\n", [mySQLConnection getLastErrorMessage]]];
+ }
+ }
+ }
//add table content
- if ( [addTableContentSwitch state] == NSOnState ) {
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@`", tableName]];
- fieldNames = [queryResult fetchFieldNames];
- rowCount = [queryResult numOfRows];
- for ( j = 0 ; j < rowCount ; j++ ) {
- [queryResult dataSeek:j];
- theRow = [queryResult fetchRowAsArray];
- fieldValues = [NSMutableArray array];
- for ( t = 0 ; t < [theRow count] ; t++ ) {
- if ( [[theRow objectAtIndex:t] isKindOfClass:[NSData class]] ) {
- //escape special characters
- [rowValue setString:[mySQLConnection prepareBinaryData:[theRow objectAtIndex:t]]];
- } else {
- [rowValue setString:[[theRow objectAtIndex:t] description]];
- //escape special characters
- [rowValue setString:[mySQLConnection prepareString:rowValue]];
- }
- if ( [[theRow objectAtIndex:t] isMemberOfClass:[NSNull class]] ) {
- [fieldValues addObject:@"NULL"];
- } else {
-// [fieldValues addObject:[NSString stringWithFormat:@"\"%@\"", rowValue]];
- [fieldValues addObject:[NSString stringWithFormat:@"'%@'", rowValue]];
- }
- }
- [dump appendString:[NSString stringWithFormat:@"INSERT INTO `%@` (`%@`) VALUES (%@);\n",
- tableName, [fieldNames componentsJoinedByString:@"`,`"],
- [fieldValues componentsJoinedByString:@","]]];
- }
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
- if ( [addErrorsSwitch state] == NSOnState ) {
- [dump appendString:[NSString stringWithFormat:@"# Error: %@\n", [mySQLConnection getLastErrorMessage]]];
- }
- }
- }
+ if ( [addTableContentSwitch state] == NSOnState ) {
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@`", tableName]];
+ fieldNames = [queryResult fetchFieldNames];
+ rowCount = [queryResult numOfRows];
+ for ( j = 0 ; j < rowCount ; j++ ) {
+ [queryResult dataSeek:j];
+ theRow = [queryResult fetchRowAsArray];
+ fieldValues = [NSMutableArray array];
+ for ( t = 0 ; t < [theRow count] ; t++ ) {
+ if ( [[theRow objectAtIndex:t] isKindOfClass:[NSData class]] ) {
+ //escape special characters
+ [rowValue setString:[mySQLConnection prepareBinaryData:[theRow objectAtIndex:t]]];
+ } else {
+ [rowValue setString:[[theRow objectAtIndex:t] description]];
+ //escape special characters
+ [rowValue setString:[mySQLConnection prepareString:rowValue]];
+ }
+ if ( [[theRow objectAtIndex:t] isMemberOfClass:[NSNull class]] ) {
+ [fieldValues addObject:@"NULL"];
+ } else {
+// [fieldValues addObject:[NSString stringWithFormat:@"\"%@\"", rowValue]];
+ [fieldValues addObject:[NSString stringWithFormat:@"'%@'", rowValue]];
+ }
+ }
+ [dump appendString:[NSString stringWithFormat:@"INSERT INTO `%@` (`%@`) VALUES (%@);\n",
+ tableName, [fieldNames componentsJoinedByString:@"`,`"],
+ [fieldValues componentsJoinedByString:@","]]];
+ }
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
+ if ( [addErrorsSwitch state] == NSOnState ) {
+ [dump appendString:[NSString stringWithFormat:@"# Error: %@\n", [mySQLConnection getLastErrorMessage]]];
+ }
+ }
+ }
//set progressbar and text
- [singleProgressBar setDoubleValue:(k*100/tableCount)];
- [singleProgressBar displayIfNeeded];
- [dump appendString:@"\n\n"];
- }
- }
+ [singleProgressBar setDoubleValue:(k*100/tableCount)];
+ [singleProgressBar displayIfNeeded];
+ [dump appendString:@"\n\n"];
+ }
+ }
//close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
-
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+
//show errors sheet if there have been errors
- if ( [errors length] ) {
- [errorsView setString:errors];
- [NSApp beginSheet:errorsSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:errorsSheet];
-
- [NSApp endSheet:errorsSheet];
- [errorsSheet orderOut:nil];
- }
-
- return [NSString stringWithString:dump];
+ if ( [errors length] ) {
+ [errorsView setString:errors];
+ [NSApp beginSheet:errorsSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:errorsSheet];
+
+ [NSApp endSheet:errorsSheet];
+ [errorsSheet orderOut:nil];
+ }
+
+ return [NSString stringWithString:dump];
}
- (NSString *)csvForArray:(NSArray *)array useFirstLine:(BOOL)firstLine terminatedBy:(NSString *)terminated
- enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds silently:(BOOL)silently;
+ enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds silently:(BOOL)silently;
/*
takes an array and returns it as a csv string
*/
{
- NSMutableString *string = [NSMutableString string];
- NSMutableString *rowValue = [NSMutableString string];
- NSMutableArray *tempRow = [NSMutableArray array];
- NSMutableString *tempTerminated, *tempLineEnds;
- int i,j;
+ NSMutableString *string = [NSMutableString string];
+ NSMutableString *rowValue = [NSMutableString string];
+ NSMutableArray *tempRow = [NSMutableArray array];
+ NSMutableString *tempTerminated, *tempLineEnds;
+ int i,j;
//repare tabs and line ends
- tempTerminated = [NSMutableString stringWithString:terminated];
- [tempTerminated replaceOccurrencesOfString:@"\\t" withString:@"\t"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempTerminated length])];
- [tempTerminated replaceOccurrencesOfString:@"\\n" withString:@"\n"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempTerminated length])];
- [tempTerminated replaceOccurrencesOfString:@"\\r" withString:@"\r"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempTerminated length])];
- terminated = [NSString stringWithString:tempTerminated];
- tempLineEnds = [NSMutableString stringWithString:lineEnds];
- [tempLineEnds replaceOccurrencesOfString:@"\\t" withString:@"\t"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempLineEnds length])];
- [tempLineEnds replaceOccurrencesOfString:@"\\n" withString:@"\n"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempLineEnds length])];
- [tempLineEnds replaceOccurrencesOfString:@"\\r" withString:@"\r"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempLineEnds length])];
- lineEnds = [NSString stringWithString:tempLineEnds];
-
- if ( !silently ) {
- //reset interface
- [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")];
- [singleProgressText displayIfNeeded];
- [singleProgressBar setDoubleValue:0];
- [singleProgressBar displayIfNeeded];
- //open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- }
-
- for ( i = 0 ; i < [array count] ; i++ ) {
- if ( !silently ) {
-// [singleProgressText setStringValue:[NSString stringWithFormat:@"Writing row %d of %d", i+1, [array count]]];
-// [singleProgressText displayIfNeeded];
- [singleProgressBar setDoubleValue:((i+1)*100/[array count])];
- [singleProgressBar displayIfNeeded];
- }
- if ( (i > 0) || ((i == 0) && firstLine) ) {
- [tempRow removeAllObjects];
- for ( j = 0 ; j < [[array objectAtIndex:i] count] ; j++ ) {
- //escape "enclosed by" character
+ tempTerminated = [NSMutableString stringWithString:terminated];
+ [tempTerminated replaceOccurrencesOfString:@"\\t" withString:@"\t"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempTerminated length])];
+ [tempTerminated replaceOccurrencesOfString:@"\\n" withString:@"\n"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempTerminated length])];
+ [tempTerminated replaceOccurrencesOfString:@"\\r" withString:@"\r"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempTerminated length])];
+ terminated = [NSString stringWithString:tempTerminated];
+ tempLineEnds = [NSMutableString stringWithString:lineEnds];
+ [tempLineEnds replaceOccurrencesOfString:@"\\t" withString:@"\t"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempLineEnds length])];
+ [tempLineEnds replaceOccurrencesOfString:@"\\n" withString:@"\n"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempLineEnds length])];
+ [tempLineEnds replaceOccurrencesOfString:@"\\r" withString:@"\r"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempLineEnds length])];
+ lineEnds = [NSString stringWithString:tempLineEnds];
+
+ if ( !silently ) {
+ //reset interface
+ [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")];
+ [singleProgressText displayIfNeeded];
+ [singleProgressBar setDoubleValue:0];
+ [singleProgressBar displayIfNeeded];
+ //open progress sheet
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ }
+
+ for ( i = 0 ; i < [array count] ; i++ ) {
+ if ( !silently ) {
+// [singleProgressText setStringValue:[NSString stringWithFormat:@"Writing row %d of %d", i+1, [array count]]];
+// [singleProgressText displayIfNeeded];
+ [singleProgressBar setDoubleValue:((i+1)*100/[array count])];
+ [singleProgressBar displayIfNeeded];
+ }
+ if ( (i > 0) || ((i == 0) && firstLine) ) {
+ [tempRow removeAllObjects];
+ for ( j = 0 ; j < [[array objectAtIndex:i] count] ; j++ ) {
+ //escape "enclosed by" character
/*
- [rowValue setString:@""];
- scanner = [NSScanner scannerWithString:[[[array objectAtIndex:i] objectAtIndex:j] description]];
- [scanner setCharactersToBeSkipped:nil];
- while ( ![scanner isAtEnd] ) {
- if ( [scanner scanUpToString:enclosed intoString:&tempString] ) {
- [rowValue appendString:tempString];
- }
- if ( [scanner scanString:enclosed intoString:nil] ) {
- [rowValue appendString:[NSString stringWithFormat:@"%@%@", escaped, enclosed]];
- }
- }
+ [rowValue setString:@""];
+ scanner = [NSScanner scannerWithString:[[[array objectAtIndex:i] objectAtIndex:j] description]];
+ [scanner setCharactersToBeSkipped:nil];
+ while ( ![scanner isAtEnd] ) {
+ if ( [scanner scanUpToString:enclosed intoString:&tempString] ) {
+ [rowValue appendString:tempString];
+ }
+ if ( [scanner scanString:enclosed intoString:nil] ) {
+ [rowValue appendString:[NSString stringWithFormat:@"%@%@", escaped, enclosed]];
+ }
+ }
*/
- [rowValue setString:[[[array objectAtIndex:i] objectAtIndex:j] description]];
- if ( [rowValue isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
- [tempRow addObject:@"NULL"];
- } else {
- [rowValue replaceOccurrencesOfString:escaped
- withString:[NSString stringWithFormat:@"%@%@", escaped, escaped]
- options:NSLiteralSearch
- range:NSMakeRange(0,[rowValue length])];
- if ( ![escaped isEqualToString:enclosed] ) {
- [rowValue replaceOccurrencesOfString:enclosed
- withString:[NSString stringWithFormat:@"%@%@", escaped, enclosed]
- options:NSLiteralSearch
- range:NSMakeRange(0,[rowValue length])];
- }
- [rowValue replaceOccurrencesOfString:lineEnds
- withString:[NSString stringWithFormat:@"%@%@", escaped, lineEnds]
- options:NSLiteralSearch
- range:NSMakeRange(0,[rowValue length])];
- if ( [enclosed isEqualToString:@""] ) {
- [rowValue replaceOccurrencesOfString:terminated
- withString:[NSString stringWithFormat:@"%@%@", escaped, terminated]
- options:NSLiteralSearch
- range:NSMakeRange(0,[rowValue length])];
- }
- [tempRow addObject:[NSString stringWithFormat:@"%@%@%@", enclosed, rowValue, enclosed]];
- }
- }
- [string appendString:[tempRow componentsJoinedByString:terminated]];
- [string appendString:lineEnds];
- }
- }
+ [rowValue setString:[[[array objectAtIndex:i] objectAtIndex:j] description]];
+ if ( [rowValue isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
+ [tempRow addObject:@"NULL"];
+ } else {
+ [rowValue replaceOccurrencesOfString:escaped
+ withString:[NSString stringWithFormat:@"%@%@", escaped, escaped]
+ options:NSLiteralSearch
+ range:NSMakeRange(0,[rowValue length])];
+ if ( ![escaped isEqualToString:enclosed] ) {
+ [rowValue replaceOccurrencesOfString:enclosed
+ withString:[NSString stringWithFormat:@"%@%@", escaped, enclosed]
+ options:NSLiteralSearch
+ range:NSMakeRange(0,[rowValue length])];
+ }
+ [rowValue replaceOccurrencesOfString:lineEnds
+ withString:[NSString stringWithFormat:@"%@%@", escaped, lineEnds]
+ options:NSLiteralSearch
+ range:NSMakeRange(0,[rowValue length])];
+ if ( [enclosed isEqualToString:@""] ) {
+ [rowValue replaceOccurrencesOfString:terminated
+ withString:[NSString stringWithFormat:@"%@%@", escaped, terminated]
+ options:NSLiteralSearch
+ range:NSMakeRange(0,[rowValue length])];
+ }
+ [tempRow addObject:[NSString stringWithFormat:@"%@%@%@", enclosed, rowValue, enclosed]];
+ }
+ }
+ [string appendString:[tempRow componentsJoinedByString:terminated]];
+ [string appendString:lineEnds];
+ }
+ }
/*
- //remove last line end
- [string deleteCharactersInRange:NSMakeRange(([string length]-[lineEnds length]),([lineEnds length]))];
+ //remove last line end
+ [string deleteCharactersInRange:NSMakeRange(([string length]-[lineEnds length]),([lineEnds length]))];
*/
- if ( !silently ) {
- //close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
- }
+ if ( !silently ) {
+ //close progress sheet
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+ }
- return [NSString stringWithString:string];
+ return [NSString stringWithString:string];
}
- (NSArray *)arrayForCSV:(NSString *)csv terminatedBy:(NSString *)terminated
- enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds
+ enclosedBy:(NSString *)enclosed escapedBy:(NSString *)escaped lineEnds:(NSString *)lineEnds
/*
loads a csv string into an array
*/
{
- NSMutableString *tempTerminated, *tempLineEnds;
- NSMutableArray *tempArray = [NSMutableArray array];
- NSMutableArray *tempRowArray = [NSMutableArray array];
- NSMutableString *mutableField;
- NSScanner *scanner;
- NSString *scanString;
- NSMutableString *tempString = [NSMutableString string];
- NSMutableArray *linesArray = [NSMutableArray array];
- BOOL isEscaped, br;
- int fieldCount = nil;
- int x,i,j;
+ NSMutableString *tempTerminated, *tempLineEnds;
+ NSMutableArray *tempArray = [NSMutableArray array];
+ NSMutableArray *tempRowArray = [NSMutableArray array];
+ NSMutableString *mutableField;
+ NSScanner *scanner;
+ NSString *scanString;
+ NSMutableString *tempString = [NSMutableString string];
+ NSMutableArray *linesArray = [NSMutableArray array];
+ BOOL isEscaped, br;
+ int fieldCount = nil;
+ int x,i,j;
//repare tabs and line ends
- tempTerminated = [NSMutableString stringWithString:terminated];
- [tempTerminated replaceOccurrencesOfString:@"\\t" withString:@"\t"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempTerminated length])];
- [tempTerminated replaceOccurrencesOfString:@"\\n" withString:@"\n"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempTerminated length])];
- [tempTerminated replaceOccurrencesOfString:@"\\r" withString:@"\r"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempTerminated length])];
- terminated = [NSString stringWithString:tempTerminated];
- tempLineEnds = [NSMutableString stringWithString:lineEnds];
- [tempLineEnds replaceOccurrencesOfString:@"\\t" withString:@"\t"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempLineEnds length])];
- [tempLineEnds replaceOccurrencesOfString:@"\\n" withString:@"\n"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempLineEnds length])];
- [tempLineEnds replaceOccurrencesOfString:@"\\r" withString:@"\r"
- options:NSLiteralSearch
- range:NSMakeRange(0, [tempLineEnds length])];
- lineEnds = [NSString stringWithString:tempLineEnds];
+ tempTerminated = [NSMutableString stringWithString:terminated];
+ [tempTerminated replaceOccurrencesOfString:@"\\t" withString:@"\t"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempTerminated length])];
+ [tempTerminated replaceOccurrencesOfString:@"\\n" withString:@"\n"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempTerminated length])];
+ [tempTerminated replaceOccurrencesOfString:@"\\r" withString:@"\r"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempTerminated length])];
+ terminated = [NSString stringWithString:tempTerminated];
+ tempLineEnds = [NSMutableString stringWithString:lineEnds];
+ [tempLineEnds replaceOccurrencesOfString:@"\\t" withString:@"\t"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempLineEnds length])];
+ [tempLineEnds replaceOccurrencesOfString:@"\\n" withString:@"\n"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempLineEnds length])];
+ [tempLineEnds replaceOccurrencesOfString:@"\\r" withString:@"\r"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [tempLineEnds length])];
+ lineEnds = [NSString stringWithString:tempLineEnds];
//array with one line per object
- scanner = [NSScanner scannerWithString:csv];
- [scanner setCharactersToBeSkipped:nil];
- while ( ![scanner isAtEnd] ) {
- [tempString setString:@""];
- br = NO;
- while ( !br ) {
- scanString = @"";
- [scanner scanUpToString:lineEnds intoString:&scanString];
- [tempString appendString:scanString];
- [scanner scanString:lineEnds intoString:&scanString];
- //test if lineEnds-character is escaped
- isEscaped = NO;
- j = 1;
- if ( ![escaped isEqualToString:enclosed] && ![escaped isEqualToString:@""] ) {
- while ( ((j*[escaped length])<=[tempString length]) &&
- ([[tempString substringWithRange:NSMakeRange(([tempString length]-(j*[escaped length])),[escaped length])] isEqualToString:escaped]) ) {
- isEscaped = !isEscaped;
- j++;
- }
- }
- if ( !isEscaped || [scanner isAtEnd] ) {
- //end of row
- br = YES;
- } else {
- //lineEnds-character was escaped
- [tempString appendString:scanString];
- }
- }
- //add line to array
- [linesArray addObject:[NSString stringWithString:tempString]];
- }
- for ( x = 0 ; x < [linesArray count] ; x++ ) {
- //separate fields
- [tempRowArray removeAllObjects];
- [tempRowArray addObjectsFromArray:[self arrayForString:[linesArray objectAtIndex:x] enclosed:enclosed escaped:escaped terminated:terminated]];
- if ( x == 0 ) {
- fieldCount = [tempRowArray count];
- } else {
- while ( [tempRowArray count] < fieldCount ) {
- [tempRowArray addObject:@"NULL"];
- }
- }
- for ( i = 0 ; i < [tempRowArray count] ; i++ ) {
- if ( [[tempRowArray objectAtIndex:i] isEqualToString:@"NULL"] || [[tempRowArray objectAtIndex:i] isEqualToString:@"\\N"] || [[tempRowArray objectAtIndex:i] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
- //put nsnull object to array if field contains un-enclosed NULL string
- [tempRowArray replaceObjectAtIndex:i withObject:[NSNull null]];
- } else {
- //strip enclosed and escaped characters
- mutableField = [NSMutableString stringWithString:[tempRowArray objectAtIndex:i]];
- //strip enclosed characters
- if ( [mutableField length] >= (2*[enclosed length]) ) {
- if ( [[mutableField substringToIndex:[enclosed length]] isEqualToString:enclosed] ) {
- [mutableField deleteCharactersInRange:NSMakeRange(0,[enclosed length])];
- }
- if ( [[mutableField substringFromIndex:([mutableField length]-[enclosed length])] isEqualToString:enclosed] ) {
- [mutableField deleteCharactersInRange:NSMakeRange(([mutableField length]-[enclosed length]),[enclosed length])];
- }
- }
- //strip escaped characters
- if ( ![enclosed isEqualToString:@""] ) {
- [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, enclosed] withString:enclosed options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
- } else {
- [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, terminated] withString:terminated options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
- }
- if ( ![lineEnds isEqualToString:@""] ) {
- [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, lineEnds] withString:lineEnds options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
- }
- if ( ![escaped isEqualToString:@""] && ![escaped isEqualToString:enclosed] ) {
- [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, escaped] withString:escaped options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
- }
- //add field to tempRowArray
- [tempRowArray replaceObjectAtIndex:i withObject:[NSString stringWithString:mutableField]];
- }
- }
- //add row to tempArray
- [tempArray addObject:[NSArray arrayWithArray:tempRowArray]];
- }
-
- return [NSArray arrayWithArray:tempArray];
+ scanner = [NSScanner scannerWithString:csv];
+ [scanner setCharactersToBeSkipped:nil];
+ while ( ![scanner isAtEnd] ) {
+ [tempString setString:@""];
+ br = NO;
+ while ( !br ) {
+ scanString = @"";
+ [scanner scanUpToString:lineEnds intoString:&scanString];
+ [tempString appendString:scanString];
+ [scanner scanString:lineEnds intoString:&scanString];
+ //test if lineEnds-character is escaped
+ isEscaped = NO;
+ j = 1;
+ if ( ![escaped isEqualToString:enclosed] && ![escaped isEqualToString:@""] ) {
+ while ( ((j*[escaped length])<=[tempString length]) &&
+ ([[tempString substringWithRange:NSMakeRange(([tempString length]-(j*[escaped length])),[escaped length])] isEqualToString:escaped]) ) {
+ isEscaped = !isEscaped;
+ j++;
+ }
+ }
+ if ( !isEscaped || [scanner isAtEnd] ) {
+ //end of row
+ br = YES;
+ } else {
+ //lineEnds-character was escaped
+ [tempString appendString:scanString];
+ }
+ }
+ //add line to array
+ [linesArray addObject:[NSString stringWithString:tempString]];
+ }
+ for ( x = 0 ; x < [linesArray count] ; x++ ) {
+ //separate fields
+ [tempRowArray removeAllObjects];
+ [tempRowArray addObjectsFromArray:[self arrayForString:[linesArray objectAtIndex:x] enclosed:enclosed escaped:escaped terminated:terminated]];
+ if ( x == 0 ) {
+ fieldCount = [tempRowArray count];
+ } else {
+ while ( [tempRowArray count] < fieldCount ) {
+ [tempRowArray addObject:@"NULL"];
+ }
+ }
+ for ( i = 0 ; i < [tempRowArray count] ; i++ ) {
+ if ( [[tempRowArray objectAtIndex:i] isEqualToString:@"NULL"] || [[tempRowArray objectAtIndex:i] isEqualToString:@"\\N"] || [[tempRowArray objectAtIndex:i] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
+ //put nsnull object to array if field contains un-enclosed NULL string
+ [tempRowArray replaceObjectAtIndex:i withObject:[NSNull null]];
+ } else {
+ //strip enclosed and escaped characters
+ mutableField = [NSMutableString stringWithString:[tempRowArray objectAtIndex:i]];
+ //strip enclosed characters
+ if ( [mutableField length] >= (2*[enclosed length]) ) {
+ if ( [[mutableField substringToIndex:[enclosed length]] isEqualToString:enclosed] ) {
+ [mutableField deleteCharactersInRange:NSMakeRange(0,[enclosed length])];
+ }
+ if ( [[mutableField substringFromIndex:([mutableField length]-[enclosed length])] isEqualToString:enclosed] ) {
+ [mutableField deleteCharactersInRange:NSMakeRange(([mutableField length]-[enclosed length]),[enclosed length])];
+ }
+ }
+ //strip escaped characters
+ if ( ![enclosed isEqualToString:@""] ) {
+ [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, enclosed] withString:enclosed options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
+ } else {
+ [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, terminated] withString:terminated options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
+ }
+ if ( ![lineEnds isEqualToString:@""] ) {
+ [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, lineEnds] withString:lineEnds options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
+ }
+ if ( ![escaped isEqualToString:@""] && ![escaped isEqualToString:enclosed] ) {
+ [mutableField replaceOccurrencesOfString:[NSString stringWithFormat:@"%@%@", escaped, escaped] withString:escaped options:NSLiteralSearch range:NSMakeRange(0, [mutableField length])];
+ }
+ //add field to tempRowArray
+ [tempRowArray replaceObjectAtIndex:i withObject:[NSString stringWithString:mutableField]];
+ }
+ }
+ //add row to tempArray
+ [tempArray addObject:[NSArray arrayWithArray:tempRowArray]];
+ }
+
+ return [NSArray arrayWithArray:tempArray];
}
@@ -975,63 +976,63 @@ loads a csv string into an array
takes an array and returns it as a xml string
*/
{
- NSMutableString *string = [NSMutableString string];
- int i,j;
-
- if ( !silently ) {
- //reset interface
- [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")];
- [singleProgressText displayIfNeeded];
- [singleProgressBar setDoubleValue:0];
- [singleProgressBar displayIfNeeded];
- //open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- }
-
- if ( header ) {
+ NSMutableString *string = [NSMutableString string];
+ int i,j;
+
+ if ( !silently ) {
+ //reset interface
+ [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")];
+ [singleProgressText displayIfNeeded];
+ [singleProgressBar setDoubleValue:0];
+ [singleProgressBar displayIfNeeded];
+ //open progress sheet
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ }
+
+ if ( header ) {
//add header
- [string appendString:@"<?xml version=\"1.0\"?>\n\n"];
- [string appendString:@"<!--\n-\n"];
- [string appendString:@"- Sequel Pro dump\n"];
- [string appendString:[NSString stringWithFormat:@"- Version %@\n",
- [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
- [string appendString:@"- http://code.google.com/p/sequel-pro\n-\n"];
- [string appendString:[NSString stringWithFormat:@"- Host: %@ (MySQL %@)\n",
- [tableDocumentInstance host], [tableDocumentInstance mySQLVersion]]];
- [string appendString:[NSString stringWithFormat:@"- Database: %@\n", [tableDocumentInstance database]]];
- [string appendString:[NSString stringWithFormat:@"- Generation Time: %@\n", [NSDate date]]];
- [string appendString:@"-\n-->\n\n"];
- }
+ [string appendString:@"<?xml version=\"1.0\"?>\n\n"];
+ [string appendString:@"<!--\n-\n"];
+ [string appendString:@"- Sequel Pro dump\n"];
+ [string appendString:[NSString stringWithFormat:@"- Version %@\n",
+ [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
+ [string appendString:@"- http://code.google.com/p/sequel-pro\n-\n"];
+ [string appendString:[NSString stringWithFormat:@"- Host: %@ (MySQL %@)\n",
+ [tableDocumentInstance host], [tableDocumentInstance mySQLVersion]]];
+ [string appendString:[NSString stringWithFormat:@"- Database: %@\n", [tableDocumentInstance database]]];
+ [string appendString:[NSString stringWithFormat:@"- Generation Time: %@\n", [NSDate date]]];
+ [string appendString:@"-\n-->\n\n"];
+ }
//add table name
- [string appendString:[NSString stringWithFormat:@"\t<%@>\n", [self htmlEscapeString:table]]];
-
- for ( i = 1 ; i < [array count] ; i++ ) {
- if ( !silently ) {
- [singleProgressBar setDoubleValue:((i+1)*100/[array count])];
- [singleProgressBar displayIfNeeded];
- }
+ [string appendString:[NSString stringWithFormat:@"\t<%@>\n", [self htmlEscapeString:table]]];
+
+ for ( i = 1 ; i < [array count] ; i++ ) {
+ if ( !silently ) {
+ [singleProgressBar setDoubleValue:((i+1)*100/[array count])];
+ [singleProgressBar displayIfNeeded];
+ }
//add rows
- [string appendString:@"\t<row>\n"];
- for ( j = 0 ; j < [[array objectAtIndex:i] count] ; j++ ) {
- [string appendString:[NSString stringWithFormat:@"\t\t<%@>%@</%@>\n",
- [self htmlEscapeString:[[[array objectAtIndex:0] objectAtIndex:j] description]],
- [self htmlEscapeString:[[[array objectAtIndex:i] objectAtIndex:j] description]],
- [self htmlEscapeString:[[[array objectAtIndex:0] objectAtIndex:j] description]]]];
- }
- [string appendString:@"\t</row>\n"];
- }
+ [string appendString:@"\t<row>\n"];
+ for ( j = 0 ; j < [[array objectAtIndex:i] count] ; j++ ) {
+ [string appendString:[NSString stringWithFormat:@"\t\t<%@>%@</%@>\n",
+ [self htmlEscapeString:[[[array objectAtIndex:0] objectAtIndex:j] description]],
+ [self htmlEscapeString:[[[array objectAtIndex:i] objectAtIndex:j] description]],
+ [self htmlEscapeString:[[[array objectAtIndex:0] objectAtIndex:j] description]]]];
+ }
+ [string appendString:@"\t</row>\n"];
+ }
//end table name
- [string appendString:[NSString stringWithFormat:@"\t</%@>", [self htmlEscapeString:table]]];
-
- if ( !silently ) {
- //close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
- }
-
- return [NSString stringWithString:string];
+ [string appendString:[NSString stringWithFormat:@"\t</%@>", [self htmlEscapeString:table]]];
+
+ if ( !silently ) {
+ //close progress sheet
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+ }
+
+ return [NSString stringWithString:string];
}
- (NSString *)stringForSelectedTablesWithType:(NSString *)type
@@ -1040,138 +1041,138 @@ returns a csv/xml string for the selected tables
type has to be "csv" or "xml"
*/
{
- int i,j,k,t,rowCount,tableCount;
- CMMCPResult *queryResult;
- NSString *tableName;
- NSArray *fieldNames;
- NSArray *theRow;
- NSMutableArray *tableArray = [NSMutableArray array];
- NSMutableString *rowValue = [NSMutableString string];
- NSMutableArray *fieldValues;
- NSMutableString *dump = [NSMutableString string];
- NSMutableString *errors = [NSMutableString string];
+ int i,j,k,t,rowCount,tableCount;
+ CMMCPResult *queryResult;
+ NSString *tableName;
+ NSArray *fieldNames;
+ NSArray *theRow;
+ NSMutableArray *tableArray = [NSMutableArray array];
+ NSMutableString *rowValue = [NSMutableString string];
+ NSMutableArray *fieldValues;
+ NSMutableString *dump = [NSMutableString string];
+ NSMutableString *errors = [NSMutableString string];
//reset interface
- [errorsView setString:@""];
- [errorsView displayIfNeeded];
- [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")];
- [singleProgressText displayIfNeeded];
- [singleProgressBar setDoubleValue:0];
- [singleProgressBar displayIfNeeded];
+ [errorsView setString:@""];
+ [errorsView displayIfNeeded];
+ [singleProgressText setStringValue:NSLocalizedString(@"Writing...", @"text showing that app is writing text file")];
+ [singleProgressText displayIfNeeded];
+ [singleProgressBar setDoubleValue:0];
+ [singleProgressBar displayIfNeeded];
//open progress sheet
- [NSApp beginSheet:singleProgressSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
+ [NSApp beginSheet:singleProgressSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
//count tables
- tableCount = 0;
- for ( i = 0 ; i < [tables count] ; i++ ) {
- if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
- tableCount++;
- }
- }
- k = 0;
+ tableCount = 0;
+ for ( i = 0 ; i < [tables count] ; i++ ) {
+ if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
+ tableCount++;
+ }
+ }
+ k = 0;
//add header of dump-file
- if ( [type isEqualToString:@"csv"] ) {
- [dump appendString:[NSString stringWithFormat:@"Host: %@ Database: %@ Generation Time: %@\n\n",
- [tableDocumentInstance host], [tableDocumentInstance database], [NSDate date]]];
- } else if ( [type isEqualToString:@"xml"] ) {
- [dump appendString:@"<?xml version=\"1.0\"?>\n\n"];
- [dump appendString:@"<!--\n-\n"];
- [dump appendString:@"- Sequel Pro dump\n"];
- [dump appendString:[NSString stringWithFormat:@"- Version %@\n",
- [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
- [dump appendString:@"- http://code.google.com/p/sequel-pro\n-\n"];
- [dump appendString:[NSString stringWithFormat:@"- Host: %@ (MySQL %@)\n",
- [tableDocumentInstance host], [tableDocumentInstance mySQLVersion]]];
- [dump appendString:[NSString stringWithFormat:@"- Database: %@\n", [tableDocumentInstance database]]];
- [dump appendString:[NSString stringWithFormat:@"- Generation Time: %@\n", [NSDate date]]];
- [dump appendString:@"-\n-->\n\n\n"];
- [dump appendString:[NSString stringWithFormat:@"<%@>\n\n\n",
- [self htmlEscapeString:[tableDocumentInstance database]]]];
- }
- for ( i = 0 ; i < [tables count] ; i++ ) {
- if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
- k++;
+ if ( [type isEqualToString:@"csv"] ) {
+ [dump appendString:[NSString stringWithFormat:@"Host: %@ Database: %@ Generation Time: %@\n\n",
+ [tableDocumentInstance host], [tableDocumentInstance database], [NSDate date]]];
+ } else if ( [type isEqualToString:@"xml"] ) {
+ [dump appendString:@"<?xml version=\"1.0\"?>\n\n"];
+ [dump appendString:@"<!--\n-\n"];
+ [dump appendString:@"- Sequel Pro dump\n"];
+ [dump appendString:[NSString stringWithFormat:@"- Version %@\n",
+ [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]]];
+ [dump appendString:@"- http://code.google.com/p/sequel-pro\n-\n"];
+ [dump appendString:[NSString stringWithFormat:@"- Host: %@ (MySQL %@)\n",
+ [tableDocumentInstance host], [tableDocumentInstance mySQLVersion]]];
+ [dump appendString:[NSString stringWithFormat:@"- Database: %@\n", [tableDocumentInstance database]]];
+ [dump appendString:[NSString stringWithFormat:@"- Generation Time: %@\n", [NSDate date]]];
+ [dump appendString:@"-\n-->\n\n\n"];
+ [dump appendString:[NSString stringWithFormat:@"<%@>\n\n\n",
+ [self htmlEscapeString:[tableDocumentInstance database]]]];
+ }
+ for ( i = 0 ; i < [tables count] ; i++ ) {
+ if ( [[[tables objectAtIndex:i] objectAtIndex:0] boolValue] ) {
+ k++;
//set progressbar and text
- tableName = [[tables objectAtIndex:i] objectAtIndex:1];
- [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Writing table %@...", @"text showing that app is writing table to text file"), tableName]];
- [singleProgressText displayIfNeeded];
+ tableName = [[tables objectAtIndex:i] objectAtIndex:1];
+ [singleProgressText setStringValue:[NSString stringWithFormat:NSLocalizedString(@"Writing table %@...", @"text showing that app is writing table to text file"), tableName]];
+ [singleProgressText displayIfNeeded];
//add name of table
- if ( [type isEqualToString:@"csv"] ) {
- [dump appendString:[NSString stringWithFormat:@"Table %@\n\n", tableName]];
- }
+ if ( [type isEqualToString:@"csv"] ) {
+ [dump appendString:[NSString stringWithFormat:@"Table %@\n\n", tableName]];
+ }
//add table content
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@`", tableName]];
- fieldNames = [queryResult fetchFieldNames];
- rowCount = [queryResult numOfRows];
- [tableArray removeAllObjects];
- //add field names
- [tableArray addObject:fieldNames];
- for ( j = 0 ; j < rowCount ; j++ ) {
- [queryResult dataSeek:j];
- theRow = [queryResult fetchRowAsArray];
- fieldValues = [NSMutableArray array];
- for ( t = 0 ; t < [theRow count] ; t++ ) {
- if ( [[theRow objectAtIndex:t] isKindOfClass:[NSData class]] ) {
- //convert data to string
- [rowValue setString:[[NSString alloc] initWithData:[theRow objectAtIndex:t]
- encoding:[mySQLConnection encoding]]];
- } else if ( [[theRow objectAtIndex:t] isMemberOfClass:[NSNull class]] ) {
- [rowValue setString:[prefs objectForKey:@"nullValue"]];
- } else {
- [rowValue setString:[[theRow objectAtIndex:t] description]];
- }
- [fieldValues addObject:[NSString stringWithString:rowValue]];
- }
- [tableArray addObject:[NSArray arrayWithArray:fieldValues]];
- }
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
- }
- if ( [type isEqualToString:@"csv"] ) {
- [dump appendString:[self csvForArray:tableArray
- useFirstLine:[exportMultipleFieldNamesSwitch state]
- terminatedBy:[exportMultipleFieldsTerminatedField stringValue]
- enclosedBy:[exportMultipleFieldsEnclosedField stringValue]
- escapedBy:[exportMultipleFieldsEscapedField stringValue]
- lineEnds:[exportMultipleLinesTerminatedField stringValue]
- silently:YES]];
- } else if ( [type isEqualToString:@"xml"] ) {
- [dump appendString:[self xmlForArray:tableArray tableName:tableName withHeader:NO silently:YES]];
- }
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@`", tableName]];
+ fieldNames = [queryResult fetchFieldNames];
+ rowCount = [queryResult numOfRows];
+ [tableArray removeAllObjects];
+ //add field names
+ [tableArray addObject:fieldNames];
+ for ( j = 0 ; j < rowCount ; j++ ) {
+ [queryResult dataSeek:j];
+ theRow = [queryResult fetchRowAsArray];
+ fieldValues = [NSMutableArray array];
+ for ( t = 0 ; t < [theRow count] ; t++ ) {
+ if ( [[theRow objectAtIndex:t] isKindOfClass:[NSData class]] ) {
+ //convert data to string
+ [rowValue setString:[[NSString alloc] initWithData:[theRow objectAtIndex:t]
+ encoding:[mySQLConnection encoding]]];
+ } else if ( [[theRow objectAtIndex:t] isMemberOfClass:[NSNull class]] ) {
+ [rowValue setString:[prefs objectForKey:@"nullValue"]];
+ } else {
+ [rowValue setString:[[theRow objectAtIndex:t] description]];
+ }
+ [fieldValues addObject:[NSString stringWithString:rowValue]];
+ }
+ [tableArray addObject:[NSArray arrayWithArray:fieldValues]];
+ }
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [errors appendString:[NSString stringWithFormat:@"%@\n", [mySQLConnection getLastErrorMessage]]];
+ }
+ if ( [type isEqualToString:@"csv"] ) {
+ [dump appendString:[self csvForArray:tableArray
+ useFirstLine:[exportMultipleFieldNamesSwitch state]
+ terminatedBy:[exportMultipleFieldsTerminatedField stringValue]
+ enclosedBy:[exportMultipleFieldsEnclosedField stringValue]
+ escapedBy:[exportMultipleFieldsEscapedField stringValue]
+ lineEnds:[exportMultipleLinesTerminatedField stringValue]
+ silently:YES]];
+ } else if ( [type isEqualToString:@"xml"] ) {
+ [dump appendString:[self xmlForArray:tableArray tableName:tableName withHeader:NO silently:YES]];
+ }
//set progressbar and text
- [singleProgressBar setDoubleValue:(k*100/tableCount)];
- [singleProgressBar displayIfNeeded];
- [dump appendString:@"\n\n\n"];
- }
- }
+ [singleProgressBar setDoubleValue:(k*100/tableCount)];
+ [singleProgressBar displayIfNeeded];
+ [dump appendString:@"\n\n\n"];
+ }
+ }
//write xml end
- if ( [type isEqualToString:@"xml"] ) {
- [dump appendString:[NSString stringWithFormat:@"</%@>",
- [self htmlEscapeString:[tableDocumentInstance database]]]];
- }
+ if ( [type isEqualToString:@"xml"] ) {
+ [dump appendString:[NSString stringWithFormat:@"</%@>",
+ [self htmlEscapeString:[tableDocumentInstance database]]]];
+ }
//close progress sheet
- [NSApp endSheet:singleProgressSheet];
- [singleProgressSheet orderOut:nil];
-
+ [NSApp endSheet:singleProgressSheet];
+ [singleProgressSheet orderOut:nil];
+
//show errors sheet if there have been errors
- if ( [errors length] ) {
- [errorsView setString:errors];
- [NSApp beginSheet:errorsSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- [NSApp runModalForWindow:errorsSheet];
-
- [NSApp endSheet:errorsSheet];
- [errorsSheet orderOut:nil];
- }
-
- return [NSString stringWithString:dump];
+ if ( [errors length] ) {
+ [errorsView setString:errors];
+ [NSApp beginSheet:errorsSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ [NSApp runModalForWindow:errorsSheet];
+
+ [NSApp endSheet:errorsSheet];
+ [errorsSheet orderOut:nil];
+ }
+
+ return [NSString stringWithString:dump];
}
- (NSString *)htmlEscapeString:(NSString *)string
@@ -1179,107 +1180,107 @@ type has to be "csv" or "xml"
html escapes a string
*/
{
- NSMutableString *mutableString = [NSMutableString stringWithString:string];
-
- [mutableString replaceOccurrencesOfString:@"&" withString:@"&amp;"
- options:NSLiteralSearch
- range:NSMakeRange(0, [mutableString length])];
- [mutableString replaceOccurrencesOfString:@"<" withString:@"&lt;"
- options:NSLiteralSearch
- range:NSMakeRange(0, [mutableString length])];
- [mutableString replaceOccurrencesOfString:@">" withString:@"&gt;"
- options:NSLiteralSearch
- range:NSMakeRange(0, [mutableString length])];
- [mutableString replaceOccurrencesOfString:@"\"" withString:@"&quot;"
- options:NSLiteralSearch
- range:NSMakeRange(0, [mutableString length])];
-
- return [NSString stringWithString:mutableString];
+ NSMutableString *mutableString = [NSMutableString stringWithString:string];
+
+ [mutableString replaceOccurrencesOfString:@"&" withString:@"&amp;"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [mutableString length])];
+ [mutableString replaceOccurrencesOfString:@"<" withString:@"&lt;"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [mutableString length])];
+ [mutableString replaceOccurrencesOfString:@">" withString:@"&gt;"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [mutableString length])];
+ [mutableString replaceOccurrencesOfString:@"\"" withString:@"&quot;"
+ options:NSLiteralSearch
+ range:NSMakeRange(0, [mutableString length])];
+
+ return [NSString stringWithString:mutableString];
}
- (NSArray *)arrayForString:(NSString *)string enclosed:(NSString *)enclosed
- escaped:(NSString *)escaped terminated:(NSString *)terminated
+ escaped:(NSString *)escaped terminated:(NSString *)terminated
/*
split a string by the terminated-character if this is not escaped
if enclosed-character is given, ignores characters inside enclosed-characters
*/
{
- NSMutableArray *tempArray = [NSMutableArray array];
- BOOL inString = NO;
- BOOL isEscaped = NO;
- BOOL br = NO;
- unsigned i, j, start;
- char enc = nil;
- char esc = nil;
- char ter = nil;
-
- //we take only first character by now (too complicated otherwise)
- if ( [enclosed length] ) {
- enc = [enclosed characterAtIndex:0];
- }
- if ( [escaped length] ) {
- esc = [escaped characterAtIndex:0];
- }
- if ( [terminated length] ) {
- ter = [terminated characterAtIndex:0];
- }
-
- start = 0;
-
- for ( i = 0 ; i < [string length] ; i++ ) {
- if ( inString ) {
- //we are in a string
- br = NO;
- while ( !br ) {
- if ( i >= [string length] ) {
- //end of string -> no second enclose character found
- br = YES;
- } else if ( [string characterAtIndex:i] == enc ) {
- //second enclose-character found
- //enclose-character escaped?
- isEscaped = NO;
- j = 1;
- while ( (i-j>0) && ([string characterAtIndex:(i-j)] == esc) ) {
- isEscaped = !isEscaped;
- j++;
- }
- if ( !isEscaped ) {
- inString = NO;
- br = YES;
- }
- }
- if ( !br )
- i++;
- }
- } else if ( [string characterAtIndex:i] == ter ) {
- //terminated-character found
- if ( [enclosed isEqualToString:@""] ) {
- //check if terminated character is escaped
- isEscaped = NO;
- j = 1;
- while ( (i-j>0) && ([string characterAtIndex:(i-j)] == esc) ) {
- isEscaped = !isEscaped;
- j++;
- }
- if ( !isEscaped ) {
- [tempArray addObject:[string substringWithRange:NSMakeRange(start,(i-start))]];
- start = i + 1;
- }
- } else {
- //add object to array
+ NSMutableArray *tempArray = [NSMutableArray array];
+ BOOL inString = NO;
+ BOOL isEscaped = NO;
+ BOOL br = NO;
+ unsigned i, j, start;
+ char enc = nil;
+ char esc = nil;
+ char ter = nil;
+
+ //we take only first character by now (too complicated otherwise)
+ if ( [enclosed length] ) {
+ enc = [enclosed characterAtIndex:0];
+ }
+ if ( [escaped length] ) {
+ esc = [escaped characterAtIndex:0];
+ }
+ if ( [terminated length] ) {
+ ter = [terminated characterAtIndex:0];
+ }
+
+ start = 0;
+
+ for ( i = 0 ; i < [string length] ; i++ ) {
+ if ( inString ) {
+ //we are in a string
+ br = NO;
+ while ( !br ) {
+ if ( i >= [string length] ) {
+ //end of string -> no second enclose character found
+ br = YES;
+ } else if ( [string characterAtIndex:i] == enc ) {
+ //second enclose-character found
+ //enclose-character escaped?
+ isEscaped = NO;
+ j = 1;
+ while ( (i-j>0) && ([string characterAtIndex:(i-j)] == esc) ) {
+ isEscaped = !isEscaped;
+ j++;
+ }
+ if ( !isEscaped ) {
+ inString = NO;
+ br = YES;
+ }
+ }
+ if ( !br )
+ i++;
+ }
+ } else if ( [string characterAtIndex:i] == ter ) {
+ //terminated-character found
+ if ( [enclosed isEqualToString:@""] ) {
+ //check if terminated character is escaped
+ isEscaped = NO;
+ j = 1;
+ while ( (i-j>0) && ([string characterAtIndex:(i-j)] == esc) ) {
+ isEscaped = !isEscaped;
+ j++;
+ }
+ if ( !isEscaped ) {
+ [tempArray addObject:[string substringWithRange:NSMakeRange(start,(i-start))]];
+ start = i + 1;
+ }
+ } else {
+ //add object to array
//NSLog([string substringWithRange:NSMakeRange(start,(i-start))]);
- [tempArray addObject:[string substringWithRange:NSMakeRange(start,(i-start))]];
- start = i + 1;
- }
- } else if ( [string characterAtIndex:i] == enc ) {
- //enclosed-character found
- inString = YES;
- }
- }
+ [tempArray addObject:[string substringWithRange:NSMakeRange(start,(i-start))]];
+ start = i + 1;
+ }
+ } else if ( [string characterAtIndex:i] == enc ) {
+ //enclosed-character found
+ inString = YES;
+ }
+ }
//add rest of string to array
- [tempArray addObject:[string substringWithRange:NSMakeRange(start,([string length]-start))]];
+ [tempArray addObject:[string substringWithRange:NSMakeRange(start,([string length]-start))]];
- return [NSArray arrayWithArray:tempArray];
+ return [NSArray arrayWithArray:tempArray];
}
- (NSArray *)splitQueries:(NSString *)query
@@ -1287,72 +1288,72 @@ if enclosed-character is given, ignores characters inside enclosed-characters
splits the queries by ;'s which aren't inside any ", ' or ` characters
*/
{
- NSMutableString *queries = [NSMutableString stringWithString:query];
- NSMutableArray *queryArray = [NSMutableArray array];
- char stringType = nil;
- BOOL inString = NO;
- BOOL escaped;
- unsigned lineStart = 0;
- unsigned i, j, x, currentLineLength;
-
- //parse string
- for ( i = 0 ; i < [queries length] ; i++ ) {
- if ( inString ) {
- //we are in a string
- //look for end of string
- for ( ; i < [queries length] ; i++ ) {
- if ( (([queries characterAtIndex:i] == '`') && (stringType == '`')) ||
- (([queries characterAtIndex:i] == stringType) && ([queries characterAtIndex:i-1] != '\\')) ) {
- //back-tick or no backslash before string end -> end of string
- inString = NO;
- break;
- } else if ( [queries characterAtIndex:i] == stringType ) {
- //check if string end isn't escaped
- escaped = YES;
- j = 2;
- currentLineLength = i - lineStart;
- while ( ((currentLineLength-j)>0) && ([queries characterAtIndex:i-j] == '\\') ) {
- escaped = !escaped;
- j++;
- }
- if ( !escaped ) {
- //it's really the end of the string
- inString = NO;
- }
- }
- }
- } else if ( ([queries characterAtIndex:i] == '#') ||
- ((i+2<[queries length]) &&
- ([queries characterAtIndex:i] == '-') &&
- ([queries characterAtIndex:i+1] == '-') &&
- ([queries characterAtIndex:i+2] == ' ')) ) {
- //it's a comment -> delete it
- x = i;
- while ( (x<[queries length]) && ([queries characterAtIndex:x] != '\r') && ([queries characterAtIndex:x] != '\n') ) {
- x++;
- }
- [queries deleteCharactersInRange:NSMakeRange(i,x-i)];
- } else if ( [queries characterAtIndex:i] == ';' ) {
- //we are at the end of a query
- [queryArray addObject:[queries substringWithRange:NSMakeRange(lineStart, (i-lineStart))]];
- while ( ((i+1)<[queries length]) && (([queries characterAtIndex:i+1]=='\n') || ([queries characterAtIndex:i+1]=='\r') || ([queries characterAtIndex:i+1]==' ')) ) {
- i++;
- }
- lineStart = i + 1;
- } else if ( ([queries characterAtIndex:i] == '\'') ||
- ([queries characterAtIndex:i] == '"') ||
- ([queries characterAtIndex:i] == '`') ) {
- //we are entering a string
- inString = YES;
- stringType = [queries characterAtIndex:i];
- }
- }
- //add rest of string to array (if last line has not ended with a ";")
- if ( lineStart < [queries length] ) {
- [queryArray addObject:[queries substringWithRange:NSMakeRange(lineStart, ([queries length]-lineStart))]];
- }
- //return array
- return [NSArray arrayWithArray:queryArray];
+ NSMutableString *queries = [NSMutableString stringWithString:query];
+ NSMutableArray *queryArray = [NSMutableArray array];
+ char stringType = nil;
+ BOOL inString = NO;
+ BOOL escaped;
+ unsigned lineStart = 0;
+ unsigned i, j, x, currentLineLength;
+
+ //parse string
+ for ( i = 0 ; i < [queries length] ; i++ ) {
+ if ( inString ) {
+ //we are in a string
+ //look for end of string
+ for ( ; i < [queries length] ; i++ ) {
+ if ( (([queries characterAtIndex:i] == '`') && (stringType == '`')) ||
+ (([queries characterAtIndex:i] == stringType) && ([queries characterAtIndex:i-1] != '\\')) ) {
+ //back-tick or no backslash before string end -> end of string
+ inString = NO;
+ break;
+ } else if ( [queries characterAtIndex:i] == stringType ) {
+ //check if string end isn't escaped
+ escaped = YES;
+ j = 2;
+ currentLineLength = i - lineStart;
+ while ( ((currentLineLength-j)>0) && ([queries characterAtIndex:i-j] == '\\') ) {
+ escaped = !escaped;
+ j++;
+ }
+ if ( !escaped ) {
+ //it's really the end of the string
+ inString = NO;
+ }
+ }
+ }
+ } else if ( ([queries characterAtIndex:i] == '#') ||
+ ((i+2<[queries length]) &&
+ ([queries characterAtIndex:i] == '-') &&
+ ([queries characterAtIndex:i+1] == '-') &&
+ ([queries characterAtIndex:i+2] == ' ')) ) {
+ //it's a comment -> delete it
+ x = i;
+ while ( (x<[queries length]) && ([queries characterAtIndex:x] != '\r') && ([queries characterAtIndex:x] != '\n') ) {
+ x++;
+ }
+ [queries deleteCharactersInRange:NSMakeRange(i,x-i)];
+ } else if ( [queries characterAtIndex:i] == ';' ) {
+ //we are at the end of a query
+ [queryArray addObject:[queries substringWithRange:NSMakeRange(lineStart, (i-lineStart))]];
+ while ( ((i+1)<[queries length]) && (([queries characterAtIndex:i+1]=='\n') || ([queries characterAtIndex:i+1]=='\r') || ([queries characterAtIndex:i+1]==' ')) ) {
+ i++;
+ }
+ lineStart = i + 1;
+ } else if ( ([queries characterAtIndex:i] == '\'') ||
+ ([queries characterAtIndex:i] == '"') ||
+ ([queries characterAtIndex:i] == '`') ) {
+ //we are entering a string
+ inString = YES;
+ stringType = [queries characterAtIndex:i];
+ }
+ }
+ //add rest of string to array (if last line has not ended with a ";")
+ if ( lineStart < [queries length] ) {
+ [queryArray addObject:[queries substringWithRange:NSMakeRange(lineStart, ([queries length]-lineStart))]];
+ }
+ //return array
+ return [NSArray arrayWithArray:queryArray];
}
@@ -1362,111 +1363,111 @@ splits the queries by ;'s which aren't inside any ", ' or ` characters
sets the connection (received from TableDocument) and makes things that have to be done only once
*/
{
- NSButtonCell *switchButton = [[NSButtonCell alloc] init];
+ NSButtonCell *switchButton = [[NSButtonCell alloc] init];
- prefs = [[NSUserDefaults standardUserDefaults] retain];
+ prefs = [[NSUserDefaults standardUserDefaults] retain];
- mySQLConnection = theConnection;
+ mySQLConnection = theConnection;
//set up the interface
- [switchButton setButtonType:NSSwitchButton];
- [switchButton setControlSize:NSSmallControlSize];
- [[exportDumpTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
- [[exportMultipleCSVTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
- [[exportMultipleXMLTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [[[exportMultipleXMLTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [[[fieldMappingTableView tableColumnWithIdentifier:@"0"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- [errorsView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- } else {
- [[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [[[exportMultipleXMLTableView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [[[fieldMappingTableView tableColumnWithIdentifier:@"0"] dataCell]
- setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- [errorsView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
- }
-// [self reloadTables:self];
+ [switchButton setButtonType:NSSwitchButton];
+ [switchButton setControlSize:NSSmallControlSize];
+ [[exportDumpTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
+ [[exportMultipleCSVTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
+ [[exportMultipleXMLTableView tableColumnWithIdentifier:@"switch"] setDataCell:switchButton];
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [[[exportMultipleXMLTableView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [[[fieldMappingTableView tableColumnWithIdentifier:@"0"] dataCell]
+ setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ [errorsView setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ } else {
+ [[[exportDumpTableView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [[[exportMultipleCSVTableView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [[[exportMultipleXMLTableView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [[[fieldMappingTableView tableColumnWithIdentifier:@"0"] dataCell]
+ setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ [errorsView setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+ }
+// [self reloadTables:self];
}
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
{
- if ( aTableView == fieldMappingTableView ) {
- return [fieldMappingArray count];
- } else {
- return [tables count];
- }
+ if ( aTableView == fieldMappingTableView ) {
+ return [fieldMappingArray count];
+ } else {
+ return [tables count];
+ }
}
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
- if ( aTableView == fieldMappingTableView ) {
- return [[fieldMappingArray objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]];
- } else {
- if ( [[aTableColumn identifier] isEqualToString:@"switch"] ) {
- return [[tables objectAtIndex:rowIndex] objectAtIndex:0];
- } else {
- return [[tables objectAtIndex:rowIndex] objectAtIndex:1];
- }
- }
+ if ( aTableView == fieldMappingTableView ) {
+ return [[fieldMappingArray objectAtIndex:rowIndex] objectAtIndex:[[aTableColumn identifier] intValue]];
+ } else {
+ if ( [[aTableColumn identifier] isEqualToString:@"switch"] ) {
+ return [[tables objectAtIndex:rowIndex] objectAtIndex:0];
+ } else {
+ return [[tables objectAtIndex:rowIndex] objectAtIndex:1];
+ }
+ }
}
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
- if ( aTableView == fieldMappingTableView ) {
- int i;
- for ( i = 0 ; i < [fieldMappingArray count] ; i++ ) {
- //check that field isn't already used
- if ( [[[fieldMappingArray objectAtIndex:i] objectAtIndex:1] isEqualToNumber:anObject]
- && (rowIndex != i)
- && ![anObject isEqualToNumber:[NSNumber numberWithInt:0]] ) {
- return;
- }
- }
- [[fieldMappingArray objectAtIndex:rowIndex] replaceObjectAtIndex:[[aTableColumn identifier] intValue] withObject:anObject];
- } else {
- [[tables objectAtIndex:rowIndex] replaceObjectAtIndex:0 withObject:anObject];
- }
+ if ( aTableView == fieldMappingTableView ) {
+ int i;
+ for ( i = 0 ; i < [fieldMappingArray count] ; i++ ) {
+ //check that field isn't already used
+ if ( [[[fieldMappingArray objectAtIndex:i] objectAtIndex:1] isEqualToNumber:anObject]
+ && (rowIndex != i)
+ && ![anObject isEqualToNumber:[NSNumber numberWithInt:0]] ) {
+ return;
+ }
+ }
+ [[fieldMappingArray objectAtIndex:rowIndex] replaceObjectAtIndex:[[aTableColumn identifier] intValue] withObject:anObject];
+ } else {
+ [[tables objectAtIndex:rowIndex] replaceObjectAtIndex:0 withObject:anObject];
+ }
}
//last but not least
- (id)init;
{
- self = [super init];
+ self = [super init];
- tables = [[NSMutableArray alloc] init];
+ tables = [[NSMutableArray alloc] init];
- return self;
+ return self;
}
- (void)dealloc
{
-// NSLog(@"TableDump dealloc");
-
- [tables release];
- [importArray release];
- [fieldMappingArray release];
- [savePath release];
- [openPath release];
- [prefs release];
-
- [super dealloc];
+// NSLog(@"TableDump dealloc");
+
+ [tables release];
+ [importArray release];
+ [fieldMappingArray release];
+ [savePath release];
+ [openPath release];
+ [prefs release];
+
+ [super dealloc];
}
diff --git a/TableSource.h b/TableSource.h
index dc051239..2a62232c 100644
--- a/TableSource.h
+++ b/TableSource.h
@@ -30,36 +30,36 @@
@interface TableSource : NSObject {
- IBOutlet id tablesListInstance;
-
- IBOutlet id tableWindow;
- IBOutlet id indexSheet;
- IBOutlet id keySheet;
- IBOutlet id tableSourceView;
- IBOutlet id indexView;
- IBOutlet id addFieldButton;
- IBOutlet id copyFieldButton;
- IBOutlet id removeFieldButton;
- IBOutlet id addIndexButton;
- IBOutlet id removeIndexButton;
- IBOutlet id indexTypeField;
- IBOutlet id indexNameField;
- IBOutlet id indexedColumnsField;
- IBOutlet id chooseKeyButton;
- IBOutlet id tableTypeButton;
+ IBOutlet id tablesListInstance;
+
+ IBOutlet id tableWindow;
+ IBOutlet id indexSheet;
+ IBOutlet id keySheet;
+ IBOutlet id tableSourceView;
+ IBOutlet id indexView;
+ IBOutlet id addFieldButton;
+ IBOutlet id copyFieldButton;
+ IBOutlet id removeFieldButton;
+ IBOutlet id addIndexButton;
+ IBOutlet id removeIndexButton;
+ IBOutlet id indexTypeField;
+ IBOutlet id indexNameField;
+ IBOutlet id indexedColumnsField;
+ IBOutlet id chooseKeyButton;
+ IBOutlet id tableTypeButton;
IBOutlet id structureGrabber;
- CMMCPConnection *mySQLConnection;
- CMMCPResult *tableSourceResult;
- CMMCPResult *indexResult;
-
- NSString *selectedTable;
- NSString *tableType;
- NSMutableArray *tableFields, *indexes;
- NSMutableDictionary *oldRow, *enumFields;
- NSDictionary *defaultValues;
- BOOL isEditingRow, isEditingNewRow, alertSheetOpened;
- NSUserDefaults *prefs;
+ CMMCPConnection *mySQLConnection;
+ CMMCPResult *tableSourceResult;
+ CMMCPResult *indexResult;
+
+ NSString *selectedTable;
+ NSString *tableType;
+ NSMutableArray *tableFields, *indexes;
+ NSMutableDictionary *oldRow, *enumFields;
+ NSDictionary *defaultValues;
+ BOOL isEditingRow, isEditingNewRow, alertSheetOpened;
+ NSUserDefaults *prefs;
}
//table methods
@@ -97,17 +97,17 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
//tableView drag&drop datasource methods
- (BOOL)tableView:(NSTableView *)tv writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard;
- (NSDragOperation)tableView:(NSTableView*)tv validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation;
+ proposedDropOperation:(NSTableViewDropOperation)operation;
- (BOOL)tableView:(NSTableView*)tv acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation;
//tableView delegate methods
diff --git a/TableSource.m b/TableSource.m
index 69fb3758..78e9bb4d 100644
--- a/TableSource.m
+++ b/TableSource.m
@@ -45,7 +45,7 @@
selectedTable = aTable;
[tableSourceView deselectAll:self];
if ( isEditingRow )
- return;
+ return;
// empty variables
[enumFields removeAllObjects];
@@ -54,75 +54,75 @@
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
if ( [aTable isEqualToString:@""] || !aTable ) {
- [tableFields removeAllObjects];
- [indexes removeAllObjects];
- [tableSourceView reloadData];
- [indexView reloadData];
- [addFieldButton setEnabled:NO];
- [copyFieldButton setEnabled:NO];
- [removeFieldButton setEnabled:NO];
- [addIndexButton setEnabled:NO];
- [removeIndexButton setEnabled:NO];
-
- // set the table type menu back to the default, and disable it
- [tableTypeButton selectItemAtIndex:0];
- [tableTypeButton setEnabled:NO];
- tableType = nil;
-
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
-
- [scanner release];
-
- return;
+ [tableFields removeAllObjects];
+ [indexes removeAllObjects];
+ [tableSourceView reloadData];
+ [indexView reloadData];
+ [addFieldButton setEnabled:NO];
+ [copyFieldButton setEnabled:NO];
+ [removeFieldButton setEnabled:NO];
+ [addIndexButton setEnabled:NO];
+ [removeIndexButton setEnabled:NO];
+
+ // set the table type menu back to the default, and disable it
+ [tableTypeButton selectItemAtIndex:0];
+ [tableTypeButton setEnabled:NO];
+ tableType = nil;
+
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+
+ [scanner release];
+
+ return;
}
//perform queries and load results in array (each row as a dictionary)
tableSourceResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW COLUMNS FROM `%@`", selectedTable]] retain];
// listFieldsFromTable is broken in the current version of the framework (no back-ticks for table name)!
- // tableSourceResult = [[mySQLConnection listFieldsFromTable:selectedTable] retain];
- // [tableFields setArray:[[self fetchResultAsArray:tableSourceResult] retain]];
+ // tableSourceResult = [[mySQLConnection listFieldsFromTable:selectedTable] retain];
+ // [tableFields setArray:[[self fetchResultAsArray:tableSourceResult] retain]];
[tableFields setArray:[self fetchResultAsArray:tableSourceResult]];
[tableSourceResult release];
indexResult = [[mySQLConnection queryString:[NSString stringWithFormat:@"SHOW INDEX FROM `%@`", selectedTable]] retain];
- // [indexes setArray:[[self fetchResultAsArray:indexResult] retain]];
+ // [indexes setArray:[[self fetchResultAsArray:indexResult] retain]];
[indexes setArray:[self fetchResultAsArray:indexResult]];
[indexResult release];
CMMCPResult *tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE '%@'", selectedTable]];
[tableType release];
NSDictionary *tempRow = [tableStatusResult fetchRowAsDictionary];
if ( [tempRow objectForKey:@"Type"]) {
- tableType = [tempRow objectForKey:@"Type"];
+ tableType = [tempRow objectForKey:@"Type"];
} else {
- tableType = [tempRow objectForKey:@"Engine"];
+ tableType = [tempRow objectForKey:@"Engine"];
}
[tableType retain];
//get table default values
if ( defaultValues ) {
- [defaultValues release];
- defaultValues = nil;
+ [defaultValues release];
+ defaultValues = nil;
}
tempDefaultValues = [NSMutableDictionary dictionary];
for ( i = 0 ; i < [tableFields count] ; i++ ) {
- [tempDefaultValues setObject:[[tableFields objectAtIndex:i] objectForKey:@"Default"] forKey:[[tableFields objectAtIndex:i] objectForKey:@"Field"]];
+ [tempDefaultValues setObject:[[tableFields objectAtIndex:i] objectForKey:@"Default"] forKey:[[tableFields objectAtIndex:i] objectForKey:@"Field"]];
}
defaultValues = [[NSDictionary dictionaryWithDictionary:tempDefaultValues] retain];
//put field length and extras in separate key
enumerator = [tableFields objectEnumerator];
while ( (field = [enumerator nextObject]) ) {
- NSString *type;
- NSString *length;
- NSString *extras;
- // scan for length and extras like unsigned
- [scanner initWithString:[field objectForKey:@"Type"]];
- [scanner scanUpToString:@"(" intoString:&type];
- [scanner scanString:@"(" intoString:nil];
- if ( ![scanner scanUpToString:@")" intoString:&length] )
- length = @"";
- [scanner scanString:@")" intoString:nil];
- if ( ![scanner scanUpToString:@"" intoString:&extras] ) {
- extras = @"";
- }
+ NSString *type;
+ NSString *length;
+ NSString *extras;
+ // scan for length and extras like unsigned
+ [scanner initWithString:[field objectForKey:@"Type"]];
+ [scanner scanUpToString:@"(" intoString:&type];
+ [scanner scanString:@"(" intoString:nil];
+ if ( ![scanner scanUpToString:@")" intoString:&length] )
+ length = @"";
+ [scanner scanString:@")" intoString:nil];
+ if ( ![scanner scanUpToString:@"" intoString:&extras] ) {
+ extras = @"";
+ }
// get possible values if field is enum or set
if ( [type isEqualToString:@"enum"] || [type isEqualToString:@"set"] ) {
NSMutableArray *possibleValues = [[[length substringWithRange:NSMakeRange(1,[length length]-2)] componentsSeparatedByString:@"','"] mutableCopy];
@@ -136,24 +136,24 @@
[enumFields setObject:[NSArray arrayWithArray:possibleValues] forKey:[field objectForKey:@"Field"]];
[possibleValues release];
}
-
+
// scan extras for values like unsigned, zerofill, binary
- extrasArray = [extras componentsSeparatedByString:@" "];
- extrasEnumerator = [extrasArray objectEnumerator];
- while ( (extra = [extrasEnumerator nextObject]) ) {
- if ( [extra isEqualToString:@"unsigned"] ) {
- [field setObject:@"1" forKey:@"unsigned"];
- } else if ( [extra isEqualToString:@"zerofill"] ) {
- [field setObject:@"1" forKey:@"zerofill"];
- } else if ( [extra isEqualToString:@"binary"] ) {
- [field setObject:@"1" forKey:@"binary"];
- } else {
- if ( ![extra isEqualToString:@""] )
- NSLog(@"ERROR: unknown option in field definition: %@", extra);
- }
- }
- [field setObject:type forKey:@"Type"];
- [field setObject:length forKey:@"Length"];
+ extrasArray = [extras componentsSeparatedByString:@" "];
+ extrasEnumerator = [extrasArray objectEnumerator];
+ while ( (extra = [extrasEnumerator nextObject]) ) {
+ if ( [extra isEqualToString:@"unsigned"] ) {
+ [field setObject:@"1" forKey:@"unsigned"];
+ } else if ( [extra isEqualToString:@"zerofill"] ) {
+ [field setObject:@"1" forKey:@"zerofill"];
+ } else if ( [extra isEqualToString:@"binary"] ) {
+ [field setObject:@"1" forKey:@"binary"];
+ } else {
+ if ( ![extra isEqualToString:@""] )
+ NSLog(@"ERROR: unknown option in field definition: %@", extra);
+ }
+ }
+ [field setObject:type forKey:@"Type"];
+ [field setObject:length forKey:@"Length"];
}
// Determine the table type
@@ -176,12 +176,12 @@
[indexedColumnsField removeAllItems];
enumerator = [tableFields objectEnumerator];
while ( (field = [enumerator nextObject]) ) {
- [indexedColumnsField addItemWithObjectValue:[field objectForKey:@"Field"]];
+ [indexedColumnsField addItemWithObjectValue:[field objectForKey:@"Field"]];
}
if ( [tableFields count] < 10 ) {
- [indexedColumnsField setNumberOfVisibleItems:[tableFields count]];
+ [indexedColumnsField setNumberOfVisibleItems:[tableFields count]];
} else {
- [indexedColumnsField setNumberOfVisibleItems:10];
+ [indexedColumnsField setNumberOfVisibleItems:10];
}
[tableSourceView reloadData];
@@ -202,7 +202,7 @@
reloads the table (performing a new mysql-query)
*/
{
- [self loadTable:selectedTable];
+ [self loadTable:selectedTable];
}
@@ -213,21 +213,21 @@ adds an empty row to the tableSource-array and goes into edit mode
*/
{
/*
- if ( ![self addRowToDB] )
- return;
+ if ( ![self addRowToDB] )
+ return;
*/
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
-
- [tableFields addObject:[NSMutableDictionary
- dictionaryWithObjects:[NSArray arrayWithObjects:@"",@"int",@"",@"0",@"0",@"0",@"YES",@"",[prefs stringForKey:@"nullValue"],@"None",nil]
- forKeys:[NSArray arrayWithObjects:@"Field",@"Type",@"Length",@"unsigned",@"zerofill",@"binary",@"Null",@"Key",@"Default",@"Extra",nil]]];
-
- isEditingRow = YES;
- isEditingNewRow = YES;
- [tableSourceView reloadData];
- [tableSourceView selectRow:[tableSourceView numberOfRows]-1 byExtendingSelection:NO];
- [tableSourceView editColumn:0 row:[tableSourceView numberOfRows]-1 withEvent:nil select:YES];
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
+
+ [tableFields addObject:[NSMutableDictionary
+ dictionaryWithObjects:[NSArray arrayWithObjects:@"",@"int",@"",@"0",@"0",@"0",@"YES",@"",[prefs stringForKey:@"nullValue"],@"None",nil]
+ forKeys:[NSArray arrayWithObjects:@"Field",@"Type",@"Length",@"unsigned",@"zerofill",@"binary",@"Null",@"Key",@"Default",@"Extra",nil]]];
+
+ isEditingRow = YES;
+ isEditingNewRow = YES;
+ [tableSourceView reloadData];
+ [tableSourceView selectRow:[tableSourceView numberOfRows]-1 byExtendingSelection:NO];
+ [tableSourceView editColumn:0 row:[tableSourceView numberOfRows]-1 withEvent:nil select:YES];
}
- (IBAction)copyField:(id)sender
@@ -235,24 +235,24 @@ adds an empty row to the tableSource-array and goes into edit mode
copies a field and goes in edit mode for the new field
*/
{
- NSMutableDictionary *tempRow;
-
- if ( ![tableSourceView numberOfSelectedRows] )
- return;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
-
- //add copy of selected row and go in edit mode
- tempRow = [NSMutableDictionary dictionaryWithDictionary:[tableFields objectAtIndex:[tableSourceView selectedRow]]];
- [tempRow setObject:[[tempRow objectForKey:@"Field"] stringByAppendingString:@"Copy"] forKey:@"Field"];
- [tempRow setObject:@"" forKey:@"Key"];
- [tempRow setObject:@"None" forKey:@"Extra"];
- [tableFields addObject:tempRow];
- isEditingRow = YES;
- isEditingNewRow = YES;
- [tableSourceView reloadData];
- [tableSourceView selectRow:[tableSourceView numberOfRows]-1 byExtendingSelection:NO];
- [tableSourceView editColumn:0 row:[tableSourceView numberOfRows]-1 withEvent:nil select:YES];
+ NSMutableDictionary *tempRow;
+
+ if ( ![tableSourceView numberOfSelectedRows] )
+ return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
+
+ //add copy of selected row and go in edit mode
+ tempRow = [NSMutableDictionary dictionaryWithDictionary:[tableFields objectAtIndex:[tableSourceView selectedRow]]];
+ [tempRow setObject:[[tempRow objectForKey:@"Field"] stringByAppendingString:@"Copy"] forKey:@"Field"];
+ [tempRow setObject:@"" forKey:@"Key"];
+ [tempRow setObject:@"None" forKey:@"Extra"];
+ [tableFields addObject:tempRow];
+ isEditingRow = YES;
+ isEditingNewRow = YES;
+ [tableSourceView reloadData];
+ [tableSourceView selectRow:[tableSourceView numberOfRows]-1 byExtendingSelection:NO];
+ [tableSourceView editColumn:0 row:[tableSourceView numberOfRows]-1 withEvent:nil select:YES];
}
- (IBAction)addIndex:(id)sender
@@ -260,52 +260,52 @@ copies a field and goes in edit mode for the new field
adds the index to the mysql-db and stops modal session with code 1 when success, 0 when error and -1 when no columns specified
*/
{
- NSString *indexName;
- NSArray *indexedColumns;
- NSMutableArray *tempIndexedColumns = [NSMutableArray array];
- NSEnumerator *enumerator;
- NSString *string;
-
- if ( [[indexedColumnsField stringValue] isEqualToString:@""] ) {
- [NSApp stopModalWithCode:-1];
- } else {
- if ( [[indexNameField stringValue] isEqualToString:@"PRIMARY"] ) {
- indexName = @"";
- } else {
- if ( [[indexNameField stringValue] isEqualToString:@""] )
- {
- indexName = @"";
- } else {
- indexName = [NSString stringWithFormat:@"`%@`", [indexNameField stringValue]];
- }
- }
- indexedColumns = [[indexedColumnsField stringValue] componentsSeparatedByString:@","];
- enumerator = [indexedColumns objectEnumerator];
- while ( (string = [enumerator nextObject]) ) {
- if ( ([string characterAtIndex:0] == ' ') ) {
- [tempIndexedColumns addObject:[string substringWithRange:NSMakeRange(1,([string length]-1))]];
- } else {
- [tempIndexedColumns addObject:[NSString stringWithString:string]];
- }
- }
-
- [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` ADD %@ %@ (`%@`)",
- selectedTable, [indexTypeField titleOfSelectedItem], indexName,
- [tempIndexedColumns componentsJoinedByString:@"`,`"]]];
+ NSString *indexName;
+ NSArray *indexedColumns;
+ NSMutableArray *tempIndexedColumns = [NSMutableArray array];
+ NSEnumerator *enumerator;
+ NSString *string;
+
+ if ( [[indexedColumnsField stringValue] isEqualToString:@""] ) {
+ [NSApp stopModalWithCode:-1];
+ } else {
+ if ( [[indexNameField stringValue] isEqualToString:@"PRIMARY"] ) {
+ indexName = @"";
+ } else {
+ if ( [[indexNameField stringValue] isEqualToString:@""] )
+ {
+ indexName = @"";
+ } else {
+ indexName = [NSString stringWithFormat:@"`%@`", [indexNameField stringValue]];
+ }
+ }
+ indexedColumns = [[indexedColumnsField stringValue] componentsSeparatedByString:@","];
+ enumerator = [indexedColumns objectEnumerator];
+ while ( (string = [enumerator nextObject]) ) {
+ if ( ([string characterAtIndex:0] == ' ') ) {
+ [tempIndexedColumns addObject:[string substringWithRange:NSMakeRange(1,([string length]-1))]];
+ } else {
+ [tempIndexedColumns addObject:[NSString stringWithString:string]];
+ }
+ }
+
+ [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` ADD %@ %@ (`%@`)",
+ selectedTable, [indexTypeField titleOfSelectedItem], indexName,
+ [tempIndexedColumns componentsJoinedByString:@"`,`"]]];
/*
NSLog([NSString stringWithFormat:@"ALTER TABLE `%@` ADD %@ %@ (`%@`)",
- selectedTable, [indexTypeField titleOfSelectedItem], indexName,
- [[[indexedColumnsField stringValue] componentsSeparatedByString:@","] componentsJoinedByString:@"`,`"]]);
+ selectedTable, [indexTypeField titleOfSelectedItem], indexName,
+ [[[indexedColumnsField stringValue] componentsSeparatedByString:@","] componentsJoinedByString:@"`,`"]]);
*/
- if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [self loadTable:selectedTable];
- [NSApp stopModalWithCode:1];
- } else {
- [NSApp stopModalWithCode:0];
- }
- }
+ if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [self loadTable:selectedTable];
+ [NSApp stopModalWithCode:1];
+ } else {
+ [NSApp stopModalWithCode:0];
+ }
+ }
}
- (IBAction)removeField:(id)sender
@@ -313,14 +313,14 @@ NSLog([NSString stringWithFormat:@"ALTER TABLE `%@` ADD %@ %@ (`%@`)",
opens alertsheet and asks for confirmation
*/
{
- if ( ![tableSourceView numberOfSelectedRows] )
- return;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
-
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
- nil, @"removefield", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the field %@?", @"message of panel asking for confirmation for deleting field"),
- [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"]] );
+ if ( ![tableSourceView numberOfSelectedRows] )
+ return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
+
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ nil, @"removefield", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the field %@?", @"message of panel asking for confirmation for deleting field"),
+ [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"]] );
}
- (IBAction)removeIndex:(id)sender
@@ -328,47 +328,47 @@ opens alertsheet and asks for confirmation
opens alertsheet and asks for confirmation
*/
{
- if ( ![indexView numberOfSelectedRows] )
- return;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
-
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
- nil, @"removeindex", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the index %@?", @"message of panel asking for confirmation for deleting index"),
- [[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"]] );
+ if ( ![indexView numberOfSelectedRows] )
+ return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
+
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ nil, @"removeindex", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the index %@?", @"message of panel asking for confirmation for deleting index"),
+ [[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"]] );
}
- (IBAction)typeChanged:(id)sender
{
- NSString* selectedItem = [sender titleOfSelectedItem];
- if([selectedItem isEqualToString:@"--"] || [tableType isEqualToString:selectedItem]) {
- [sender selectItemWithTitle:tableType];
- } else {
- // alert any listeners that we are about to perform a query.
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
-
- NSString *query = [NSString stringWithFormat:@"ALTER TABLE `%@` TYPE = %@",selectedTable,selectedItem];
- [mySQLConnection queryString:query];
-
- // The query is now complete.
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
-
- // Did the alter work? If so, we need to record the new data. If not, we must revert back to
- // the previous state.
- if([mySQLConnection getLastErrorID] == 0)
- {
- // Make sure "tableType" is changed and the status tab is flagged for reload...
- [tableType release];
- tableType = selectedItem;
- [tableType retain];
-
-// [[NSNotificationCenter defaultCenter] postNotificationName:@"SelectedTableStatusHasChanged" object:self];
- } else {
- [sender selectItemWithTitle:tableType];
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't change table type.\nMySQL said: %@", @"message of panel when table type cannot be removed"), [mySQLConnection getLastErrorMessage]]);
- }
- }
+ NSString* selectedItem = [sender titleOfSelectedItem];
+ if([selectedItem isEqualToString:@"--"] || [tableType isEqualToString:selectedItem]) {
+ [sender selectItemWithTitle:tableType];
+ } else {
+ // alert any listeners that we are about to perform a query.
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+
+ NSString *query = [NSString stringWithFormat:@"ALTER TABLE `%@` TYPE = %@",selectedTable,selectedItem];
+ [mySQLConnection queryString:query];
+
+ // The query is now complete.
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+
+ // Did the alter work? If so, we need to record the new data. If not, we must revert back to
+ // the previous state.
+ if([mySQLConnection getLastErrorID] == 0)
+ {
+ // Make sure "tableType" is changed and the status tab is flagged for reload...
+ [tableType release];
+ tableType = selectedItem;
+ [tableType retain];
+
+// [[NSNotificationCenter defaultCenter] postNotificationName:@"SelectedTableStatusHasChanged" object:self];
+ } else {
+ [sender selectItemWithTitle:tableType];
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't change table type.\nMySQL said: %@", @"message of panel when table type cannot be removed"), [mySQLConnection getLastErrorMessage]]);
+ }
+ }
}
@@ -378,34 +378,34 @@ opens alertsheet and asks for confirmation
opens the indexSheet
*/
{
- int code = 0;
+ int code = 0;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return;
- [indexTypeField selectItemAtIndex:0];
- [indexNameField setEnabled:NO];
- [indexNameField setStringValue:@"PRIMARY"];
- [indexedColumnsField setStringValue:@""];
+ [indexTypeField selectItemAtIndex:0];
+ [indexNameField setEnabled:NO];
+ [indexNameField setStringValue:@"PRIMARY"];
+ [indexedColumnsField setStringValue:@""];
- [NSApp beginSheet:indexSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:indexSheet];
-
- [NSApp endSheet:indexSheet];
- [indexSheet orderOut:nil];
+ [NSApp beginSheet:indexSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ code = [NSApp runModalForWindow:indexSheet];
+
+ [NSApp endSheet:indexSheet];
+ [indexSheet orderOut:nil];
//code == -1 -> no columns specified
//code == 0 -> error while adding index
//code == 1 -> index added with succes OR sheet closed without adding index
- if ( code == 0 ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't add index.\nMySQL said: %@", @"message of panel when index cannot be created"), [mySQLConnection getLastErrorMessage]]);
- } else if ( code == -1 ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, @selector(closeAlertSheet), nil,
- NSLocalizedString(@"Please insert the columns you want to index.", @"message of panel when no columns are specified to be indexed"));
- }
+ if ( code == 0 ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't add index.\nMySQL said: %@", @"message of panel when index cannot be created"), [mySQLConnection getLastErrorMessage]]);
+ } else if ( code == -1 ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, @selector(closeAlertSheet), nil,
+ NSLocalizedString(@"Please insert the columns you want to index.", @"message of panel when no columns are specified to be indexed"));
+ }
}
- (IBAction)closeIndexSheet:(id)sender
@@ -413,7 +413,7 @@ opens the indexSheet
closes the indexSheet without adding the index (stops modal session with code 1)
*/
{
- [NSApp stopModalWithCode:1];
+ [NSApp stopModalWithCode:1];
}
- (IBAction)chooseIndexType:(id)sender
@@ -421,14 +421,14 @@ closes the indexSheet without adding the index (stops modal session with code 1)
invoked when user chooses an index type
*/
{
- if ( [[indexTypeField titleOfSelectedItem] isEqualToString:@"PRIMARY KEY"] ) {
- [indexNameField setEnabled:NO];
- [indexNameField setStringValue:@"PRIMARY"];
- } else {
- [indexNameField setEnabled:YES];
- if ( [[indexNameField stringValue] isEqualToString:@"PRIMARY"] )
- [indexNameField setStringValue:@""];
- }
+ if ( [[indexTypeField titleOfSelectedItem] isEqualToString:@"PRIMARY KEY"] ) {
+ [indexNameField setEnabled:NO];
+ [indexNameField setStringValue:@"PRIMARY"];
+ } else {
+ [indexNameField setEnabled:YES];
+ if ( [[indexNameField stringValue] isEqualToString:@"PRIMARY"] )
+ [indexNameField setStringValue:@""];
+ }
}
- (void)closeAlertSheet
@@ -436,7 +436,7 @@ invoked when user chooses an index type
reopens indexSheet after errorSheet (no columns specified)
*/
{
- [self openIndexSheet:self];
+ [self openIndexSheet:self];
}
//key sheet methods
@@ -445,7 +445,7 @@ reopens indexSheet after errorSheet (no columns specified)
closes the keySheet
*/
{
- [NSApp stopModalWithCode:[sender tag]];
+ [NSApp stopModalWithCode:[sender tag]];
}
@@ -455,28 +455,28 @@ closes the keySheet
sets the connection (received from TableDocument) and makes things that have to be done only once
*/
{
- NSEnumerator *indexColumnsEnumerator = [[indexView tableColumns] objectEnumerator];
- NSEnumerator *fieldColumnsEnumerator = [[tableSourceView tableColumns] objectEnumerator];
- id indexColumn;
- id fieldColumn;
+ NSEnumerator *indexColumnsEnumerator = [[indexView tableColumns] objectEnumerator];
+ NSEnumerator *fieldColumnsEnumerator = [[tableSourceView tableColumns] objectEnumerator];
+ id indexColumn;
+ id fieldColumn;
- mySQLConnection = theConnection;
+ mySQLConnection = theConnection;
- prefs = [[NSUserDefaults standardUserDefaults] retain];
+ prefs = [[NSUserDefaults standardUserDefaults] retain];
//set up tableView
- [tableSourceView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]];
-
- while ( (indexColumn = [indexColumnsEnumerator nextObject]) ) {
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [[indexColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
- }
- }
- while ( (fieldColumn = [fieldColumnsEnumerator nextObject]) ) {
- if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- [[fieldColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- }
- }
+ [tableSourceView registerForDraggedTypes:[NSArray arrayWithObjects:@"SequelProPasteboard", nil]];
+
+ while ( (indexColumn = [indexColumnsEnumerator nextObject]) ) {
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [[indexColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:10]];
+ }
+ }
+ while ( (fieldColumn = [fieldColumnsEnumerator nextObject]) ) {
+ if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ [[fieldColumn dataCell] setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ }
+ }
}
- (NSArray *)fetchResultAsArray:(CMMCPResult *)theResult
@@ -484,37 +484,37 @@ sets the connection (received from TableDocument) and makes things that have to
fetches the result as an array with a dictionary for each row in it
*/
{
- NSMutableArray *tempResult = [NSMutableArray array];
- NSMutableDictionary *tempRow;
- NSEnumerator *enumerator;
- id key;
- int i;
-
- for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
- tempRow = [NSMutableDictionary dictionaryWithDictionary:[theResult fetchRowAsDictionary]];
-
- //use NULL string from preferences instead of the NSNull oject returned by the framework
- enumerator = [tempRow keyEnumerator];
- while ( (key = [enumerator nextObject]) ) {
- if ( [[tempRow objectForKey:key] isMemberOfClass:[NSNull class]] )
- [tempRow setObject:[prefs objectForKey:@"nullValue"] forKey:key];
- }
- // change some fields to be more human-readable or GUI compatible
- if ( [[tempRow objectForKey:@"Extra"] isEqualToString:@""] ) {
- [tempRow setObject:@"None" forKey:@"Extra"];
- }
- if ( [[tempRow objectForKey:@"Null"] isEqualToString:@"YES"] ) {
-// [tempRow setObject:[NSNumber numberWithInt:0] forKey:@"Null"];
- [tempRow setObject:@"YES" forKey:@"Null"];
- } else {
-// [tempRow setObject:[NSNumber numberWithInt:1] forKey:@"Null"];
- [tempRow setObject:@"NO" forKey:@"Null"];
- }
- [tempResult addObject:tempRow];
- }
-
- return tempResult;
+ NSMutableArray *tempResult = [NSMutableArray array];
+ NSMutableDictionary *tempRow;
+ NSEnumerator *enumerator;
+ id key;
+ int i;
+
+ for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
+ [theResult dataSeek:i];
+ tempRow = [NSMutableDictionary dictionaryWithDictionary:[theResult fetchRowAsDictionary]];
+
+ //use NULL string from preferences instead of the NSNull oject returned by the framework
+ enumerator = [tempRow keyEnumerator];
+ while ( (key = [enumerator nextObject]) ) {
+ if ( [[tempRow objectForKey:key] isMemberOfClass:[NSNull class]] )
+ [tempRow setObject:[prefs objectForKey:@"nullValue"] forKey:key];
+ }
+ // change some fields to be more human-readable or GUI compatible
+ if ( [[tempRow objectForKey:@"Extra"] isEqualToString:@""] ) {
+ [tempRow setObject:@"None" forKey:@"Extra"];
+ }
+ if ( [[tempRow objectForKey:@"Null"] isEqualToString:@"YES"] ) {
+// [tempRow setObject:[NSNumber numberWithInt:0] forKey:@"Null"];
+ [tempRow setObject:@"YES" forKey:@"Null"];
+ } else {
+// [tempRow setObject:[NSNumber numberWithInt:1] forKey:@"Null"];
+ [tempRow setObject:@"NO" forKey:@"Null"];
+ }
+ [tempResult addObject:tempRow];
+ }
+
+ return tempResult;
}
- (BOOL)addRowToDB;
@@ -524,114 +524,114 @@ returns YES if row written to db, otherwies NO
returns YES if no row is beeing edited and nothing has to be written to db
*/
{
- NSDictionary *theRow;
- NSMutableString *queryString;
- int code;
+ NSDictionary *theRow;
+ NSMutableString *queryString;
+ int code;
- if ( !isEditingRow || ![tableSourceView numberOfSelectedRows] )
- return YES;
- if ( alertSheetOpened )
- return NO;
+ if ( !isEditingRow || ![tableSourceView numberOfSelectedRows] )
+ return YES;
+ if ( alertSheetOpened )
+ return NO;
- theRow = [tableFields objectAtIndex:[tableSourceView selectedRow]];
+ theRow = [tableFields objectAtIndex:[tableSourceView selectedRow]];
- if ( isEditingNewRow ) {
+ if ( isEditingNewRow ) {
//ADD syntax
- if ( [[theRow objectForKey:@"Length"] isEqualToString:@""] || ![theRow objectForKey:@"Length"] ) {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` ADD `%@` %@",
- selectedTable, [theRow objectForKey:@"Field"], [theRow objectForKey:@"Type"]];
- } else {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` ADD `%@` %@(%@)",
- selectedTable, [theRow objectForKey:@"Field"], [theRow objectForKey:@"Type"],
- [theRow objectForKey:@"Length"]];
- }
- } else {
+ if ( [[theRow objectForKey:@"Length"] isEqualToString:@""] || ![theRow objectForKey:@"Length"] ) {
+ queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` ADD `%@` %@",
+ selectedTable, [theRow objectForKey:@"Field"], [theRow objectForKey:@"Type"]];
+ } else {
+ queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` ADD `%@` %@(%@)",
+ selectedTable, [theRow objectForKey:@"Field"], [theRow objectForKey:@"Type"],
+ [theRow objectForKey:@"Length"]];
+ }
+ } else {
//CHANGE syntax
- if ( [[theRow objectForKey:@"Length"] isEqualToString:@""] || ![theRow objectForKey:@"Length"] ) {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` CHANGE `%@` `%@` %@",
- selectedTable, [oldRow objectForKey:@"Field"], [theRow objectForKey:@"Field"],
- [theRow objectForKey:@"Type"]];
- } else {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` CHANGE `%@` `%@` %@(%@)",
- selectedTable, [oldRow objectForKey:@"Field"], [theRow objectForKey:@"Field"],
- [theRow objectForKey:@"Type"], [theRow objectForKey:@"Length"]];
- }
- }
+ if ( [[theRow objectForKey:@"Length"] isEqualToString:@""] || ![theRow objectForKey:@"Length"] ) {
+ queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` CHANGE `%@` `%@` %@",
+ selectedTable, [oldRow objectForKey:@"Field"], [theRow objectForKey:@"Field"],
+ [theRow objectForKey:@"Type"]];
+ } else {
+ queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` CHANGE `%@` `%@` %@(%@)",
+ selectedTable, [oldRow objectForKey:@"Field"], [theRow objectForKey:@"Field"],
+ [theRow objectForKey:@"Type"], [theRow objectForKey:@"Length"]];
+ }
+ }
//field specification
- if ( [[theRow objectForKey:@"unsigned"] intValue] == 1 ) {
- [queryString appendString:@" UNSIGNED"];
- }
- if ( [[theRow objectForKey:@"zerofill"] intValue] == 1 ) {
- [queryString appendString:@" ZEROFILL"];
- }
- if ( [[theRow objectForKey:@"binary"] intValue] == 1 ) {
- [queryString appendString:@" BINARY"];
- }
-// if ( [[theRow objectForKey:@"Null"] isEqualToString:@"NO"] || [[theRow objectForKey:@"Null"] isEqualToString:@"NOT NULL"]
-// || [[theRow objectForKey:@"Null"] isEqualToString:@"no"] || [[theRow objectForKey:@"Null"] isEqualToString:@"not null"])
- if ( [[theRow objectForKey:@"Null"] isEqualToString:@"NO"] )
- [queryString appendString:@" NOT NULL"];
- if ( ![[theRow objectForKey:@"Extra"] isEqualToString:@"auto_increment"] && !([[theRow objectForKey:@"Type"] isEqualToString:@"timestamp"] && [[theRow objectForKey:@"Default"] isEqualToString:@"NULL"]) ) {
- if ( [[theRow objectForKey:@"Default"] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
- if ([[theRow objectForKey:@"Null"] isEqualToString:@"YES"] ) {
- [queryString appendString:@" DEFAULT NULL "];
- }
+ if ( [[theRow objectForKey:@"unsigned"] intValue] == 1 ) {
+ [queryString appendString:@" UNSIGNED"];
+ }
+ if ( [[theRow objectForKey:@"zerofill"] intValue] == 1 ) {
+ [queryString appendString:@" ZEROFILL"];
+ }
+ if ( [[theRow objectForKey:@"binary"] intValue] == 1 ) {
+ [queryString appendString:@" BINARY"];
+ }
+// if ( [[theRow objectForKey:@"Null"] isEqualToString:@"NO"] || [[theRow objectForKey:@"Null"] isEqualToString:@"NOT NULL"]
+// || [[theRow objectForKey:@"Null"] isEqualToString:@"no"] || [[theRow objectForKey:@"Null"] isEqualToString:@"not null"])
+ if ( [[theRow objectForKey:@"Null"] isEqualToString:@"NO"] )
+ [queryString appendString:@" NOT NULL"];
+ if ( ![[theRow objectForKey:@"Extra"] isEqualToString:@"auto_increment"] && !([[theRow objectForKey:@"Type"] isEqualToString:@"timestamp"] && [[theRow objectForKey:@"Default"] isEqualToString:@"NULL"]) ) {
+ if ( [[theRow objectForKey:@"Default"] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
+ if ([[theRow objectForKey:@"Null"] isEqualToString:@"YES"] ) {
+ [queryString appendString:@" DEFAULT NULL "];
+ }
} else if ( [[theRow objectForKey:@"Type"] isEqualToString:@"timestamp"] && ([[theRow objectForKey:@"Default"] isEqualToString:@"CURRENT_TIMESTAMP"] || [[theRow objectForKey:@"Default"] isEqualToString:@"current_timestamp"]) ) {
- [queryString appendString:@" DEFAULT CURRENT_TIMESTAMP "];
- } else {
- // [queryString appendString:[NSString stringWithFormat:@" DEFAULT \"%@\" ", [theRow objectForKey:@"Default"]]];
- [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@' ", [mySQLConnection prepareString:[theRow objectForKey:@"Default"]]]];
- }
- } else {
- [queryString appendString:@" "];
- }
- if ( ![[theRow objectForKey:@"Extra"] isEqualToString:@""] &&
- ![[theRow objectForKey:@"Extra"] isEqualToString:@"None"] &&
- [theRow objectForKey:@"Extra"] )
- [queryString appendString:[theRow objectForKey:@"Extra"]];
+ [queryString appendString:@" DEFAULT CURRENT_TIMESTAMP "];
+ } else {
+ // [queryString appendString:[NSString stringWithFormat:@" DEFAULT \"%@\" ", [theRow objectForKey:@"Default"]]];
+ [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@' ", [mySQLConnection prepareString:[theRow objectForKey:@"Default"]]]];
+ }
+ } else {
+ [queryString appendString:@" "];
+ }
+ if ( ![[theRow objectForKey:@"Extra"] isEqualToString:@""] &&
+ ![[theRow objectForKey:@"Extra"] isEqualToString:@"None"] &&
+ [theRow objectForKey:@"Extra"] )
+ [queryString appendString:[theRow objectForKey:@"Extra"]];
//asks to add an index to query if auto_increment is set and field isn't indexed
- if ( [[theRow objectForKey:@"Extra"] isEqualToString:@"auto_increment"]
- && ([[theRow objectForKey:@"Key"] isEqualToString:@""] || ![theRow objectForKey:@"Key"]) ) {
- [chooseKeyButton selectItemAtIndex:0];
- [NSApp beginSheet:keySheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:keySheet];
-
- [NSApp endSheet:keySheet];
- [keySheet orderOut:nil];
+ if ( [[theRow objectForKey:@"Extra"] isEqualToString:@"auto_increment"]
+ && ([[theRow objectForKey:@"Key"] isEqualToString:@""] || ![theRow objectForKey:@"Key"]) ) {
+ [chooseKeyButton selectItemAtIndex:0];
+ [NSApp beginSheet:keySheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ code = [NSApp runModalForWindow:keySheet];
+
+ [NSApp endSheet:keySheet];
+ [keySheet orderOut:nil];
if ( code ) {
- if ( [chooseKeyButton indexOfSelectedItem] == 0 ) {
- [queryString appendString:@" PRIMARY KEY"];
- } else {
- [queryString appendString:[NSString stringWithFormat:@", ADD %@ (`%@`)",
- [chooseKeyButton titleOfSelectedItem], [theRow objectForKey:@"Field"]]];
- }
- }
- }
- [mySQLConnection queryString:queryString];
+ if ( [chooseKeyButton indexOfSelectedItem] == 0 ) {
+ [queryString appendString:@" PRIMARY KEY"];
+ } else {
+ [queryString appendString:[NSString stringWithFormat:@", ADD %@ (`%@`)",
+ [chooseKeyButton titleOfSelectedItem], [theRow objectForKey:@"Field"]]];
+ }
+ }
+ }
+ [mySQLConnection queryString:queryString];
//NSLog(queryString);
- if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- isEditingRow = NO;
- isEditingNewRow = NO;
- [self loadTable:selectedTable];
- return YES;
- } else {
- alertSheetOpened = YES;
+ if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ isEditingRow = NO;
+ isEditingNewRow = NO;
+ [self loadTable:selectedTable];
+ return YES;
+ } else {
+ alertSheetOpened = YES;
//problem: alert sheet doesn't respond to first click
- if ( isEditingNewRow ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
- nil, @"addrow", [NSString stringWithFormat:NSLocalizedString(@"Couldn't add field %@.\nMySQL said: %@", @"message of panel when field cannot be added"),
- [theRow objectForKey:@"Field"], [mySQLConnection getLastErrorMessage]]);
- } else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
- nil, @"addrow", [NSString stringWithFormat:NSLocalizedString(@"Couldn't change field %@.\nMySQL said: %@", @"message of panel when field cannot be changed"),
- [theRow objectForKey:@"Field"], [mySQLConnection getLastErrorMessage]]);
- }
- return NO;
- }
+ if ( isEditingNewRow ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ nil, @"addrow", [NSString stringWithFormat:NSLocalizedString(@"Couldn't add field %@.\nMySQL said: %@", @"message of panel when field cannot be added"),
+ [theRow objectForKey:@"Field"], [mySQLConnection getLastErrorMessage]]);
+ } else {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, @selector(sheetDidEnd:returnCode:contextInfo:),
+ nil, @"addrow", [NSString stringWithFormat:NSLocalizedString(@"Couldn't change field %@.\nMySQL said: %@", @"message of panel when field cannot be changed"),
+ [theRow objectForKey:@"Field"], [mySQLConnection getLastErrorMessage]]);
+ }
+ return NO;
+ }
}
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(NSString *)contextInfo
@@ -641,58 +641,58 @@ if contextInfo == removefield: removes row from mysql-db if user hits ok
if contextInfo == removeindex: removes index from mysql-db if user hits ok
*/
{
- [sheet orderOut:self];
-
- if ( [contextInfo isEqualToString:@"addrow"] ) {
- alertSheetOpened = NO;
- if ( returnCode == NSAlertDefaultReturn ) {
- //problem: reentering edit mode for first cell doesn't function
- [tableSourceView editColumn:0 row:[tableSourceView selectedRow] withEvent:nil select:YES];
- } else {
- if ( !isEditingNewRow ) {
- [tableFields replaceObjectAtIndex:[tableSourceView selectedRow]
- withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
- isEditingRow = NO;
- } else {
- [tableFields removeObjectAtIndex:[tableSourceView selectedRow]];
- isEditingRow = NO;
- isEditingNewRow = NO;
- }
- }
- [tableSourceView reloadData];
- } else if ( [contextInfo isEqualToString:@"removefield"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ [sheet orderOut:self];
+
+ if ( [contextInfo isEqualToString:@"addrow"] ) {
+ alertSheetOpened = NO;
+ if ( returnCode == NSAlertDefaultReturn ) {
+ //problem: reentering edit mode for first cell doesn't function
+ [tableSourceView editColumn:0 row:[tableSourceView selectedRow] withEvent:nil select:YES];
+ } else {
+ if ( !isEditingNewRow ) {
+ [tableFields replaceObjectAtIndex:[tableSourceView selectedRow]
+ withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
+ isEditingRow = NO;
+ } else {
+ [tableFields removeObjectAtIndex:[tableSourceView selectedRow]];
+ isEditingRow = NO;
+ isEditingNewRow = NO;
+ }
+ }
+ [tableSourceView reloadData];
+ } else if ( [contextInfo isEqualToString:@"removefield"] ) {
+ if ( returnCode == NSAlertDefaultReturn ) {
//remove row
- [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP `%@`",
- selectedTable, [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"]]];
-
- if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [self loadTable:selectedTable];
- } else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
- [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"],
- [mySQLConnection getLastErrorMessage]]);
- }
- }
- } else if ( [contextInfo isEqualToString:@"removeindex"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
+ [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP `%@`",
+ selectedTable, [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"]]];
+
+ if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [self loadTable:selectedTable];
+ } else {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field %@.\nMySQL said: %@", @"message of panel when field cannot be removed"),
+ [[tableFields objectAtIndex:[tableSourceView selectedRow]] objectForKey:@"Field"],
+ [mySQLConnection getLastErrorMessage]]);
+ }
+ }
+ } else if ( [contextInfo isEqualToString:@"removeindex"] ) {
+ if ( returnCode == NSAlertDefaultReturn ) {
//remove index
- if ( [[[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"] isEqualToString:@"PRIMARY"] ) {
- [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP PRIMARY KEY", selectedTable]];
- } else {
- [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP INDEX `%@`",
- selectedTable, [[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"]]];
- }
-
- if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- [self loadTable:selectedTable];
- } else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove index.\nMySQL said: %@", @"message of panel when index cannot be removed"), [mySQLConnection getLastErrorMessage]]);
- }
- }
- }
+ if ( [[[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"] isEqualToString:@"PRIMARY"] ) {
+ [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP PRIMARY KEY", selectedTable]];
+ } else {
+ [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP INDEX `%@`",
+ selectedTable, [[indexes objectAtIndex:[indexView selectedRow]] objectForKey:@"Key_name"]]];
+ }
+
+ if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [self loadTable:selectedTable];
+ } else {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove index.\nMySQL said: %@", @"message of panel when index cannot be removed"), [mySQLConnection getLastErrorMessage]]);
+ }
+ }
+ }
}
@@ -702,13 +702,13 @@ if contextInfo == removeindex: removes index from mysql-db if user hits ok
get the default value for a specified field
*/
{
- if ( ![defaultValues objectForKey:field] ) {
- return [prefs objectForKey:@"nullValue"];
- } else if ( [[defaultValues objectForKey:field] isMemberOfClass:[NSNull class]] ) {
- return [prefs objectForKey:@"nullValue"];
- } else {
- return [defaultValues objectForKey:field];
- }
+ if ( ![defaultValues objectForKey:field] ) {
+ return [prefs objectForKey:@"nullValue"];
+ } else if ( [[defaultValues objectForKey:field] isMemberOfClass:[NSNull class]] ) {
+ return [prefs objectForKey:@"nullValue"];
+ } else {
+ return [defaultValues objectForKey:field];
+ }
}
- (NSArray *)fieldNames
@@ -722,12 +722,12 @@ get the default value for a specified field
//load table if not already done
if ( ![tablesListInstance structureLoaded] ) {
- [self loadTable:(NSString *)[tablesListInstance table]];
+ [self loadTable:(NSString *)[tablesListInstance table]];
}
//get field names
enumerator = [tableFields objectEnumerator];
while ( (field = [enumerator nextObject]) ) {
- [tempArray addObject:[field objectForKey:@"Field"]];
+ [tempArray addObject:[field objectForKey:@"Field"]];
}
return [NSArray arrayWithArray:tempArray];
@@ -745,300 +745,177 @@ returns a dictionary containing enum/set field names as key and possible values
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- if ( aTableView == tableSourceView ) {
- return [tableFields count];
- } else {
- return [indexes count];
- }
+ if ( aTableView == tableSourceView ) {
+ return [tableFields count];
+ } else {
+ return [indexes count];
+ }
}
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
- id theRow, theValue;
-
- if ( aTableView == tableSourceView ) {
- theRow = [tableFields objectAtIndex:rowIndex];
- } else {
- theRow = [indexes objectAtIndex:rowIndex];
- }
- theValue = [theRow objectForKey:[aTableColumn identifier]];
-
- return theValue;
+ id theRow, theValue;
+
+ if ( aTableView == tableSourceView ) {
+ theRow = [tableFields objectAtIndex:rowIndex];
+ } else {
+ theRow = [indexes objectAtIndex:rowIndex];
+ }
+ theValue = [theRow objectForKey:[aTableColumn identifier]];
+
+ return theValue;
}
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
- if ( !isEditingRow ) {
- [oldRow setDictionary:[tableFields objectAtIndex:rowIndex]];
- isEditingRow = YES;
- }
- if ( anObject ) {
- [[tableFields objectAtIndex:rowIndex] setObject:anObject forKey:[aTableColumn identifier]];
- } else {
- [[tableFields objectAtIndex:rowIndex] setObject:@"" forKey:[aTableColumn identifier]];
- }
+ if ( !isEditingRow ) {
+ [oldRow setDictionary:[tableFields objectAtIndex:rowIndex]];
+ isEditingRow = YES;
+ }
+ if ( anObject ) {
+ [[tableFields objectAtIndex:rowIndex] setObject:anObject forKey:[aTableColumn identifier]];
+ } else {
+ [[tableFields objectAtIndex:rowIndex] setObject:@"" forKey:[aTableColumn identifier]];
+ }
}
-//tableView drag&drop datasource methods
+/*
+Begin a drag and drop operation from the table - copy a single dragged row to the drag pasteboard.
+*/
- (BOOL)tableView:(NSTableView *)tableView writeRows:(NSArray*)rows toPasteboard:(NSPasteboard*)pboard
{
- int originalRow;
- NSArray *pboardTypes;
+ int originalRow;
+ NSArray *pboardTypes;
- if ( ![self selectionShouldChangeInTableView:nil] )
- return NO;
+ if ( ![self selectionShouldChangeInTableView:nil] )
+ return NO;
- if ( ([rows count] == 1) && (tableView == tableSourceView) ) {
- pboardTypes=[NSArray arrayWithObjects:@"SequelProPasteboard", nil];
- originalRow = [[rows objectAtIndex:0] intValue];
+ if ( ([rows count] == 1) && (tableView == tableSourceView) ) {
+ pboardTypes=[NSArray arrayWithObjects:@"SequelProPasteboard", nil];
+ originalRow = [[rows objectAtIndex:0] intValue];
- [pboard declareTypes:pboardTypes owner:nil];
- [pboard setString:[[NSNumber numberWithInt:originalRow] stringValue] forType:@"SequelProPasteboard"];
+ [pboard declareTypes:pboardTypes owner:nil];
+ [pboard setString:[[NSNumber numberWithInt:originalRow] stringValue] forType:@"SequelProPasteboard"];
- return YES;
- } else {
- return NO;
- }
+ return YES;
+ } else {
+ return NO;
+ }
}
+/*
+Determine whether to allow a drag and drop operation on this table - for the purposes of drag reordering,
+validate that the original source is of the correct type and within the same table, and that the drag
+would result in a position change.
+*/
- (NSDragOperation)tableView:(NSTableView*)tableView validateDrop:(id <NSDraggingInfo>)info proposedRow:(int)row
- proposedDropOperation:(NSTableViewDropOperation)operation
+ proposedDropOperation:(NSTableViewDropOperation)operation
{
- NSArray *pboardTypes = [[info draggingPasteboard] types];
- int originalRow;
-
- if ([pboardTypes count] == 1 && row != -1)
- {
- if ([[pboardTypes objectAtIndex:0] isEqualToString:@"SequelProPasteboard"]==YES && operation==NSTableViewDropAbove)
- {
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
-
- if (row != originalRow && row != (originalRow+1))
- {
- return NSDragOperationMove;
- }
- }
- }
-
- return NSDragOperationNone;
+ NSArray *pboardTypes = [[info draggingPasteboard] types];
+ int originalRow;
+
+ // Ensure the drop is of the correct type
+ if (operation == NSTableViewDropAbove && row != -1 && [pboardTypes containsObject:@"SequelProPasteboard"])
+ {
+
+ // Ensure the drag originated within this table
+ if ([info draggingSource] == tableView)
+ {
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
+
+ if (row != originalRow && row != (originalRow+1))
+ {
+ return NSDragOperationMove;
+ }
+ }
+ }
+
+ return NSDragOperationNone;
}
-- (BOOL)tableView:(NSTableView*)tableView acceptDrop:(id <NSDraggingInfo>)info row:(int)row dropOperation:(NSTableViewDropOperation)operation
+/*
+Having validated a drop, perform the field/column reordering to match.
+*/
+- (BOOL)tableView:(NSTableView*)tableView acceptDrop:(id <NSDraggingInfo>)info row:(int)destinationRow dropOperation:(NSTableViewDropOperation)operation
{
- int originalRow;
- int destinationRow;
- NSString *tempColName;
- NSMutableString *queryString;
- NSEnumerator *enumerator = [tableFields objectEnumerator];
- id field;
- NSMutableArray *fieldNames = [NSMutableArray array];
- int i;
-
+ int originalRow;
+ NSMutableString *queryString;
+
+ // Extract the original row position from the pasteboard.
+ originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+
+ // Begin construction of the reordering query
+ queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` MODIFY COLUMN `%@` %@",
+ selectedTable,
+ [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"],
+ [[tableFields objectAtIndex:originalRow] objectForKey:@"Type"]];
+
+ // Add the length parameter if necessary
+ if ( [[tableFields objectAtIndex:originalRow] objectForKey:@"Length"] &&
+ ![[[tableFields objectAtIndex:originalRow] objectForKey:@"Length"] isEqualToString:@""])
+ {
+ [queryString appendString:[NSString stringWithFormat:@"(%@)",
+ [[tableFields objectAtIndex:originalRow] objectForKey:@"Length"]]];
+ }
- originalRow = [[[info draggingPasteboard] stringForType:@"SequelProPasteboard"] intValue];
- destinationRow = row;
+ // Add the new location
+ if ( destinationRow == 0 )
+ {
+ [queryString appendString:@" FIRST"];
+ }
+ else
+ {
+ [queryString appendString:[NSString stringWithFormat:@" AFTER `%@`",
+ [[tableFields objectAtIndex:destinationRow-1] objectForKey:@"Field"]]];
+ }
- if ( ![[[tableFields objectAtIndex:originalRow] objectForKey:@"Key"] isEqualToString:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Indexed fields cannot be moved!", @"message of panel when trying to move indexed field"));
- return NO;
- }
+ // Run the query; report any errors, or reload the table on success
+ [mySQLConnection queryString:queryString];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't move field. MySQL said: %@", @"message of panel when field cannot be added in drag&drop operation"), [mySQLConnection getLastErrorMessage]]);
+ }
+ else
+ {
+ [self loadTable:selectedTable];
+ if ( originalRow < destinationRow ) {
+ [tableSourceView selectRow:destinationRow-1 byExtendingSelection:NO];
+ } else {
+ [tableSourceView selectRow:destinationRow byExtendingSelection:NO];
+ }
+ }
-/*
-//alertSheet would be better...
-//try to fix problem of lost values
- if ( NSRunAlertPanel(@"Warning", [NSString stringWithFormat:@"All values for this field will be lost!\nField will be removed and a new field with the same options will be inserted at the desired position.\nThis is recommended only for empty columns!",
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"]],
- @"Don't Move", @"Move", nil)
- == NSAlertDefaultReturn ) {
- return NO;
- }
-*/
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
-//drop dragged column
- //query started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
- //find free column name
- while ( (field = [enumerator nextObject]) ) {
- [fieldNames addObject:[field objectForKey:@"Field"]];
- }
- i = 1;
- while ( [fieldNames containsObject:[NSString stringWithFormat:@"%@_temp%d",
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"], i]] ) {
- i++;
- }
- tempColName = [NSString stringWithFormat:@"%@_temp%d", [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"], i];
- //add new column with temp name at desired position
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"Length"] isEqualToString:@""] ||
- ![[tableFields objectAtIndex:originalRow] objectForKey:@"Length"] )
- {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` ADD `%@` %@",
- selectedTable,
- tempColName,
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Type"]];
- } else {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` ADD `%@` %@(%@)",
- selectedTable,
- tempColName,
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Type"],
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Length"]];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"unsigned"] intValue] == 1 ) {
- [queryString appendString:@" UNSIGNED"];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"zerofill"] intValue] == 1 ) {
- [queryString appendString:@" ZEROFILL"];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"binary"] intValue] == 1 ) {
- [queryString appendString:@" BINARY"];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"Null"] isEqualToString:@"NO"] )
- [queryString appendString:@" NOT NULL"];
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"Default"] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
- [queryString appendString:@" DEFAULT NULL "];
- } else {
-// [queryString appendString:[NSString stringWithFormat:@" DEFAULT \"%@\" ",
-// [[tableFields objectAtIndex:originalRow] objectForKey:@"Default"]]];
- [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@' ",
- [mySQLConnection prepareString:[[tableFields objectAtIndex:originalRow] objectForKey:@"Default"]]]];
- }
-/*
- if ( ![[[tableFields objectAtIndex:originalRow] objectForKey:@"Default"] isEqualToString:@""] )
- [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@'",
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Default"]]];
- [queryString appendString:@" "];
-*/
- if ( [[tableFields objectAtIndex:originalRow] objectForKey:@"Extra"] &&
- ![[[tableFields objectAtIndex:originalRow] objectForKey:@"Extra"] isEqualToString:@"None"] )
- [queryString appendString:[[tableFields objectAtIndex:originalRow] objectForKey:@"Extra"]];
- if ( destinationRow == 0 ) {
- [queryString appendString:@" FIRST"];
- } else {
- [queryString appendString:[NSString stringWithFormat:@" AFTER `%@`",
- [[tableFields objectAtIndex:destinationRow-1] objectForKey:@"Field"]]];
- }
- [mySQLConnection queryString:queryString];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't add field. MySQL said: %@", @"message of panel when field cannot be added in drag&drop operation"), [mySQLConnection getLastErrorMessage]]);
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
- return NO;
- }
- //copy field values from old to new column
- queryString = [NSString stringWithFormat:@"UPDATE `%@` SET `%@`=`%@`",
- selectedTable,
- tempColName,
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"]];
- [mySQLConnection queryString:queryString];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't copy field values. MySQL said: %@", @"message of panel when field content cannot be copied in drag&drop operation"), [mySQLConnection getLastErrorMessage]]);
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
- return NO;
- }
- //drop old column
- [mySQLConnection queryString:[NSString stringWithFormat:@"ALTER TABLE `%@` DROP `%@`",
- selectedTable, [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"]]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't remove field. MySQL said: %@", @"message of panel when old field cannot be removed in drag&drop operation"), [mySQLConnection getLastErrorMessage]]);
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
- return NO;
- }
- //rename column to original name
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"Length"] isEqualToString:@""] ||
- ![[tableFields objectAtIndex:originalRow] objectForKey:@"Length"] )
- {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` CHANGE `%@` `%@` %@",
- selectedTable,
- tempColName,
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"],
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Type"]];
- } else {
- queryString = [NSMutableString stringWithFormat:@"ALTER TABLE `%@` CHANGE `%@` `%@` %@(%@)",
- selectedTable,
- tempColName,
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Field"],
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Type"],
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Length"]];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"unsigned"] intValue] == 1 ) {
- [queryString appendString:@" UNSIGNED"];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"zerofill"] intValue] == 1 ) {
- [queryString appendString:@" ZEROFILL"];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"binary"] intValue] == 1 ) {
- [queryString appendString:@" BINARY"];
- }
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"Null"] isEqualToString:@"NO"] )
- [queryString appendString:@" NOT NULL"];
-/*
- if ( ![[[tableFields objectAtIndex:originalRow] objectForKey:@"Default"] isEqualToString:@""] )
- [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@'",
- [[tableFields objectAtIndex:originalRow] objectForKey:@"Default"]]];
- [queryString appendString:@" "];
-*/
- if ( [[[tableFields objectAtIndex:originalRow] objectForKey:@"Default"] isEqualToString:[prefs objectForKey:@"nullValue"]] ) {
- [queryString appendString:@" DEFAULT NULL "];
- } else {
-// [queryString appendString:[NSString stringWithFormat:@" DEFAULT \"%@\" ",
-// [[tableFields objectAtIndex:originalRow] objectForKey:@"Default"]]];
- [queryString appendString:[NSString stringWithFormat:@" DEFAULT '%@' ",
- [mySQLConnection prepareString:[[tableFields objectAtIndex:originalRow] objectForKey:@"Default"]]]];
-
- }
- if ( [[tableFields objectAtIndex:originalRow] objectForKey:@"Extra"] &&
- ![[[tableFields objectAtIndex:originalRow] objectForKey:@"Extra"] isEqualToString:@"None"] )
- [queryString appendString:[[tableFields objectAtIndex:originalRow] objectForKey:@"Extra"]];
- [mySQLConnection queryString:queryString];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't rename field. MySQL said: %@", @"message of panel when field cannot be renamed in drag&drop operation"), [mySQLConnection getLastErrorMessage]]);
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
- return NO;
- }
-
- [self loadTable:selectedTable];
- if ( originalRow < destinationRow ) {
- [tableSourceView selectRow:destinationRow-1 byExtendingSelection:NO];
- } else {
- [tableSourceView selectRow:destinationRow byExtendingSelection:NO];
- }
-
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
-
- return YES;
+ return YES;
}
//tableView delegate methods
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView
{
/*
- int row = [tableSourceView editedRow];
- int column = [tableSourceView editedColumn];
- NSTableColumn *tableColumn;
- NSCell *cell;
-
- if ( row != -1 ) {
- tableColumn = [[tableSourceView tableColumns] objectAtIndex:column];
- cell = [tableColumn dataCellForRow:row];
+ int row = [tableSourceView editedRow];
+ int column = [tableSourceView editedColumn];
+ NSTableColumn *tableColumn;
+ NSCell *cell;
+
+ if ( row != -1 ) {
+ tableColumn = [[tableSourceView tableColumns] objectAtIndex:column];
+ cell = [tableColumn dataCellForRow:row];
[cell endEditing:[tableSourceView currentEditor]];
- }
+ }
*/
//end editing (otherwise problems when user hits reload button)
- [tableWindow endEditingFor:nil];
+ [tableWindow endEditingFor:nil];
- return [self addRowToDB];
+ return [self addRowToDB];
}
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command
@@ -1046,57 +923,57 @@ returns a dictionary containing enum/set field names as key and possible values
traps enter and esc and make/cancel editing without entering next row
*/
{
- int row, column;
-
- row = [tableSourceView editedRow];
- column = [tableSourceView editedColumn];
-
- if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ||
- [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) //trap enter and tab
- {
- //save current line
- [[control window] makeFirstResponder:control];
- if ( column == 9 ) {
- if ( [self addRowToDB] && [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) {
- if ( row < ([tableSourceView numberOfRows] - 1) ) {
- [tableSourceView selectRow:row+1 byExtendingSelection:NO];
- [tableSourceView editColumn:0 row:row+1 withEvent:nil select:YES];
- } else {
- [tableSourceView selectRow:0 byExtendingSelection:NO];
- [tableSourceView editColumn:0 row:0 withEvent:nil select:YES];
- }
- }
- } else {
- if ( column == 2 ) {
- [tableSourceView editColumn:column+4 row:row withEvent:nil select:YES];
- } else if ( column == 6 ) {
- [tableSourceView editColumn:column+2 row:row withEvent:nil select:YES];
- } else {
- [tableSourceView editColumn:column+1 row:row withEvent:nil select:YES];
- }
- }
- return TRUE;
- }
- else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
+ int row, column;
+
+ row = [tableSourceView editedRow];
+ column = [tableSourceView editedColumn];
+
+ if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ||
+ [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) //trap enter and tab
+ {
+ //save current line
+ [[control window] makeFirstResponder:control];
+ if ( column == 9 ) {
+ if ( [self addRowToDB] && [textView methodForSelector:command] == [textView methodForSelector:@selector(insertTab:)] ) {
+ if ( row < ([tableSourceView numberOfRows] - 1) ) {
+ [tableSourceView selectRow:row+1 byExtendingSelection:NO];
+ [tableSourceView editColumn:0 row:row+1 withEvent:nil select:YES];
+ } else {
+ [tableSourceView selectRow:0 byExtendingSelection:NO];
+ [tableSourceView editColumn:0 row:0 withEvent:nil select:YES];
+ }
+ }
+ } else {
+ if ( column == 2 ) {
+ [tableSourceView editColumn:column+4 row:row withEvent:nil select:YES];
+ } else if ( column == 6 ) {
+ [tableSourceView editColumn:column+2 row:row withEvent:nil select:YES];
+ } else {
+ [tableSourceView editColumn:column+1 row:row withEvent:nil select:YES];
+ }
+ }
+ return TRUE;
+ }
+ else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
[textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] ) //trap esc
- {
- //abort editing
- [control abortEditing];
- if ( isEditingRow && !isEditingNewRow ) {
- isEditingRow = NO;
- [tableFields replaceObjectAtIndex:row withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
- } else if ( isEditingNewRow ) {
- isEditingRow = NO;
- isEditingNewRow = NO;
- [tableFields removeObjectAtIndex:row];
- [tableSourceView reloadData];
- }
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ {
+ //abort editing
+ [control abortEditing];
+ if ( isEditingRow && !isEditingNewRow ) {
+ isEditingRow = NO;
+ [tableFields replaceObjectAtIndex:row withObject:[NSMutableDictionary dictionaryWithDictionary:oldRow]];
+ } else if ( isEditingNewRow ) {
+ isEditingRow = NO;
+ isEditingNewRow = NO;
+ [tableFields removeObjectAtIndex:row];
+ [tableSourceView reloadData];
+ }
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
@@ -1106,7 +983,7 @@ traps enter and esc and make/cancel editing without entering next row
tells the splitView that it can collapse views
*/
{
- return YES;
+ return YES;
}
- (float)splitView:(NSSplitView *)sender constrainMaxCoordinate:(float)proposedMax ofSubviewAt:(int)offset
@@ -1114,7 +991,7 @@ tells the splitView that it can collapse views
defines max position of splitView
*/
{
- return proposedMax - 150;
+ return proposedMax - 150;
}
- (float)splitView:(NSSplitView *)sender constrainMinCoordinate:(float)proposedMin ofSubviewAt:(int)offset
@@ -1122,7 +999,7 @@ defines max position of splitView
defines min position of splitView
*/
{
- return proposedMin + 150;
+ return proposedMin + 150;
}
- (NSRect)splitView:(NSSplitView *)splitView additionalEffectiveRectOfDividerAtIndex:(int)dividerIndex
@@ -1133,28 +1010,28 @@ defines min position of splitView
//last but not least
- (id)init
{
- self = [super init];
+ self = [super init];
- tableFields = [[NSMutableArray alloc] init];
- indexes = [[NSMutableArray alloc] init];
- oldRow = [[NSMutableDictionary alloc] init];
- enumFields = [[NSMutableDictionary alloc] init];
+ tableFields = [[NSMutableArray alloc] init];
+ indexes = [[NSMutableArray alloc] init];
+ oldRow = [[NSMutableDictionary alloc] init];
+ enumFields = [[NSMutableDictionary alloc] init];
- return self;
+ return self;
}
- (void)dealloc
{
-// NSLog(@"TableSource dealloc");
-
- [tableFields release];
- [indexes release];
- [oldRow release];
- [defaultValues release];
- [prefs release];
+// NSLog(@"TableSource dealloc");
+
+ [tableFields release];
+ [indexes release];
+ [oldRow release];
+ [defaultValues release];
+ [prefs release];
[enumFields release];
-
- [super dealloc];
+
+ [super dealloc];
}
@end
diff --git a/TableStatus.h b/TableStatus.h
index 13442db2..cb631435 100644
--- a/TableStatus.h
+++ b/TableStatus.h
@@ -29,25 +29,25 @@
@interface TableStatus : NSObject
{
- IBOutlet id commentsBox;
- IBOutlet id rowsNumber;
- IBOutlet id rowsFormat;
- IBOutlet id rowsAvgLength;
- IBOutlet id rowsAutoIncrement;
- IBOutlet id sizeData;
- IBOutlet id sizeFree;
- IBOutlet id sizeIndex;
- IBOutlet id sizeMaxData;
- IBOutlet id tableCreatedAt;
- IBOutlet id tableName;
- IBOutlet id tableType;
- IBOutlet id tableUpdatedAt;
-
- CMMCPConnection *mySQLConnection;
- CMMCPResult *tableStatusResult;
-
- NSString *selectedTable;
- NSDictionary* statusFields;
+ IBOutlet id commentsBox;
+ IBOutlet id rowsNumber;
+ IBOutlet id rowsFormat;
+ IBOutlet id rowsAvgLength;
+ IBOutlet id rowsAutoIncrement;
+ IBOutlet id sizeData;
+ IBOutlet id sizeFree;
+ IBOutlet id sizeIndex;
+ IBOutlet id sizeMaxData;
+ IBOutlet id tableCreatedAt;
+ IBOutlet id tableName;
+ IBOutlet id tableType;
+ IBOutlet id tableUpdatedAt;
+
+ CMMCPConnection *mySQLConnection;
+ CMMCPResult *tableStatusResult;
+
+ NSString *selectedTable;
+ NSDictionary* statusFields;
}
// Table methods
diff --git a/TableStatus.m b/TableStatus.m
index f2ad1244..5bfd5513 100644
--- a/TableStatus.m
+++ b/TableStatus.m
@@ -4,38 +4,38 @@
- (void)awakeFromNib
{
- // TODO: implement awake code.
+ // TODO: implement awake code.
}
- (void)setConnection:(CMMCPConnection *)theConnection
{
- mySQLConnection = theConnection;
- [mySQLConnection retain];
+ mySQLConnection = theConnection;
+ [mySQLConnection retain];
}
- (NSString*)getSQLColumnValue:(NSString *)withName usingFields:(NSDictionary*)fields withLabel:(NSString*)label
{
- NSString* value = [fields objectForKey:withName];
- if([value isKindOfClass:[NSNull class]])
- {
+ NSString* value = [fields objectForKey:withName];
+ if([value isKindOfClass:[NSNull class]])
+ {
value = @"--";
- }
-
- NSString* labelVal = [NSString stringWithFormat:@"%@: %@",label,value];
-
- return labelVal;
+ }
+
+ NSString* labelVal = [NSString stringWithFormat:@"%@: %@",label,value];
+
+ return labelVal;
}
- (void)loadTable:(NSString *)aTable
{
- // Store the table name away for future use...
- selectedTable = aTable;
-
- // Notify any listeners that a query is about to begin...
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
-
- // no table selected
- if([aTable isEqualToString:@""] || !aTable) {
+ // Store the table name away for future use...
+ selectedTable = aTable;
+
+ // Notify any listeners that a query is about to begin...
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+
+ // no table selected
+ if([aTable isEqualToString:@""] || !aTable) {
[tableName setStringValue:@"Name: --"];
[tableType setStringValue:@"Type: --"];
[tableCreatedAt setStringValue:@"Created At: --"];
@@ -43,13 +43,13 @@
// Assign the row values...
[rowsNumber setStringValue:@"Number Of: --"];
- [rowsFormat setStringValue:@"Format: --"];
+ [rowsFormat setStringValue:@"Format: --"];
[rowsAvgLength setStringValue:@"Avg. Length: --"];
[rowsAutoIncrement setStringValue:@"Auto Increment: --"];
// Assign the size values...
[sizeData setStringValue:@"Data: --"];
- [sizeMaxData setStringValue:@"Max Data: --"];
+ [sizeMaxData setStringValue:@"Max Data: --"];
[sizeIndex setStringValue:@"Index: --"];
[sizeFree setStringValue:@"Free: --"];
@@ -58,56 +58,56 @@
// Tell everyone we've finished with our query...
[[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
- return;
- }
-
- // Run the query to retrieve the status of the selected table. We'll then use this information to populate
- // the associated view's controls.
- tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE '%@'", selectedTable]];
-
- statusFields = [tableStatusResult fetchRowAsDictionary];
-
- // Assign the table values...
- [tableName setStringValue:[NSString stringWithFormat:@"Name: %@",selectedTable]];
- if ( [statusFields objectForKey:@"Type"] ) {
- [tableType setStringValue:[self getSQLColumnValue:@"Type" usingFields:statusFields withLabel:@"Type"]];
- } else {
- // mysql > 4.1
- [tableType setStringValue:[self getSQLColumnValue:@"Engine" usingFields:statusFields withLabel:@"Type"]];
- }
- [tableCreatedAt setStringValue:[self getSQLColumnValue:@"Create_time" usingFields:statusFields withLabel:@"Created At"]];
- [tableUpdatedAt setStringValue:[self getSQLColumnValue:@"Update_time" usingFields:statusFields withLabel:@"Updated At"]];
-
- // Assign the row values...
- [rowsNumber setStringValue:[self getSQLColumnValue:@"Rows" usingFields:statusFields withLabel:@"Number Of"]];
- [rowsFormat setStringValue:[self getSQLColumnValue:@"Row_format" usingFields:statusFields withLabel:@"Format"]];
- [rowsAvgLength setStringValue:[self getSQLColumnValue:@"Avg_row_length" usingFields:statusFields withLabel:@"Avg. Length"]];
- [rowsAutoIncrement setStringValue:[self getSQLColumnValue:@"Auto_increment" usingFields:statusFields withLabel:@"Auto Increment"]];
+ return;
+ }
+
+ // Run the query to retrieve the status of the selected table. We'll then use this information to populate
+ // the associated view's controls.
+ tableStatusResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW TABLE STATUS LIKE '%@'", selectedTable]];
+
+ statusFields = [tableStatusResult fetchRowAsDictionary];
+
+ // Assign the table values...
+ [tableName setStringValue:[NSString stringWithFormat:@"Name: %@",selectedTable]];
+ if ( [statusFields objectForKey:@"Type"] ) {
+ [tableType setStringValue:[self getSQLColumnValue:@"Type" usingFields:statusFields withLabel:@"Type"]];
+ } else {
+ // mysql > 4.1
+ [tableType setStringValue:[self getSQLColumnValue:@"Engine" usingFields:statusFields withLabel:@"Type"]];
+ }
+ [tableCreatedAt setStringValue:[self getSQLColumnValue:@"Create_time" usingFields:statusFields withLabel:@"Created At"]];
+ [tableUpdatedAt setStringValue:[self getSQLColumnValue:@"Update_time" usingFields:statusFields withLabel:@"Updated At"]];
+
+ // Assign the row values...
+ [rowsNumber setStringValue:[self getSQLColumnValue:@"Rows" usingFields:statusFields withLabel:@"Number Of"]];
+ [rowsFormat setStringValue:[self getSQLColumnValue:@"Row_format" usingFields:statusFields withLabel:@"Format"]];
+ [rowsAvgLength setStringValue:[self getSQLColumnValue:@"Avg_row_length" usingFields:statusFields withLabel:@"Avg. Length"]];
+ [rowsAutoIncrement setStringValue:[self getSQLColumnValue:@"Auto_increment" usingFields:statusFields withLabel:@"Auto Increment"]];
- // Assign the size values...
- [sizeData setStringValue:[self getSQLColumnValue:@"Data_length" usingFields:statusFields withLabel:@"Data"]];
- [sizeMaxData setStringValue:[self getSQLColumnValue:@"Max_data_length" usingFields:statusFields withLabel:@"Max Data"]];
- [sizeIndex setStringValue:[self getSQLColumnValue:@"Index_length" usingFields:statusFields withLabel:@"Index"]];
- [sizeFree setStringValue:[self getSQLColumnValue:@"Data_free" usingFields:statusFields withLabel:@"Free"]];
-
- // Finally, assign the comments...
- [commentsBox setStringValue:[statusFields objectForKey:@"Comment"]];
-
- // Tell everyone we've finished with our query...
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
-
- return;
+ // Assign the size values...
+ [sizeData setStringValue:[self getSQLColumnValue:@"Data_length" usingFields:statusFields withLabel:@"Data"]];
+ [sizeMaxData setStringValue:[self getSQLColumnValue:@"Max_data_length" usingFields:statusFields withLabel:@"Max Data"]];
+ [sizeIndex setStringValue:[self getSQLColumnValue:@"Index_length" usingFields:statusFields withLabel:@"Index"]];
+ [sizeFree setStringValue:[self getSQLColumnValue:@"Data_free" usingFields:statusFields withLabel:@"Free"]];
+
+ // Finally, assign the comments...
+ [commentsBox setStringValue:[statusFields objectForKey:@"Comment"]];
+
+ // Tell everyone we've finished with our query...
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+
+ return;
}
- (IBAction)reloadTable:(id)sender
{
- [self loadTable:selectedTable];
+ [self loadTable:selectedTable];
}
- (id)init
{
- self = [super init];
-
- return self;
+ self = [super init];
+
+ return self;
}
@end
diff --git a/TablesList.h b/TablesList.h
index 2641bd86..9a59de88 100644
--- a/TablesList.h
+++ b/TablesList.h
@@ -30,24 +30,24 @@
@interface TablesList : NSObject {
- IBOutlet id tableDocumentInstance;
- IBOutlet id tableSourceInstance;
- IBOutlet id tableContentInstance;
- IBOutlet id customQueryInstance;
- IBOutlet id tableDumpInstance;
- IBOutlet id tableStatusInstance;
+ IBOutlet id tableDocumentInstance;
+ IBOutlet id tableSourceInstance;
+ IBOutlet id tableContentInstance;
+ IBOutlet id customQueryInstance;
+ IBOutlet id tableDumpInstance;
+ IBOutlet id tableStatusInstance;
- IBOutlet id tableWindow;
- IBOutlet id copyTableSheet;
- IBOutlet id tablesListView;
- IBOutlet id copyTableNameField;
- IBOutlet id copyTableContentSwitch;
- IBOutlet id tabView;
+ IBOutlet id tableWindow;
+ IBOutlet id copyTableSheet;
+ IBOutlet id tablesListView;
+ IBOutlet id copyTableNameField;
+ IBOutlet id copyTableContentSwitch;
+ IBOutlet id tabView;
- CMMCPConnection *mySQLConnection;
- NSMutableArray *tables;
-// NSUserDefaults *prefs;
- BOOL structureLoaded, contentLoaded, statusLoaded, alertSheetOpened;
+ CMMCPConnection *mySQLConnection;
+ NSMutableArray *tables;
+// NSUserDefaults *prefs;
+ BOOL structureLoaded, contentLoaded, statusLoaded, alertSheetOpened;
}
//IBAction methods
@@ -76,12 +76,12 @@
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex;
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex;
//tableView delegate methods
- (BOOL)control:(NSControl *)control textView:(NSTextView *)textView doCommandBySelector:(SEL)command;
diff --git a/TablesList.m b/TablesList.m
index 19b9362f..ee958d1d 100644
--- a/TablesList.m
+++ b/TablesList.m
@@ -37,26 +37,26 @@
loads all table names in array tables and reload the tableView
*/
{
- CMMCPResult *theResult;
- int i;
+ CMMCPResult *theResult;
+ int i;
- //query started
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
+ //query started
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryWillBePerformed" object:self];
- [tablesListView deselectAll:self];
- [tables removeAllObjects];
+ [tablesListView deselectAll:self];
+ [tables removeAllObjects];
[tables addObject:@"TABLES"];
- theResult = [mySQLConnection listTables];
- for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
- [theResult dataSeek:i];
- [tables addObject:[[theResult fetchRowAsArray] objectAtIndex:0]];
- }
+ theResult = [mySQLConnection listTables];
+ for ( i = 0 ; i < [theResult numOfRows] ; i++ ) {
+ [theResult dataSeek:i];
+ [tables addObject:[[theResult fetchRowAsArray] objectAtIndex:0]];
+ }
+
+ [tablesListView reloadData];
- [tablesListView reloadData];
-
- //query finished
- [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
+ //query finished
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"SMySQLQueryHasBeenPerformed" object:self];
}
- (IBAction)addTable:(id)sender
@@ -64,16 +64,16 @@ loads all table names in array tables and reload the tableView
adds a new table to the tables-array (no changes in mysql-db)
*/
{
- if ( ![tableSourceInstance selectionShouldChangeInTableView:nil] ||
- ![tableContentInstance selectionShouldChangeInTableView:nil] ||
- ![tableDocumentInstance database] )
- return;
- [tableWindow endEditingFor:nil];
-
- [tables addObject:@""];
- [tablesListView reloadData];
- [tablesListView selectRow:[tables count]-1 byExtendingSelection:NO];
- [tablesListView editColumn:0 row:[tables count]-1 withEvent:nil select:YES];
+ if ( ![tableSourceInstance selectionShouldChangeInTableView:nil] ||
+ ![tableContentInstance selectionShouldChangeInTableView:nil] ||
+ ![tableDocumentInstance database] )
+ return;
+ [tableWindow endEditingFor:nil];
+
+ [tables addObject:@""];
+ [tablesListView reloadData];
+ [tablesListView selectRow:[tables count]-1 byExtendingSelection:NO];
+ [tablesListView editColumn:0 row:[tables count]-1 withEvent:nil select:YES];
}
- (IBAction)removeTable:(id)sender
@@ -82,11 +82,11 @@ invoked when user hits the remove button
alert sheet to ask user if he really wants to delete the table
*/
{
- if ( ![tablesListView numberOfSelectedRows] )
- return;
- [tableWindow endEditingFor:nil];
+ if ( ![tablesListView numberOfSelectedRows] )
+ return;
+ [tableWindow endEditingFor:nil];
- if ( [tablesListView numberOfSelectedRows] == 1 ) {
+ if ( [tablesListView numberOfSelectedRows] == 1 ) {
NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"Delete", @"delete button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self,
@selector(sheetDidEnd:returnCode:contextInfo:), nil,
@"removeRow", [NSString stringWithFormat:NSLocalizedString(@"Do you really want to delete the table %@?", @"message of panel asking for confirmation for deleting table"),
@@ -104,126 +104,126 @@ alert sheet to ask user if he really wants to delete the table
copies a table, if desired with content
*/
{
- CMMCPResult *queryResult;
- NSScanner *scanner = [NSScanner alloc];
- NSString *scanString;
-// NSArray *fieldNames;
-// NSArray *theRow;
-// NSMutableString *rowValue = [NSMutableString string];
-// NSMutableArray *fieldValues;
- int code;
-// int rowCount, i, j;
-// BOOL errors = NO;
-
- if ( [tablesListView numberOfSelectedRows] != 1 )
- return;
- if ( ![tableSourceInstance selectionShouldChangeInTableView:nil] || ![tableContentInstance selectionShouldChangeInTableView:nil] )
- return;
- [tableWindow endEditingFor:nil];
+ CMMCPResult *queryResult;
+ NSScanner *scanner = [NSScanner alloc];
+ NSString *scanString;
+// NSArray *fieldNames;
+// NSArray *theRow;
+// NSMutableString *rowValue = [NSMutableString string];
+// NSMutableArray *fieldValues;
+ int code;
+// int rowCount, i, j;
+// BOOL errors = NO;
+
+ if ( [tablesListView numberOfSelectedRows] != 1 )
+ return;
+ if ( ![tableSourceInstance selectionShouldChangeInTableView:nil] || ![tableContentInstance selectionShouldChangeInTableView:nil] )
+ return;
+ [tableWindow endEditingFor:nil];
//open copyTableSheet
- [copyTableNameField setStringValue:[NSString stringWithFormat:@"%@Copy", [tables objectAtIndex:[tablesListView selectedRow]]]];
- [copyTableContentSwitch setState:NSOffState];
- [NSApp beginSheet:copyTableSheet
- modalForWindow:tableWindow modalDelegate:self
- didEndSelector:nil contextInfo:nil];
- code = [NSApp runModalForWindow:copyTableSheet];
-
- [NSApp endSheet:copyTableSheet];
- [copyTableSheet orderOut:nil];
-
- if ( !code )
- return;
- if ( [[copyTableNameField stringValue] isEqualToString:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));
- return;
- }
+ [copyTableNameField setStringValue:[NSString stringWithFormat:@"%@Copy", [tables objectAtIndex:[tablesListView selectedRow]]]];
+ [copyTableContentSwitch setState:NSOffState];
+ [NSApp beginSheet:copyTableSheet
+ modalForWindow:tableWindow modalDelegate:self
+ didEndSelector:nil contextInfo:nil];
+ code = [NSApp runModalForWindow:copyTableSheet];
+
+ [NSApp endSheet:copyTableSheet];
+ [copyTableSheet orderOut:nil];
+
+ if ( !code )
+ return;
+ if ( [[copyTableNameField stringValue] isEqualToString:@""] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));
+ return;
+ }
//get table structure
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE TABLE `%@`",
- [tables objectAtIndex:[tablesListView selectedRow]]]];
- if ( ![queryResult numOfRows] ) {
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SHOW CREATE TABLE `%@`",
+ [tables objectAtIndex:[tablesListView selectedRow]]]];
+ if ( ![queryResult numOfRows] ) {
//error while getting table structure
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't get table information.\nMySQL said: %@", @"message of panel when table information cannot be retrieved"), [mySQLConnection getLastErrorMessage]]);
- } else {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't get table information.\nMySQL said: %@", @"message of panel when table information cannot be retrieved"), [mySQLConnection getLastErrorMessage]]);
+ } else {
//insert new table name in create syntax and create new table
- [scanner initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
- [scanner scanUpToString:@"(" intoString:nil];
- [scanner scanUpToString:@"" intoString:&scanString];
- [mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE `%@` %@", [copyTableNameField stringValue], scanString]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ [scanner initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
+ [scanner scanUpToString:@"(" intoString:nil];
+ [scanner scanUpToString:@"" intoString:&scanString];
+ [mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE `%@` %@", [copyTableNameField stringValue], scanString]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
//error while creating new table
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't create table.\nMySQL said: %@", @"message of panel when table cannot be created"), [mySQLConnection getLastErrorMessage]]);
- } else {
- if ( [copyTableContentSwitch state] == NSOnState ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't create table.\nMySQL said: %@", @"message of panel when table cannot be created"), [mySQLConnection getLastErrorMessage]]);
+ } else {
+ if ( [copyTableContentSwitch state] == NSOnState ) {
//copy table content
/*
- queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@`",
- [tables objectAtIndex:[tablesListView selectedRow]]]];
- fieldNames = [queryResult fetchFieldNames];
- rowCount = [queryResult numOfRows];
- for ( i = 0 ; i < rowCount ; i++ ) {
- [queryResult dataSeek:i];
- theRow = [queryResult fetchRowAsArray];
- fieldValues = [NSMutableArray array];
- for ( j = 0 ; j < [theRow count] ; j++ ) {
- if ( [[theRow objectAtIndex:j] isKindOfClass:[NSData class]] ) {
-// [rowValue setString:[[NSString alloc] initWithData:[theRow objectAtIndex:j]
-// encoding:[mySQLConnection encoding]]];
- [rowValue setString:[mySQLConnection prepareBinaryData:[theRow objectAtIndex:j]]];
- } else {
- [rowValue setString:[mySQLConnection prepareString:[[theRow objectAtIndex:j] description]]];
- }
+ queryResult = [mySQLConnection queryString:[NSString stringWithFormat:@"SELECT * FROM `%@`",
+ [tables objectAtIndex:[tablesListView selectedRow]]]];
+ fieldNames = [queryResult fetchFieldNames];
+ rowCount = [queryResult numOfRows];
+ for ( i = 0 ; i < rowCount ; i++ ) {
+ [queryResult dataSeek:i];
+ theRow = [queryResult fetchRowAsArray];
+ fieldValues = [NSMutableArray array];
+ for ( j = 0 ; j < [theRow count] ; j++ ) {
+ if ( [[theRow objectAtIndex:j] isKindOfClass:[NSData class]] ) {
+// [rowValue setString:[[NSString alloc] initWithData:[theRow objectAtIndex:j]
+// encoding:[mySQLConnection encoding]]];
+ [rowValue setString:[mySQLConnection prepareBinaryData:[theRow objectAtIndex:j]]];
+ } else {
+ [rowValue setString:[mySQLConnection prepareString:[[theRow objectAtIndex:j] description]]];
+ }
*/
/*
- //escape special characters
- for ( u = 0 ; u < [rowValue length] ; u++ ) {
- if ( [rowValue characterAtIndex:u] == '\\' ) {
- [rowValue insertString:@"\\" atIndex:u];
- u++;
- } else if ( [rowValue characterAtIndex:u] == '"' ) {
- [rowValue insertString:@"\\" atIndex:u];
- u++;
- }
- }
+ //escape special characters
+ for ( u = 0 ; u < [rowValue length] ; u++ ) {
+ if ( [rowValue characterAtIndex:u] == '\\' ) {
+ [rowValue insertString:@"\\" atIndex:u];
+ u++;
+ } else if ( [rowValue characterAtIndex:u] == '"' ) {
+ [rowValue insertString:@"\\" atIndex:u];
+ u++;
+ }
+ }
*/
/*
- if ( [[theRow objectAtIndex:j] isKindOfClass:[NSNull class]] ) {
- [fieldValues addObject:@"NULL"];
- } else {
-// [fieldValues addObject:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareString:rowValue]]];
-// [fieldValues addObject:[NSString stringWithFormat:@"\"%@\"", rowValue]];
-// [fieldValues addObject:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:rowValue]]];
- [fieldValues addObject:[NSString stringWithFormat:@"'%@'", rowValue]];
-
- }
- }
- [mySQLConnection queryString:[NSString stringWithFormat:@"INSERT INTO `%@` (`%@`) VALUES (%@)",
- [copyTableNameField stringValue], [fieldNames componentsJoinedByString:@"`,`"],
- [fieldValues componentsJoinedByString:@","]]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- errors = YES;
- }
- }
- if ( errors )
- NSBeginAlertSheet(@"Warning", @"OK", nil, nil, tableWindow, self, nil, nil, nil,
- @"There have been errors while copying table content. Please control the new table.");
+ if ( [[theRow objectAtIndex:j] isKindOfClass:[NSNull class]] ) {
+ [fieldValues addObject:@"NULL"];
+ } else {
+// [fieldValues addObject:[NSString stringWithFormat:@"\"%@\"", [mySQLConnection prepareString:rowValue]]];
+// [fieldValues addObject:[NSString stringWithFormat:@"\"%@\"", rowValue]];
+// [fieldValues addObject:[NSString stringWithFormat:@"'%@'", [mySQLConnection prepareString:rowValue]]];
+ [fieldValues addObject:[NSString stringWithFormat:@"'%@'", rowValue]];
+
+ }
+ }
+ [mySQLConnection queryString:[NSString stringWithFormat:@"INSERT INTO `%@` (`%@`) VALUES (%@)",
+ [copyTableNameField stringValue], [fieldNames componentsJoinedByString:@"`,`"],
+ [fieldValues componentsJoinedByString:@","]]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ errors = YES;
+ }
+ }
+ if ( errors )
+ NSBeginAlertSheet(@"Warning", @"OK", nil, nil, tableWindow, self, nil, nil, nil,
+ @"There have been errors while copying table content. Please control the new table.");
*/
- [mySQLConnection queryString:[NSString stringWithFormat:@"INSERT INTO `%@` SELECT * FROM `%@`",
- [copyTableNameField stringValue], [tables objectAtIndex:[tablesListView selectedRow]]]];
- if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
- NSLocalizedString(@"There have been errors while copying table content. Please control the new table.", @"message of panel when table content cannot be copied"));
- }
- }
- [tables insertObject:[copyTableNameField stringValue] atIndex:[tablesListView selectedRow]+1];
- [tablesListView reloadData];
- [tablesListView selectRow:[tablesListView selectedRow]+1 byExtendingSelection:NO];
- [tablesListView scrollRowToVisible:[tablesListView selectedRow]];
- }
- }
+ [mySQLConnection queryString:[NSString stringWithFormat:@"INSERT INTO `%@` SELECT * FROM `%@`",
+ [copyTableNameField stringValue], [tables objectAtIndex:[tablesListView selectedRow]]]];
+ if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ NSLocalizedString(@"There have been errors while copying table content. Please control the new table.", @"message of panel when table content cannot be copied"));
+ }
+ }
+ [tables insertObject:[copyTableNameField stringValue] atIndex:[tablesListView selectedRow]+1];
+ [tablesListView reloadData];
+ [tablesListView selectRow:[tablesListView selectedRow]+1 byExtendingSelection:NO];
+ [tablesListView scrollRowToVisible:[tablesListView selectedRow]];
+ }
+ }
}
@@ -234,14 +234,14 @@ method for alert sheets
invoked when user wants to delete a table
*/
{
- if ( [contextInfo isEqualToString:@"addRow"] ) {
- alertSheetOpened = NO;
- } else if ( [contextInfo isEqualToString:@"removeRow"] ) {
- if ( returnCode == NSAlertDefaultReturn ) {
- [sheet orderOut:self];
- [self removeTable];
- }
- }
+ if ( [contextInfo isEqualToString:@"addRow"] ) {
+ alertSheetOpened = NO;
+ } else if ( [contextInfo isEqualToString:@"removeRow"] ) {
+ if ( returnCode == NSAlertDefaultReturn ) {
+ [sheet orderOut:self];
+ [self removeTable];
+ }
+ }
}
//copyTableSheet methods
@@ -250,7 +250,7 @@ invoked when user wants to delete a table
closes copyTableSheet and stops modal session
*/
{
- [NSApp stopModalWithCode:[sender tag]];
+ [NSApp stopModalWithCode:[sender tag]];
}
//additional methods
@@ -263,9 +263,9 @@ removes selected table(s) from mysql-db and tableView
NSString *errorText;
BOOL error = FALSE;
// get last index
- unsigned currentIndex = [indexes lastIndex];
- while (currentIndex != NSNotFound)
- {
+ unsigned currentIndex = [indexes lastIndex];
+ while (currentIndex != NSNotFound)
+ {
[mySQLConnection queryString:[NSString stringWithFormat:@"DROP TABLE `%@`", [tables objectAtIndex:currentIndex]]];
if ( [[mySQLConnection getLastErrorMessage] isEqualTo:@""] ) {
@@ -277,8 +277,8 @@ removes selected table(s) from mysql-db and tableView
errorText = [mySQLConnection getLastErrorMessage];
}
// get next index (beginning from the end)
- currentIndex = [indexes indexLessThanIndex:currentIndex];
- }
+ currentIndex = [indexes indexLessThanIndex:currentIndex];
+ }
[tablesListView deselectAll:self];
// [tableSourceInstance loadTable:nil];
// [tableContentInstance loadTable:nil];
@@ -297,20 +297,20 @@ removes selected table(s) from mysql-db and tableView
sets the connection (received from TableDocument) and makes things that have to be done only once
*/
{
- mySQLConnection = theConnection;
+ mySQLConnection = theConnection;
-// prefs = [[NSUserDefaults standardUserDefaults] retain];
+// prefs = [[NSUserDefaults standardUserDefaults] retain];
//set smallSystemFonts
-// [[[tablesListView tableColumnWithIdentifier:@"tables"] dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
-// [copyTableNameField setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
-// if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
- if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"useMonospacedFonts"] ) {
- [[[tablesListView tableColumnWithIdentifier:@"tables"] dataCell]
- setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
- }
-
- [self updateTables:self];
+// [[[tablesListView tableColumnWithIdentifier:@"tables"] dataCell] setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+// [copyTableNameField setFont:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]]];
+// if ( [prefs boolForKey:@"useMonospacedFonts"] ) {
+ if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"useMonospacedFonts"] ) {
+ [[[tablesListView tableColumnWithIdentifier:@"tables"] dataCell]
+ setFont:[NSFont fontWithName:@"Monaco" size:[NSFont smallSystemFontSize]]];
+ }
+
+ [self updateTables:self];
}
- (void)doPerformQueryService:(NSString *)query
@@ -318,8 +318,8 @@ sets the connection (received from TableDocument) and makes things that have to
selects customQuery tab and passes query to customQueryInstance
*/
{
- [tabView selectTabViewItemAtIndex:2];
- [customQueryInstance doPerformQueryService:query];
+ [tabView selectTabViewItemAtIndex:2];
+ [customQueryInstance doPerformQueryService:query];
}
@@ -329,11 +329,11 @@ selects customQuery tab and passes query to customQueryInstance
returns the currently selected table or nil if no table or mulitple tables are selected
*/
{
- if ( [tablesListView numberOfSelectedRows] == 1 ) {
- return [tables objectAtIndex:[tablesListView selectedRow]];
- } else if ([tablesListView numberOfSelectedRows] > 1) {
- return @"";
- } else {
+ if ( [tablesListView numberOfSelectedRows] == 1 ) {
+ return [tables objectAtIndex:[tablesListView selectedRow]];
+ } else if ([tablesListView numberOfSelectedRows] > 1) {
+ return @"";
+ } else {
return nil;
}
}
@@ -343,7 +343,7 @@ returns the currently selected table or nil if no table or mulitple tables are s
returns YES if table source has already been loaded
*/
{
- return structureLoaded;
+ return structureLoaded;
}
- (BOOL)contentLoaded
@@ -351,7 +351,7 @@ returns YES if table source has already been loaded
returns YES if table content has already been loaded
*/
{
- return contentLoaded;
+ return contentLoaded;
}
- (BOOL)statusLoaded
@@ -359,19 +359,19 @@ returns YES if table content has already been loaded
returns YES if table status has already been loaded
*/
{
- return statusLoaded;
+ return statusLoaded;
}
//tableView datasource methods
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- return [tables count];
+ return [tables count];
}
- (id)tableView:(NSTableView *)aTableView
- objectValueForTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ objectValueForTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
return [tables objectAtIndex:rowIndex];
}
@@ -381,116 +381,116 @@ returns YES if table status has already been loaded
* removes new table from table-array if renaming had no success
*/
- (void)tableView:(NSTableView *)aTableView
- setObjectValue:(id)anObject
- forTableColumn:(NSTableColumn *)aTableColumn
- row:(int)rowIndex
+ setObjectValue:(id)anObject
+ forTableColumn:(NSTableColumn *)aTableColumn
+ row:(int)rowIndex
{
if ( [[tables objectAtIndex:rowIndex] isEqualToString:@""] ) {
- //new table
- if ( [anObject isEqualToString:@""] ) {
- //table has no name
- alertSheetOpened = YES;
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
- @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));
- [tables removeObjectAtIndex:rowIndex];
- [tablesListView reloadData];
- } else {
+ //new table
+ if ( [anObject isEqualToString:@""] ) {
+ //table has no name
+ alertSheetOpened = YES;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
+ @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));
+ [tables removeObjectAtIndex:rowIndex];
+ [tablesListView reloadData];
+ } else {
if ( [tableDocumentInstance supportsEncoding] ) {
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE `%@` (id int) DEFAULT CHARACTER SET %@", anObject, [tableDocumentInstance encoding]]];
- } else {
+ } else {
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE `%@` (id int)", anObject]];
}
if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- //added table with success
- // NSLog(@"added new table with success");
- [tables replaceObjectAtIndex:rowIndex withObject:anObject];
- if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
- [tableSourceInstance loadTable:anObject];
- structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
- [tableSourceInstance loadTable:anObject];
- [tableContentInstance loadTable:anObject];
- structureLoaded = YES;
- contentLoaded = YES;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
- [tableStatusInstance loadTable:anObject];
- statusLoaded = YES;
- structureLoaded = NO;
- contentLoaded = NO;
- } else {
- statusLoaded = NO;
- structureLoaded = NO;
- contentLoaded = NO;
- }
+ //added table with success
+ // NSLog(@"added new table with success");
+ [tables replaceObjectAtIndex:rowIndex withObject:anObject];
+ if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
+ [tableSourceInstance loadTable:anObject];
+ structureLoaded = YES;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
+ [tableSourceInstance loadTable:anObject];
+ [tableContentInstance loadTable:anObject];
+ structureLoaded = YES;
+ contentLoaded = YES;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
+ [tableStatusInstance loadTable:anObject];
+ statusLoaded = YES;
+ structureLoaded = NO;
+ contentLoaded = NO;
+ } else {
+ statusLoaded = NO;
+ structureLoaded = NO;
+ contentLoaded = NO;
+ }
// set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user],
- [tableDocumentInstance host], [tableDocumentInstance database], anObject]];
- } else {
- //error while adding new table
- // NSLog(@"couldn't add new table");
- alertSheetOpened = YES;
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
- @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow",
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't add table %@.\nMySQL said: %@", @"message of panel when table cannot be created with the given name"),
- anObject, [mySQLConnection getLastErrorMessage]]);
- [tables removeObjectAtIndex:rowIndex];
- [tablesListView reloadData];
- }
- }
+ [tableDocumentInstance host], [tableDocumentInstance database], anObject]];
+ } else {
+ //error while adding new table
+ // NSLog(@"couldn't add new table");
+ alertSheetOpened = YES;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
+ @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow",
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't add table %@.\nMySQL said: %@", @"message of panel when table cannot be created with the given name"),
+ anObject, [mySQLConnection getLastErrorMessage]]);
+ [tables removeObjectAtIndex:rowIndex];
+ [tablesListView reloadData];
+ }
+ }
} else {
- //table modification
- if ( [[tables objectAtIndex:rowIndex] isEqualToString:anObject] ) {
- //no changes in table name
- // NSLog(@"no changes in table name");
- } else if ( [anObject isEqualToString:@""] ) {
- //table has no name
- // NSLog(@"name is nil");
- alertSheetOpened = YES;
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
- @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));
- } else {
- [mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE `%@` TO `%@`", [tables objectAtIndex:rowIndex], anObject]];
- if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- // NSLog(@"renamed table with success");
- //renamed with success
- [tables replaceObjectAtIndex:rowIndex withObject:anObject];
- if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
- [tableSourceInstance loadTable:anObject];
- structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
- [tableSourceInstance loadTable:anObject];
- [tableContentInstance loadTable:anObject];
- structureLoaded = YES;
- contentLoaded = YES;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
- [tableStatusInstance loadTable:anObject];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = YES;
- } else {
- statusLoaded = NO;
- structureLoaded = NO;
- contentLoaded = NO;
- }
+ //table modification
+ if ( [[tables objectAtIndex:rowIndex] isEqualToString:anObject] ) {
+ //no changes in table name
+ // NSLog(@"no changes in table name");
+ } else if ( [anObject isEqualToString:@""] ) {
+ //table has no name
+ // NSLog(@"name is nil");
+ alertSheetOpened = YES;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
+ @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow", NSLocalizedString(@"Table must have a name.", @"message of panel when no name is given for table"));
+ } else {
+ [mySQLConnection queryString:[NSString stringWithFormat:@"RENAME TABLE `%@` TO `%@`", [tables objectAtIndex:rowIndex], anObject]];
+ if ( [[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
+ // NSLog(@"renamed table with success");
+ //renamed with success
+ [tables replaceObjectAtIndex:rowIndex withObject:anObject];
+ if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
+ [tableSourceInstance loadTable:anObject];
+ structureLoaded = YES;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
+ [tableSourceInstance loadTable:anObject];
+ [tableContentInstance loadTable:anObject];
+ structureLoaded = YES;
+ contentLoaded = YES;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
+ [tableStatusInstance loadTable:anObject];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = YES;
+ } else {
+ statusLoaded = NO;
+ structureLoaded = NO;
+ contentLoaded = NO;
+ }
// set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user],
- [tableDocumentInstance host], [tableDocumentInstance database], anObject]];
- } else {
- //error while renaming
- // NSLog(@"couldn't rename table");
- alertSheetOpened = YES;
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
- @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow",
- [NSString stringWithFormat:NSLocalizedString(@"Couldn't rename table.\nMySQL said: %@", @"message of panel when table cannot be renamed"),
- [mySQLConnection getLastErrorMessage]]);
- }
- }
+ [tableDocumentInstance host], [tableDocumentInstance database], anObject]];
+ } else {
+ //error while renaming
+ // NSLog(@"couldn't rename table");
+ alertSheetOpened = YES;
+ NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self,
+ @selector(sheetDidEnd:returnCode:contextInfo:), nil, @"addRow",
+ [NSString stringWithFormat:NSLocalizedString(@"Couldn't rename table.\nMySQL said: %@", @"message of panel when table cannot be renamed"),
+ [mySQLConnection getLastErrorMessage]]);
+ }
+ }
}
}
@@ -500,58 +500,58 @@ returns YES if table status has already been loaded
traps enter and esc and edit/cancel without entering next row
*/
{
- if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ) //trap enter
- {
- //save current line
- [[control window] makeFirstResponder:control];
- return TRUE;
- }
- else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
+ if ( [textView methodForSelector:command] == [textView methodForSelector:@selector(insertNewline:)] ) //trap enter
+ {
+ //save current line
+ [[control window] makeFirstResponder:control];
+ return TRUE;
+ }
+ else if ( [[control window] methodForSelector:command] == [[control window] methodForSelector:@selector(_cancelKey:)] ||
[textView methodForSelector:command] == [textView methodForSelector:@selector(complete:)] ) //trap esc
- {
- //abort editing
- [control abortEditing];
- if ( [[tables objectAtIndex:[tablesListView selectedRow]] isEqualToString:@""] ) {
- //user added new table and then pressed escape
- [tables removeObjectAtIndex:[tablesListView selectedRow]];
- [tablesListView reloadData];
- }
- return TRUE;
- }
- else
- {
- return FALSE;
- }
+ {
+ //abort editing
+ [control abortEditing];
+ if ( [[tables objectAtIndex:[tablesListView selectedRow]] isEqualToString:@""] ) {
+ //user added new table and then pressed escape
+ [tables removeObjectAtIndex:[tablesListView selectedRow]];
+ [tablesListView reloadData];
+ }
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
- (BOOL)selectionShouldChangeInTableView:(NSTableView *)aTableView
{
/*
- int row = [tablesListView editedRow];
- int column = [tablesListView editedColumn];
- NSTableColumn *tableColumn;
- NSCell *cell;
-
- if ( row != -1 ) {
- tableColumn = [[tablesListView tableColumns] objectAtIndex:column];
- cell = [tableColumn dataCellForRow:row];
+ int row = [tablesListView editedRow];
+ int column = [tablesListView editedColumn];
+ NSTableColumn *tableColumn;
+ NSCell *cell;
+
+ if ( row != -1 ) {
+ tableColumn = [[tablesListView tableColumns] objectAtIndex:column];
+ cell = [tableColumn dataCellForRow:row];
[cell endEditing:[tablesListView currentEditor]];
- }
+ }
*/
//end editing (otherwise problems when user hits reload button)
- [tableWindow endEditingFor:nil];
- if ( alertSheetOpened ) {
- return NO;
- }
+ [tableWindow endEditingFor:nil];
+ if ( alertSheetOpened ) {
+ return NO;
+ }
//we have to be sure that TableSource and TableContent have finished editing
-// if ( ![tableSourceInstance addRowToDB] || ![tableContentInstance addRowToDB] ) {
- if ( ![tableSourceInstance selectionShouldChangeInTableView:nil] ||
- ![tableContentInstance selectionShouldChangeInTableView:nil] ) {
- return NO;
- } else {
- return YES;
- }
+// if ( ![tableSourceInstance addRowToDB] || ![tableContentInstance addRowToDB] ) {
+ if ( ![tableSourceInstance selectionShouldChangeInTableView:nil] ||
+ ![tableContentInstance selectionShouldChangeInTableView:nil] ) {
+ return NO;
+ } else {
+ return YES;
+ }
}
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
@@ -559,43 +559,43 @@ traps enter and esc and edit/cancel without entering next row
loads a table in content or source view (if tab selected)
*/
{
- if ( [tablesListView numberOfSelectedRows] == 1 ) {
- if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
- [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = YES;
- contentLoaded = NO;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
- [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = YES;
- contentLoaded = YES;
- statusLoaded = NO;
- } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
- [tableStatusInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = YES;
- } else {
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
- }
+ if ( [tablesListView numberOfSelectedRows] == 1 ) {
+ if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0 ) {
+ [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ structureLoaded = YES;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1 ) {
+ [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ structureLoaded = YES;
+ contentLoaded = YES;
+ statusLoaded = NO;
+ } else if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 ) {
+ [tableStatusInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = YES;
+ } else {
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
+ }
// set window title
[tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user],
[tableDocumentInstance host], [tableDocumentInstance database], [tables objectAtIndex:[tablesListView selectedRow]]]];
- } else {
- [tableSourceInstance loadTable:nil];
- [tableContentInstance loadTable:nil];
- [tableStatusInstance loadTable:nil];
- structureLoaded = NO;
- contentLoaded = NO;
- statusLoaded = NO;
+ } else {
+ [tableSourceInstance loadTable:nil];
+ [tableContentInstance loadTable:nil];
+ [tableStatusInstance loadTable:nil];
+ structureLoaded = NO;
+ contentLoaded = NO;
+ statusLoaded = NO;
// set window title
- [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user],
+ [tableWindow setTitle:[NSString stringWithFormat:@"(MySQL %@) %@@%@/%@", [tableDocumentInstance mySQLVersion], [tableDocumentInstance user],
[tableDocumentInstance host], [tableDocumentInstance database]]];
- }
+ }
}
//tabView delegate methods
@@ -604,33 +604,33 @@ loads a table in content or source view (if tab selected)
loads structure or source if tab selected the first time
*/
{
- if ( [tablesListView numberOfSelectedRows] == 1 )
- {
- if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded )
- {
- [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = YES;
- }
- if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1) && !contentLoaded )
- {
- if ( !structureLoaded ) {
- [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- structureLoaded = YES;
- }
- [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- contentLoaded = YES;
- }
- if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3) && !statusLoaded )
- {
- [tableStatusInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
- statusLoaded = YES;
- }
- }
+ if ( [tablesListView numberOfSelectedRows] == 1 )
+ {
+ if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 0) && !structureLoaded )
+ {
+ [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ structureLoaded = YES;
+ }
+ if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 1) && !contentLoaded )
+ {
+ if ( !structureLoaded ) {
+ [tableSourceInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ structureLoaded = YES;
+ }
+ [tableContentInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ contentLoaded = YES;
+ }
+ if ( ([tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3) && !statusLoaded )
+ {
+ [tableStatusInstance loadTable:[tables objectAtIndex:[tablesListView selectedRow]]];
+ statusLoaded = YES;
+ }
+ }
/*
- if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 )
- {
- [tableDumpInstance reloadTables:self];
- }
+ if ( [tabView indexOfTabViewItem:[tabView selectedTabViewItem]] == 3 )
+ {
+ [tableDumpInstance reloadTables:self];
+ }
*/
}
@@ -672,22 +672,22 @@ loads structure or source if tab selected the first time
//last but not least
- (id)init
{
- self = [super init];
-
- tables = [[NSMutableArray alloc] init];
- structureLoaded = NO;
- contentLoaded = NO;
+ self = [super init];
+
+ tables = [[NSMutableArray alloc] init];
+ structureLoaded = NO;
+ contentLoaded = NO;
[tables addObject:NSLocalizedString(@"TABLES",@"header for table list")];
- return self;
+ return self;
}
- (void)dealloc
{
-// NSLog(@"TableList dealloc");
-
- [tables release];
-
- [super dealloc];
+// NSLog(@"TableList dealloc");
+
+ [tables release];
+
+ [super dealloc];
}
diff --git a/gpl.html b/gpl.html
deleted file mode 100644
index 43277aa1..00000000
--- a/gpl.html
+++ /dev/null
@@ -1 +0,0 @@
-<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> <HTML> <HEAD> <TITLE>GNU General Public License - GNU Project - Free Software Foundation (FSF)</TITLE> <LINK REV="made" HREF="mailto:webmasters@www.gnu.org"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD"> <H1>GNU General Public License</H1> <P> <HR> <P> <H2>Table of Contents</H2> <UL> <LI><A NAME="TOC1" HREF="gpl.html#SEC1">GNU GENERAL PUBLIC LICENSE</A> <UL> <LI><A NAME="TOC2" HREF="gpl.html#SEC2">Preamble</A> <LI><A NAME="TOC3" HREF="gpl.html#SEC3">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</A> <LI><A NAME="TOC4" HREF="gpl.html#SEC4">How to Apply These Terms to Your New Programs</A> </UL> </UL> <P> <HR> <P> <H2><A NAME="SEC1" HREF="gpl.html#TOC1">GNU GENERAL PUBLIC LICENSE</A></H2> <P> Version 2, June 1991 </P> <PRE> Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. </PRE> <H2><A NAME="SEC2" HREF="gpl.html#TOC2">Preamble</A></H2> <P> The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. </P> <P> When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. </P> <P> To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. </P> <P> For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. </P> <P> We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. </P> <P> Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. </P> <P> Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. </P> <P> The precise terms and conditions for copying, distribution and modification follow. </P> <H2><A NAME="SEC3" HREF="gpl.html#TOC3">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</A></H2> <P> <STRONG>0.</STRONG> This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". <P> Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. <P> <STRONG>1.</STRONG> You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. <P> You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. <P> <STRONG>2.</STRONG> You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: <P> <UL> <LI><STRONG>a)</STRONG> You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. <P> <LI><STRONG>b)</STRONG> You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. <P> <LI><STRONG>c)</STRONG> If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) </UL> These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. <P> Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. <P> In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. <P> <STRONG>3.</STRONG> You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: <!---- we use this doubled UL to get the sub-sections indented, --> <!---- while making the bullets as unobvious as possible. --> <UL> <LI><STRONG>a)</STRONG> Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, <P> <LI><STRONG>b)</STRONG> Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, <P> <LI><STRONG>c)</STRONG> Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) </UL> The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. <P> If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. <P> <STRONG>4.</STRONG> You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. <P> <STRONG>5.</STRONG> You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. <P> <STRONG>6.</STRONG> Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. <P> <STRONG>7.</STRONG> If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. <P> If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. <P> It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. <P> This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. <P> <STRONG>8.</STRONG> If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. <P> <STRONG>9.</STRONG> The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. <P> Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. <P> <STRONG>10.</STRONG> If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. <P><STRONG>NO WARRANTY</STRONG></P> <P> <STRONG>11.</STRONG> BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. <P> <STRONG>12.</STRONG> IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. <P> <H2>END OF TERMS AND CONDITIONS</H2> <H2><A NAME="SEC4" HREF="gpl.html#TOC4">How to Apply These Terms to Your New Programs</A></H2> <P> If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. </P> <P> To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. </P> <PRE> <VAR>one line to give the program's name and an idea of what it does.</VAR> Copyright (C) <VAR>yyyy</VAR> <VAR>name of author</VAR> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. </PRE> <P> Also add information on how to contact you by electronic and paper mail. </P> <P> If the program is interactive, make it output a short notice like this when it starts in an interactive mode: </P> <PRE> Gnomovision version 69, Copyright (C) <VAR>yyyy</VAR> <VAR>name of author</VAR> Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. </PRE> <P> The hypothetical commands <SAMP>`show w'</SAMP> and <SAMP>`show c'</SAMP> should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than <SAMP>`show w'</SAMP> and <SAMP>`show c'</SAMP>; they could even be mouse-clicks or menu items--whatever suits your program. </P> <P> You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: </P> <PRE> Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <VAR>signature of Ty Coon</VAR>, 1 April 1989 Ty Coon, President of Vice </PRE> <P> This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. <HR> Return to <A HREF="http://www.gnu.org/home.html">GNU's home page</A>. <P> FSF &amp; GNU inquiries &amp; questions to <A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>. Other <A HREF="http://www.gnu.org/home.html#ContactInfo">ways to contact</A> the FSF. <P> Comments on these web pages to <A HREF="mailto:webmasters@www.gnu.org"><EM>webmasters@www.gnu.org</EM></A>, send other questions to <A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>. <P> Copyright notice above.<BR> Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA <P> Updated: <!---- hhmts start --> 16 Feb 1998 tower <!---- hhmts end --> <HR> <p>This page's HTML was slightly modified for offline use by Gordon Worley on 6.25.1999. No modifications were made to the GNU GPL itself.</p> </BODY> </HTML> \ No newline at end of file
diff --git a/gpl.txt b/gpl.txt
deleted file mode 100644
index 5b6e7c66..00000000
--- a/gpl.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/main.m b/main.m
index b849d407..593bb3ac 100644
--- a/main.m
+++ b/main.m
@@ -1,6 +1,6 @@
#import <Cocoa/Cocoa.h>
-int main(int argc, const char *argv[])
+int main(int argc, char *argv[])
{
- return NSApplicationMain(argc, argv);
+ return NSApplicationMain(argc, (const char **) argv);
}
diff --git a/sequel-pro.scriptSuite b/sequel-pro.scriptSuite
index 49a48f1b..74053c27 100755
--- a/sequel-pro.scriptSuite
+++ b/sequel-pro.scriptSuite
@@ -1,37 +1,37 @@
{
- "Name" = "Sequel Pro";
- "AppleEventCode" = "cmec";
-
- "Classes" = {
- "MainController" = {
- "Superclass" = "NSCoreSuite.NSAbstractObject";
- "AppleEventCode" = "capp";
- "SupportedCommands" = {
- "authenticate" = "authenticate:";
+ "Name" = "Sequel Pro";
+ "AppleEventCode" = "cmec";
+
+ "Classes" = {
+ "MainController" = {
+ "Superclass" = "NSCoreSuite.NSAbstractObject";
+ "AppleEventCode" = "capp";
+ "SupportedCommands" = {
+ "authenticate" = "authenticate:";
"NSCoreSuite.Quit" = "handleQuitScriptCommand:";
- };
- };
- };
- "Commands" = {
- "authenticate" = {
- "CommandClass" = "NSScriptCommand";
- "AppleEventCode" = "auth";
- "Class" = "NSString";
- "ResultAppleEventCode" = "****";
- "Arguments" = {
- "query" = {
- "Type" = "NSString";
- "AppleEventCode" = "qery";
- };
- "fifo" = {
- "Type" = "NSString";
- "AppleEventCode" = "fifo";
- };
- "tunnelName" = {
- "Type" = "NSString";
- "AppleEventCode" = "tunn";
- };
- };
- };
- };
+ };
+ };
+ };
+ "Commands" = {
+ "authenticate" = {
+ "CommandClass" = "NSScriptCommand";
+ "AppleEventCode" = "auth";
+ "Class" = "NSString";
+ "ResultAppleEventCode" = "****";
+ "Arguments" = {
+ "query" = {
+ "Type" = "NSString";
+ "AppleEventCode" = "qery";
+ };
+ "fifo" = {
+ "Type" = "NSString";
+ "AppleEventCode" = "fifo";
+ };
+ "tunnelName" = {
+ "Type" = "NSString";
+ "AppleEventCode" = "tunn";
+ };
+ };
+ };
+ };
} \ No newline at end of file
diff --git a/sequel-pro.scriptTerminology b/sequel-pro.scriptTerminology
index 764e451a..78ff78dc 100755
--- a/sequel-pro.scriptTerminology
+++ b/sequel-pro.scriptTerminology
@@ -1,31 +1,31 @@
{
- "Name" = "Sequel Pro suite";
- "Description" = "Suite for handling tunnel management";
- "Classes" = {
- "MainController" = {
- "Name" = "application";
- "PluralName" = "applications";
- "Description" = "Sequel Pro application";
- };
- };
- "Commands" = {
- "authenticate" = {
- "Name" = "authenticate";
- "Description" = "Open the dialog asking for password or passphrase";
- "Arguments" = {
- "query" = {
- "Name" = "query phrase";
- "Description" = "The string to show in the dialog";
- };
- "fifo" = {
- "Name" = "fifo";
- "Description" = "The FIFO file where expecting the passphrase";
- };
- "tunnelName" = {
- "Name" = "tunnel";
- "Description" = "Tunnel's name";
- };
- };
- };
- };
+ "Name" = "Sequel Pro suite";
+ "Description" = "Suite for handling tunnel management";
+ "Classes" = {
+ "MainController" = {
+ "Name" = "application";
+ "PluralName" = "applications";
+ "Description" = "Sequel Pro application";
+ };
+ };
+ "Commands" = {
+ "authenticate" = {
+ "Name" = "authenticate";
+ "Description" = "Open the dialog asking for password or passphrase";
+ "Arguments" = {
+ "query" = {
+ "Name" = "query phrase";
+ "Description" = "The string to show in the dialog";
+ };
+ "fifo" = {
+ "Name" = "fifo";
+ "Description" = "The FIFO file where expecting the passphrase";
+ };
+ "tunnelName" = {
+ "Name" = "tunnel";
+ "Description" = "Tunnel's name";
+ };
+ };
+ };
+ };
} \ No newline at end of file
diff --git a/sequel-pro.xcodeproj/TemplateIcon.icns b/sequel-pro.xcodeproj/TemplateIcon.icns
new file mode 100644
index 00000000..62cb7015
--- /dev/null
+++ b/sequel-pro.xcodeproj/TemplateIcon.icns
Binary files differ
diff --git a/sequel-pro.xcodeproj/ide.pbxuser b/sequel-pro.xcodeproj/ide.pbxuser
deleted file mode 100644
index f7e43106..00000000
--- a/sequel-pro.xcodeproj/ide.pbxuser
+++ /dev/null
@@ -1,222 +0,0 @@
-// !$*UTF8*$!
-{
- 2A37F4A9FDCFA73011CA2CEA = {
- activeBuildStyle = 4A9504D1FFE6A4CB11CA0CBA;
- activeExecutable = F548086C027F826801DDA526;
- activeTarget = 2A37F4C6FDCFA73011CA2CEA;
- addToTargets = (
- 2A37F4C6FDCFA73011CA2CEA,
- );
- breakpoints = (
- );
- executables = (
- F548086C027F826801DDA526,
- );
- perUserDictionary = {
- PBXPerProjectTemplateStateSaveDate = 93297208;
- PBXWorkspaceContents = (
- {
- LeftSlideOut = {
- Split0 = {
- Split0 = {
- NavCount = 1;
- NavGeometry0 = {
- Frame = "{{0, 0}, {761, 595}}";
- NavBarVisible = YES;
- };
- };
- SplitCount = 1;
- Tab0 = {
- Debugger = {
- Split0 = {
- SplitCount = 2;
- };
- SplitCount = 1;
- TabCount = 2;
- };
- LauncherConfigVersion = 7;
- };
- Tab1 = {
- LauncherConfigVersion = 3;
- Runner = {
- };
- };
- TabCount = 4;
- };
- SplitCount = 1;
- Tab1 = {
- OptionsSetName = "Hierarchy, all classes";
- };
- TabCount = 5;
- };
- },
- );
- PBXWorkspaceGeometries = (
- {
- ContentSize = "{1045, 618}";
- LeftSlideOut = {
- ActiveTab = 0;
- Collapsed = NO;
- Frame = "{{0, 23}, {1045, 595}}";
- Split0 = {
- Collapsed = NO;
- Frame = "{{284, 0}, {761, 595}}";
- Split0 = {
- Frame = "{{0, 0}, {761, 595}}";
- };
- SplitCount = 1;
- Tab0 = {
- Debugger = {
- Collapsed = NO;
- Frame = "{{0, 0}, {681, 289}}";
- Split0 = {
- Frame = "{{0, 24}, {681, 265}}";
- Split0 = {
- Frame = "{{0, 0}, {333, 265}}";
- };
- Split1 = {
- DebugVariablesTableConfiguration = (
- Name,
- 123,
- Value,
- 85,
- Summary,
- 105.123,
- );
- Frame = "{{342, 0}, {339, 265}}";
- };
- SplitCount = 2;
- };
- SplitCount = 1;
- Tab0 = {
- Frame = "{{0, 0}, {100, 50}}";
- };
- Tab1 = {
- Frame = "{{0, 0}, {100, 50}}";
- };
- TabCount = 2;
- TabsVisible = YES;
- };
- Frame = "{{0, 0}, {681, 289}}";
- LauncherConfigVersion = 7;
- };
- Tab1 = {
- Frame = "{{0, 0}, {681, 120}}";
- LauncherConfigVersion = 3;
- Runner = {
- Frame = "{{0, 0}, {681, 120}}";
- };
- };
- Tab2 = {
- BuildMessageFrame = "{{0, 0}, {683, 127}}";
- BuildTranscriptFrame = "{{0, 136}, {683, 100}}";
- Frame = "{{0, 0}, {681, 234}}";
- };
- Tab3 = {
- Frame = "{{0, 0}, {681, 238}}";
- };
- TabCount = 4;
- TabsVisible = NO;
- };
- SplitCount = 1;
- Tab0 = {
- Frame = "{{0, 0}, {260, 595}}";
- GroupTreeTableConfiguration = (
- TargetStatusColumn,
- 18,
- MainColumn,
- 227,
- );
- };
- Tab1 = {
- ClassesFrame = "{{0, 0}, {250, 326}}";
- ClassesTreeTableConfiguration = (
- PBXBookColumnIdentifier,
- 20,
- PBXClassColumnIdentifier,
- 207,
- );
- Frame = "{{0, 0}, {248, 544}}";
- MembersFrame = "{{0, 335}, {250, 209}}";
- MembersTreeTableConfiguration = (
- PBXBookColumnIdentifier,
- 20,
- PBXMethodColumnIdentifier,
- 206,
- );
- };
- Tab2 = {
- Frame = "{{0, 0}, {217, 544}}";
- };
- Tab3 = {
- Frame = "{{0, 0}, {239, 595}}";
- TargetTableConfiguration = (
- ActiveObject,
- 16,
- ObjectNames,
- 206.296,
- );
- };
- Tab4 = {
- BreakpointsTreeTableConfiguration = (
- breakpointColumn,
- 197,
- enabledColumn,
- 31,
- );
- Frame = "{{0, 0}, {250, 544}}";
- };
- TabCount = 5;
- TabsVisible = YES;
- };
- StatusViewVisible = YES;
- Template = 64ABBB4501FA494900185B06;
- ToolbarVisible = YES;
- WindowLocation = "{53, 61}";
- },
- );
- PBXWorkspaceStateSaveDate = 93297208;
- };
- projectwideBuildSettings = {
- };
- wantsIndex = 1;
- wantsSCM = -1;
- };
- 2A37F4C6FDCFA73011CA2CEA = {
- activeExec = 0;
- executables = (
- F548086C027F826801DDA526,
- );
- };
- F548086C027F826801DDA526 = {
- activeArgIndex = 2147483647;
- argumentStrings = (
- );
- debuggerPlugin = GDBDebugging;
- dylibVariantSuffix = "";
- enableDebugStr = 1;
- environmentEntries = (
- );
- isa = PBXExecutable;
- name = "Sequel Pro";
- shlibInfoDictList = (
- );
- sourceDirectories = (
- );
- };
- F548087B027F870A01DDA526 = {
- uiCtxt = {
- sepNavWindowFrame = "{{3, 239}, {750, 502}}";
- };
- };
- F570FC9502A05DFD0127F14A = {
- uiCtxt = {
- sepNavWindowFrame = "{{38, 218}, {750, 502}}";
- };
- };
- F5A1A33B02A16816018594E7 = {
- uiCtxt = {
- sepNavWindowFrame = "{{15, 239}, {750, 502}}";
- };
- };
-}
diff --git a/sequel-pro.xcodeproj/project.pbxproj b/sequel-pro.xcodeproj/project.pbxproj
index 03bc3b85..327fa5f0 100644
--- a/sequel-pro.xcodeproj/project.pbxproj
+++ b/sequel-pro.xcodeproj/project.pbxproj
@@ -3,268 +3,242 @@
archiveVersion = 1;
classes = {
};
- objectVersion = 42;
+ objectVersion = 45;
objects = {
/* Begin PBXBuildFile section */
- 383DAC110DCACB4B000499B6 /* logo-48.png in Resources */ = {isa = PBXBuildFile; fileRef = 383DAC100DCACB4B000499B6 /* logo-48.png */; };
- 383DAC160DCACE1D000499B6 /* toolbar-switch-to-browse.png in Resources */ = {isa = PBXBuildFile; fileRef = 383DAC130DCACE1D000499B6 /* toolbar-switch-to-browse.png */; };
- 383DAC180DCACE1D000499B6 /* toolbar-switch-to-sql.png in Resources */ = {isa = PBXBuildFile; fileRef = 383DAC150DCACE1D000499B6 /* toolbar-switch-to-sql.png */; };
- 383DAC1A0DCACE68000499B6 /* toolbar-switch-to-table-info.png in Resources */ = {isa = PBXBuildFile; fileRef = 383DAC190DCACE68000499B6 /* toolbar-switch-to-table-info.png */; };
- 3861DD760DA78690003236DE /* sequel-pro.scriptTerminology in Resources */ = {isa = PBXBuildFile; fileRef = 3861DD740DA78690003236DE /* sequel-pro.scriptTerminology */; };
- 3861DD770DA78690003236DE /* sequel-pro.scriptSuite in Resources */ = {isa = PBXBuildFile; fileRef = 3861DD750DA78690003236DE /* sequel-pro.scriptSuite */; };
- 3863D2EE0E845D47004172E9 /* toolbar-switch-to-structure.png in Resources */ = {isa = PBXBuildFile; fileRef = 3863D2ED0E845D47004172E9 /* toolbar-switch-to-structure.png */; };
- 38E9C92D0DBF71C5009E9395 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 38E9C92B0DBF71C5009E9395 /* MainMenu.xib */; };
- 38E9C9320DBF7293009E9395 /* DBView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 38E9C9300DBF7293009E9395 /* DBView.xib */; };
- 38F42AE00DBFF16500B58FFB /* TableDocumentSplitView.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F42ADE0DBFF16500B58FFB /* TableDocumentSplitView.h */; };
- 38F42AE10DBFF16500B58FFB /* TableDocumentSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 38F42ADF0DBFF16500B58FFB /* TableDocumentSplitView.m */; };
- 4B370C660E699C3D0002ABD0 /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B370C650E699C3D0002ABD0 /* Sparkle.framework */; };
- 4B370C770E699D9E0002ABD0 /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4B370C650E699C3D0002ABD0 /* Sparkle.framework */; };
- 9B9ACE9208DEBE70009E313E /* TableDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 2A37F4AEFDCFA73011CA2CEA /* TableDocument.h */; };
- 9B9ACE9308DEBE70009E313E /* TableContent.h in Headers */ = {isa = PBXBuildFile; fileRef = F548087A027F870A01DDA526 /* TableContent.h */; };
- 9B9ACE9408DEBE70009E313E /* TableSource.h in Headers */ = {isa = PBXBuildFile; fileRef = F548087C027F870A01DDA526 /* TableSource.h */; };
- 9B9ACE9508DEBE70009E313E /* CustomQuery.h in Headers */ = {isa = PBXBuildFile; fileRef = F5C810CE0281C5A20139D141 /* CustomQuery.h */; };
- 9B9ACE9608DEBE70009E313E /* TablesList.h in Headers */ = {isa = PBXBuildFile; fileRef = F548087E027F870A01DDA526 /* TablesList.h */; };
- 9B9ACE9708DEBE70009E313E /* MainController.h in Headers */ = {isa = PBXBuildFile; fileRef = F5FB320C029E966601566C24 /* MainController.h */; };
- 9B9ACE9808DEBE70009E313E /* TableDump.h in Headers */ = {isa = PBXBuildFile; fileRef = F5A1A33A02A16816018594E7 /* TableDump.h */; };
- 9B9ACE9908DEBE70009E313E /* KeyChain.h in Headers */ = {isa = PBXBuildFile; fileRef = F52BA08003BA16430100012B /* KeyChain.h */; };
- 9B9ACE9A08DEBE70009E313E /* CMImageView.h in Headers */ = {isa = PBXBuildFile; fileRef = F51B8773050A8A1701000103 /* CMImageView.h */; };
- 9B9ACE9B08DEBE70009E313E /* CMCopyTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B40F86207461DC500D81DFB /* CMCopyTable.h */; };
- 9B9ACE9C08DEBE70009E313E /* TableStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B220E640751EE2700DA3E19 /* TableStatus.h */; };
- 9B9ACE9D08DEBE70009E313E /* CMMCPConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BDFCCE408D4285100891F07 /* CMMCPConnection.h */; };
- 9B9ACE9E08DEBE70009E313E /* CMMCPResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BDFCD1208D42B1900891F07 /* CMMCPResult.h */; };
- 9B9ACEA008DEBE70009E313E /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
- 9B9ACEA408DEBE70009E313E /* sort-down.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F570FC9502A05DFD0127F14A /* sort-down.tiff */; };
- 9B9ACEA508DEBE70009E313E /* sort-up.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F570FC9602A05DFD0127F14A /* sort-up.tiff */; };
- 9B9ACEA608DEBE70009E313E /* selectall.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5E57A3902B2B518018C3E81 /* selectall.tiff */; };
- 9B9ACEA708DEBE70009E313E /* appicon.icns in Resources */ = {isa = PBXBuildFile; fileRef = F503C88F02B387CB01C66673 /* appicon.icns */; };
- 9B9ACEA808DEBE70009E313E /* gpl.txt in Resources */ = {isa = PBXBuildFile; fileRef = F55ECCBE02C6156601738522 /* gpl.txt */; };
- 9B9ACEA908DEBE70009E313E /* selectnone.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F51547F604E8E9B901000103 /* selectnone.tiff */; };
- 9B9ACEAA08DEBE70009E313E /* rowcopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC12FC04EE385401FE0D2B /* rowcopy.tiff */; };
- 9B9ACEAB08DEBE70009E313E /* columncopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC12FD04EE385401FE0D2B /* columncopy.tiff */; };
- 9B9ACEAC08DEBE70009E313E /* tablecopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130004EE444801FE0D2B /* tablecopy.tiff */; };
- 9B9ACEAD08DEBE70009E313E /* databases.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130104EE444801FE0D2B /* databases.tiff */; };
- 9B9ACEAE08DEBE70009E313E /* dbadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130204EE444801FE0D2B /* dbadd.tiff */; };
- 9B9ACEAF08DEBE70009E313E /* dbdelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130304EE444801FE0D2B /* dbdelete.tiff */; };
- 9B9ACEB008DEBE70009E313E /* dbrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130404EE444801FE0D2B /* dbrefresh.tiff */; };
- 9B9ACEB108DEBE70009E313E /* indexadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130704EE444801FE0D2B /* indexadd.tiff */; };
- 9B9ACEB208DEBE70009E313E /* indexdelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130804EE444801FE0D2B /* indexdelete.tiff */; };
- 9B9ACEB308DEBE70009E313E /* tableadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130B04EE444801FE0D2B /* tableadd.tiff */; };
- 9B9ACEB408DEBE70009E313E /* tabledelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130C04EE444801FE0D2B /* tabledelete.tiff */; };
- 9B9ACEB508DEBE70009E313E /* tablerefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130D04EE444801FE0D2B /* tablerefresh.tiff */; };
- 9B9ACEB608DEBE70009E313E /* tables.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5EC130E04EE444801FE0D2B /* tables.tiff */; };
- 9B9ACEB708DEBE70009E313E /* clearconsole.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5A1F6DB04EE666101FE0D2B /* clearconsole.tiff */; };
- 9B9ACEB808DEBE70009E313E /* createtablesyntax.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5A1F6DC04EE666101FE0D2B /* createtablesyntax.tiff */; };
- 9B9ACEB908DEBE70009E313E /* flushprivileges.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5A1F6DD04EE666101FE0D2B /* flushprivileges.tiff */; };
- 9B9ACEBA08DEBE70009E313E /* optimizetable.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5A1F6DE04EE666101FE0D2B /* optimizetable.tiff */; };
- 9B9ACEBB08DEBE70009E313E /* showvariables.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F5A1F6E004EE666101FE0D2B /* showvariables.tiff */; };
- 9B9ACEBC08DEBE70009E313E /* columnadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4AC0509EF6201000103 /* columnadd.tiff */; };
- 9B9ACEBD08DEBE70009E313E /* columndelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4AE0509F05101000103 /* columndelete.tiff */; };
- 9B9ACEBE08DEBE70009E313E /* columnrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4B00509F0CA01000103 /* columnrefresh.tiff */; };
- 9B9ACEBF08DEBE70009E313E /* connectionadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4B40509F1B801000103 /* connectionadd.tiff */; };
- 9B9ACEC008DEBE70009E313E /* connectiondelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4B50509F1B801000103 /* connectiondelete.tiff */; };
- 9B9ACEC108DEBE70009E313E /* hideconsole.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4BA0509F6C601000103 /* hideconsole.tiff */; };
- 9B9ACEC208DEBE70009E313E /* showconsole.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4BB0509F6C601000103 /* showconsole.tiff */; };
- 9B9ACEC308DEBE70009E313E /* queryadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4BF0509FB3E01000103 /* queryadd.tiff */; };
- 9B9ACEC408DEBE70009E313E /* querydelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4C00509FB3E01000103 /* querydelete.tiff */; };
- 9B9ACEC508DEBE70009E313E /* rowadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4C90509FDDF01000103 /* rowadd.tiff */; };
- 9B9ACEC608DEBE70009E313E /* rowdelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4CA0509FDDF01000103 /* rowdelete.tiff */; };
- 9B9ACEC708DEBE70009E313E /* rowrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4CB0509FDDF01000103 /* rowrefresh.tiff */; };
- 9B9ACEC808DEBE70009E313E /* sheettotable.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4CF0509FF6401000103 /* sheettotable.tiff */; };
- 9B9ACEC908DEBE70009E313E /* tabletosheet.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4D00509FF6401000103 /* tabletosheet.tiff */; };
- 9B9ACECA08DEBE70009E313E /* textencode.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F52FA4D10509FF6401000103 /* textencode.tiff */; };
- 9B9ACECB08DEBE70009E313E /* connectioncopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F51B86B3050A4E4F01000103 /* connectioncopy.tiff */; };
- 9B9ACECC08DEBE70009E313E /* querycopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = F51B86B4050A4E4F01000103 /* querycopy.tiff */; };
- 9B9ACECD08DEBE70009E313E /* english_help in Resources */ = {isa = PBXBuildFile; fileRef = F5DB91380510F4B60186457F /* english_help */; };
- 9B9ACECE08DEBE70009E313E /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F58CAF13052C84EB01B3ED40 /* Localizable.strings */; };
- 9B9ACED008DEBE70009E313E /* TableDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4ACFDCFA73011CA2CEA /* TableDocument.m */; settings = {ATTRIBUTES = (); }; };
- 9B9ACED108DEBE70009E313E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
- 9B9ACED208DEBE70009E313E /* TableContent.m in Sources */ = {isa = PBXBuildFile; fileRef = F548087B027F870A01DDA526 /* TableContent.m */; };
- 9B9ACED308DEBE70009E313E /* TableSource.m in Sources */ = {isa = PBXBuildFile; fileRef = F548087D027F870A01DDA526 /* TableSource.m */; };
- 9B9ACED408DEBE70009E313E /* TablesList.m in Sources */ = {isa = PBXBuildFile; fileRef = F548087F027F870A01DDA526 /* TablesList.m */; };
- 9B9ACED508DEBE70009E313E /* CustomQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = F5C810CF0281C5A20139D141 /* CustomQuery.m */; };
- 9B9ACED608DEBE70009E313E /* MainController.m in Sources */ = {isa = PBXBuildFile; fileRef = F5FB320D029E966601566C24 /* MainController.m */; };
- 9B9ACED708DEBE70009E313E /* TableDump.m in Sources */ = {isa = PBXBuildFile; fileRef = F5A1A33B02A16816018594E7 /* TableDump.m */; };
- 9B9ACED808DEBE70009E313E /* KeyChain.m in Sources */ = {isa = PBXBuildFile; fileRef = F52BA45F03BA3D0B0100012B /* KeyChain.m */; };
- 9B9ACED908DEBE70009E313E /* CMImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = F51B8774050A8A1701000103 /* CMImageView.m */; };
- 9B9ACEDA08DEBE70009E313E /* CMCopyTable.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B40F86307461DC500D81DFB /* CMCopyTable.m */; };
- 9B9ACEDB08DEBE70009E313E /* TableStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B220E650751EE2700DA3E19 /* TableStatus.m */; };
- 9B9ACEDC08DEBE70009E313E /* CMMCPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDFCCE508D4285100891F07 /* CMMCPConnection.m */; };
- 9B9ACEDD08DEBE70009E313E /* CMMCPResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BDFCD1308D42B1900891F07 /* CMMCPResult.m */; };
- 9B9ACEE108DEBE70009E313E /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */; };
- 9B9ACEE208DEBE70009E313E /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F5981AA203BA574A0100012B /* Carbon.framework */; };
- 9B9ACEE308DEBE70009E313E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */; };
- 9BC3EEBA09AC6EE100F6B295 /* CMTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BC3EEB809AC6EE100F6B295 /* CMTextView.h */; };
- 9BC3EEBB09AC6EE100F6B295 /* CMTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BC3EEB909AC6EE100F6B295 /* CMTextView.m */; };
- 9BE828B70908269400A18070 /* SSHTunnel.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BE828B50908269400A18070 /* SSHTunnel.h */; };
- 9BE828B80908269400A18070 /* SSHTunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE828B60908269400A18070 /* SSHTunnel.m */; };
- 9BFF53B208F44B40004D6BCB /* askForPass.sh in Resources */ = {isa = PBXBuildFile; fileRef = 9BFF53AF08F44B40004D6BCB /* askForPass.sh */; };
- B51C20700DCFEA4F00A9A004 /* SPTableInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = B51C206E0DCFEA4F00A9A004 /* SPTableInfo.h */; };
- B51C20710DCFEA4F00A9A004 /* SPTableInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = B51C206F0DCFEA4F00A9A004 /* SPTableInfo.m */; };
- B550AF9E0DD1795C006CFEF0 /* CodeAssistantProtocol.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B550AF9D0DD1795C006CFEF0 /* CodeAssistantProtocol.tiff */; };
- B55D81380E7A4E3F00FF337B /* MCPKit_bundled.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B55D81370E7A4E3F00FF337B /* MCPKit_bundled.framework */; };
- B5A78E700E4AC08D00684D3F /* grabber-horizontal.png in Resources */ = {isa = PBXBuildFile; fileRef = B5A78E6C0E4AC08D00684D3F /* grabber-horizontal.png */; };
- B5A78E710E4AC08D00684D3F /* grabber-vertical.png in Resources */ = {isa = PBXBuildFile; fileRef = B5A78E6D0E4AC08D00684D3F /* grabber-vertical.png */; };
- B5A78E720E4AC08D00684D3F /* spyglass.tiff in Resources */ = {isa = PBXBuildFile; fileRef = B5A78E6E0E4AC08D00684D3F /* spyglass.tiff */; };
- B5A78E730E4AC08D00684D3F /* table-small.tif in Resources */ = {isa = PBXBuildFile; fileRef = B5A78E6F0E4AC08D00684D3F /* table-small.tif */; };
- B5BD35050DCF31CB005723A7 /* ImageAndTextCell.h in Headers */ = {isa = PBXBuildFile; fileRef = B5BD35030DCF31CB005723A7 /* ImageAndTextCell.h */; };
- B5BD35060DCF31CB005723A7 /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B5BD35040DCF31CB005723A7 /* ImageAndTextCell.m */; };
- B5C801AC0E7210030011253E /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5C801AB0E7210030011253E /* Growl.framework */; };
- B5C801B60E7211BD0011253E /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B5C801AB0E7210030011253E /* Growl.framework */; };
- B5C801C60E7212E00011253E /* Growl Registration Ticket.growlRegDict in Resources */ = {isa = PBXBuildFile; fileRef = B5C801C50E7212E00011253E /* Growl Registration Ticket.growlRegDict */; };
- B5ED4AF90E7A7D6800928118 /* MCPKit_bundled.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B55D81370E7A4E3F00FF337B /* MCPKit_bundled.framework */; };
+ 1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */; };
+ 4D700D280EC2B97C00C9F09E /* appicon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF20EC2B97C00C9F09E /* appicon.icns */; };
+ 4D700D290EC2B97C00C9F09E /* clearconsole.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF30EC2B97C00C9F09E /* clearconsole.tiff */; };
+ 4D700D2A0EC2B97C00C9F09E /* CodeAssistantProtocol.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF40EC2B97C00C9F09E /* CodeAssistantProtocol.tiff */; };
+ 4D700D2B0EC2B97C00C9F09E /* columnadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF50EC2B97C00C9F09E /* columnadd.tiff */; };
+ 4D700D2C0EC2B97C00C9F09E /* columncopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF60EC2B97C00C9F09E /* columncopy.tiff */; };
+ 4D700D2D0EC2B97C00C9F09E /* columndelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF70EC2B97C00C9F09E /* columndelete.tiff */; };
+ 4D700D2E0EC2B97C00C9F09E /* columnrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF80EC2B97C00C9F09E /* columnrefresh.tiff */; };
+ 4D700D2F0EC2B97C00C9F09E /* connectionadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CF90EC2B97C00C9F09E /* connectionadd.tiff */; };
+ 4D700D300EC2B97C00C9F09E /* connectioncopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CFA0EC2B97C00C9F09E /* connectioncopy.tiff */; };
+ 4D700D310EC2B97C00C9F09E /* connectiondelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CFB0EC2B97C00C9F09E /* connectiondelete.tiff */; };
+ 4D700D320EC2B97C00C9F09E /* connectionrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CFC0EC2B97C00C9F09E /* connectionrefresh.tiff */; };
+ 4D700D330EC2B97C00C9F09E /* createtablesyntax.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CFD0EC2B97C00C9F09E /* createtablesyntax.tiff */; };
+ 4D700D340EC2B97C00C9F09E /* databases.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CFE0EC2B97C00C9F09E /* databases.tiff */; };
+ 4D700D350EC2B97C00C9F09E /* dbadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700CFF0EC2B97C00C9F09E /* dbadd.tiff */; };
+ 4D700D360EC2B97C00C9F09E /* dbdelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D000EC2B97C00C9F09E /* dbdelete.tiff */; };
+ 4D700D370EC2B97C00C9F09E /* dbrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D010EC2B97C00C9F09E /* dbrefresh.tiff */; };
+ 4D700D380EC2B97C00C9F09E /* flushprivileges.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D020EC2B97C00C9F09E /* flushprivileges.tiff */; };
+ 4D700D390EC2B97C00C9F09E /* grabber-horizontal.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D030EC2B97C00C9F09E /* grabber-horizontal.png */; };
+ 4D700D3A0EC2B97C00C9F09E /* grabber-vertical.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D040EC2B97C00C9F09E /* grabber-vertical.png */; };
+ 4D700D3B0EC2B97C00C9F09E /* hideconsole.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D050EC2B97C00C9F09E /* hideconsole.tiff */; };
+ 4D700D3C0EC2B97C00C9F09E /* indexadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D060EC2B97C00C9F09E /* indexadd.tiff */; };
+ 4D700D3D0EC2B97C00C9F09E /* indexdelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D070EC2B97C00C9F09E /* indexdelete.tiff */; };
+ 4D700D3E0EC2B97C00C9F09E /* logo-48.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D080EC2B97C00C9F09E /* logo-48.png */; };
+ 4D700D3F0EC2B97C00C9F09E /* optimizetable.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D090EC2B97C00C9F09E /* optimizetable.tiff */; };
+ 4D700D400EC2B97C00C9F09E /* query.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D0A0EC2B97C00C9F09E /* query.tiff */; };
+ 4D700D410EC2B97C00C9F09E /* queryadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D0B0EC2B97C00C9F09E /* queryadd.tiff */; };
+ 4D700D420EC2B97C00C9F09E /* querycopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D0C0EC2B97C00C9F09E /* querycopy.tiff */; };
+ 4D700D430EC2B97C00C9F09E /* querydelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D0D0EC2B97C00C9F09E /* querydelete.tiff */; };
+ 4D700D440EC2B97C00C9F09E /* queryrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D0E0EC2B97C00C9F09E /* queryrefresh.tiff */; };
+ 4D700D450EC2B97C00C9F09E /* reload.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D0F0EC2B97C00C9F09E /* reload.tiff */; };
+ 4D700D460EC2B97C00C9F09E /* rowadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D100EC2B97C00C9F09E /* rowadd.tiff */; };
+ 4D700D470EC2B97C00C9F09E /* rowcopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D110EC2B97C00C9F09E /* rowcopy.tiff */; };
+ 4D700D480EC2B97C00C9F09E /* rowdelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D120EC2B97C00C9F09E /* rowdelete.tiff */; };
+ 4D700D490EC2B97C00C9F09E /* rowrefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D130EC2B97C00C9F09E /* rowrefresh.tiff */; };
+ 4D700D4A0EC2B97C00C9F09E /* selectall.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D140EC2B97C00C9F09E /* selectall.tiff */; };
+ 4D700D4B0EC2B97C00C9F09E /* selectnone.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D150EC2B97C00C9F09E /* selectnone.tiff */; };
+ 4D700D4C0EC2B97C00C9F09E /* sheettotable.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D160EC2B97C00C9F09E /* sheettotable.tiff */; };
+ 4D700D4D0EC2B97C00C9F09E /* showconsole.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D170EC2B97C00C9F09E /* showconsole.tiff */; };
+ 4D700D4E0EC2B97C00C9F09E /* showvariables.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D180EC2B97C00C9F09E /* showvariables.tiff */; };
+ 4D700D4F0EC2B97C00C9F09E /* sort-down.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D190EC2B97C00C9F09E /* sort-down.tiff */; };
+ 4D700D500EC2B97C00C9F09E /* sort-up.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D1A0EC2B97C00C9F09E /* sort-up.tiff */; };
+ 4D700D510EC2B97C00C9F09E /* spyglass.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D1B0EC2B97C00C9F09E /* spyglass.tiff */; };
+ 4D700D520EC2B97C00C9F09E /* table-small.tif in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D1C0EC2B97C00C9F09E /* table-small.tif */; };
+ 4D700D530EC2B97C00C9F09E /* tableadd.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D1D0EC2B97C00C9F09E /* tableadd.tiff */; };
+ 4D700D540EC2B97C00C9F09E /* tablecopy.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D1E0EC2B97C00C9F09E /* tablecopy.tiff */; };
+ 4D700D550EC2B97C00C9F09E /* tabledelete.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D1F0EC2B97C00C9F09E /* tabledelete.tiff */; };
+ 4D700D560EC2B97C00C9F09E /* tablerefresh.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D200EC2B97C00C9F09E /* tablerefresh.tiff */; };
+ 4D700D570EC2B97C00C9F09E /* tables.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D210EC2B97C00C9F09E /* tables.tiff */; };
+ 4D700D580EC2B97C00C9F09E /* tabletosheet.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D220EC2B97C00C9F09E /* tabletosheet.tiff */; };
+ 4D700D590EC2B97C00C9F09E /* textencode.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D230EC2B97C00C9F09E /* textencode.tiff */; };
+ 4D700D5A0EC2B97C00C9F09E /* toolbar-switch-to-browse.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D240EC2B97C00C9F09E /* toolbar-switch-to-browse.png */; };
+ 4D700D5B0EC2B97C00C9F09E /* toolbar-switch-to-sql.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D250EC2B97C00C9F09E /* toolbar-switch-to-sql.png */; };
+ 4D700D5C0EC2B97C00C9F09E /* toolbar-switch-to-structure.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D260EC2B97C00C9F09E /* toolbar-switch-to-structure.png */; };
+ 4D700D5D0EC2B97C00C9F09E /* toolbar-switch-to-table-info.png in Resources */ = {isa = PBXBuildFile; fileRef = 4D700D270EC2B97C00C9F09E /* toolbar-switch-to-table-info.png */; };
+ 4DECC3350EC2A170008D359E /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3320EC2A170008D359E /* Sparkle.framework */; };
+ 4DECC3360EC2A170008D359E /* MCPKit_bundled.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3330EC2A170008D359E /* MCPKit_bundled.framework */; };
+ 4DECC3370EC2A170008D359E /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4DECC3340EC2A170008D359E /* Growl.framework */; };
+ 4DECC3C60EC2A4AD008D359E /* TableDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3BB0EC2A4AD008D359E /* TableDocument.m */; };
+ 4DECC3C70EC2A4AD008D359E /* MainController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3BD0EC2A4AD008D359E /* MainController.m */; };
+ 4DECC3C80EC2A4AD008D359E /* TableSource.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3BF0EC2A4AD008D359E /* TableSource.m */; };
+ 4DECC3C90EC2A4AD008D359E /* TableContent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3C10EC2A4AD008D359E /* TableContent.m */; };
+ 4DECC3CA0EC2A4AD008D359E /* CustomQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3C30EC2A4AD008D359E /* CustomQuery.m */; };
+ 4DECC3CB0EC2A4AD008D359E /* TableDump.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3C50EC2A4AD008D359E /* TableDump.m */; };
+ 4DECC3D20EC2A4B9008D359E /* TableStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3CD0EC2A4B9008D359E /* TableStatus.m */; };
+ 4DECC3D30EC2A4B9008D359E /* TablesList.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3CF0EC2A4B9008D359E /* TablesList.m */; };
+ 4DECC3D40EC2A4B9008D359E /* SPTableInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3D10EC2A4B9008D359E /* SPTableInfo.m */; };
+ 4DECC3DF0EC2A4D3008D359E /* ImageAndTextCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3DC0EC2A4D3008D359E /* ImageAndTextCell.m */; };
+ 4DECC3E00EC2A4D3008D359E /* TableDocumentSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3DE0EC2A4D3008D359E /* TableDocumentSplitView.m */; };
+ 4DECC3E50EC2A528008D359E /* CMMCPConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3E20EC2A528008D359E /* CMMCPConnection.m */; };
+ 4DECC3E60EC2A528008D359E /* CMMCPResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3E40EC2A528008D359E /* CMMCPResult.m */; };
+ 4DECC3E90EC2A534008D359E /* KeyChain.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3E80EC2A534008D359E /* KeyChain.m */; };
+ 4DECC3F00EC2A54E008D359E /* CMCopyTable.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3EB0EC2A54E008D359E /* CMCopyTable.m */; };
+ 4DECC3F10EC2A54E008D359E /* CMImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3ED0EC2A54E008D359E /* CMImageView.m */; };
+ 4DECC3F20EC2A54E008D359E /* CMTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3EF0EC2A54E008D359E /* CMTextView.m */; };
+ 4DECC3FA0EC2A573008D359E /* SSHTunnel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DECC3F40EC2A573008D359E /* SSHTunnel.m */; };
+ 4DECC3FB0EC2A573008D359E /* askForPass.sh in Resources */ = {isa = PBXBuildFile; fileRef = 4DECC3F50EC2A573008D359E /* askForPass.sh */; };
+ 4DECC3FC0EC2A573008D359E /* sequel-pro.scriptTerminology in Resources */ = {isa = PBXBuildFile; fileRef = 4DECC3F60EC2A573008D359E /* sequel-pro.scriptTerminology */; };
+ 4DECC3FD0EC2A573008D359E /* sequel-pro.scriptSuite in Resources */ = {isa = PBXBuildFile; fileRef = 4DECC3F70EC2A573008D359E /* sequel-pro.scriptSuite */; };
+ 4DECC4870EC2B109008D359E /* english_help in Resources */ = {isa = PBXBuildFile; fileRef = 4DECC46D0EC2B109008D359E /* english_help */; };
+ 4DECC48C0EC2B180008D359E /* DBView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4DECC48A0EC2B180008D359E /* DBView.xib */; };
+ 4DECC48F0EC2B436008D359E /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4DECC3320EC2A170008D359E /* Sparkle.framework */; };
+ 4DECC4900EC2B436008D359E /* MCPKit_bundled.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4DECC3330EC2A170008D359E /* MCPKit_bundled.framework */; };
+ 4DECC4910EC2B436008D359E /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4DECC3340EC2A170008D359E /* Growl.framework */; };
+ 4DECC5000EC2B76E008D359E /* Growl Registration Ticket.growlRegDict in Resources */ = {isa = PBXBuildFile; fileRef = 4DECC4FF0EC2B76E008D359E /* Growl Registration Ticket.growlRegDict */; };
+ 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */; };
+ 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; };
+ 8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
+ 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
+ B5EAC0FD0EC87FF900CC579C /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B5EAC0FC0EC87FF900CC579C /* Security.framework */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
- 4B370C6C0E699D230002ABD0 /* CopyFiles */ = {
+ 4DECC4940EC2B447008D359E /* CopyFiles */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- 9B9ACEDE08DEBE70009E313E /* CopyFiles */ = {
- isa = PBXCopyFilesBuildPhase;
- buildActionMask = 12;
- dstPath = "";
- dstSubfolderSpec = 10;
- files = (
- B5ED4AF90E7A7D6800928118 /* MCPKit_bundled.framework in CopyFiles */,
- B5C801B60E7211BD0011253E /* Growl.framework in CopyFiles */,
- 4B370C770E699D9E0002ABD0 /* Sparkle.framework in CopyFiles */,
+ 4DECC48F0EC2B436008D359E /* Sparkle.framework in CopyFiles */,
+ 4DECC4900EC2B436008D359E /* MCPKit_bundled.framework in CopyFiles */,
+ 4DECC4910EC2B436008D359E /* Growl.framework in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
+ 089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
- 2A37F4ACFDCFA73011CA2CEA /* TableDocument.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TableDocument.m; sourceTree = "<group>"; };
- 2A37F4AEFDCFA73011CA2CEA /* TableDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TableDocument.h; sourceTree = "<group>"; };
- 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = "<group>"; };
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
- 383DAC100DCACB4B000499B6 /* logo-48.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "logo-48.png"; path = "images/logo-48.png"; sourceTree = "<group>"; };
- 383DAC130DCACE1D000499B6 /* toolbar-switch-to-browse.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "toolbar-switch-to-browse.png"; path = "images/toolbar-switch-to-browse.png"; sourceTree = "<group>"; };
- 383DAC150DCACE1D000499B6 /* toolbar-switch-to-sql.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "toolbar-switch-to-sql.png"; path = "images/toolbar-switch-to-sql.png"; sourceTree = "<group>"; };
- 383DAC190DCACE68000499B6 /* toolbar-switch-to-table-info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "toolbar-switch-to-table-info.png"; path = "images/toolbar-switch-to-table-info.png"; sourceTree = "<group>"; };
- 3861DD740DA78690003236DE /* sequel-pro.scriptTerminology */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.scriptTerminology; path = "sequel-pro.scriptTerminology"; sourceTree = "<group>"; };
- 3861DD750DA78690003236DE /* sequel-pro.scriptSuite */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.scriptSuite; path = "sequel-pro.scriptSuite"; sourceTree = "<group>"; };
- 3863D2ED0E845D47004172E9 /* toolbar-switch-to-structure.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "toolbar-switch-to-structure.png"; path = "images/toolbar-switch-to-structure.png"; sourceTree = "<group>"; };
- 38E9C92C0DBF71C5009E9395 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = "<group>"; };
- 38E9C9310DBF7293009E9395 /* English */ = {isa = PBXFileReference; languageSpecificationIdentifier = html; lastKnownFileType = file.xib; name = English; path = English.lproj/DBView.xib; sourceTree = "<group>"; };
- 38F42ADE0DBFF16500B58FFB /* TableDocumentSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDocumentSplitView.h; sourceTree = "<group>"; };
- 38F42ADF0DBFF16500B58FFB /* TableDocumentSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDocumentSplitView.m; sourceTree = "<group>"; };
- 4B370C650E699C3D0002ABD0 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
- 9B220E640751EE2700DA3E19 /* TableStatus.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TableStatus.h; sourceTree = "<group>"; };
- 9B220E650751EE2700DA3E19 /* TableStatus.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TableStatus.m; sourceTree = "<group>"; };
- 9B40F86207461DC500D81DFB /* CMCopyTable.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMCopyTable.h; sourceTree = "<group>"; };
- 9B40F86307461DC500D81DFB /* CMCopyTable.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CMCopyTable.m; sourceTree = "<group>"; };
- 9B9ACEE908DEBE70009E313E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
- 9B9ACEEA08DEBE70009E313E /* Sequel Pro.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Sequel Pro.app"; sourceTree = BUILT_PRODUCTS_DIR; };
- 9BC3EEB809AC6EE100F6B295 /* CMTextView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMTextView.h; sourceTree = "<group>"; };
- 9BC3EEB909AC6EE100F6B295 /* CMTextView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CMTextView.m; sourceTree = "<group>"; };
- 9BDFCCE408D4285100891F07 /* CMMCPConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMMCPConnection.h; sourceTree = "<group>"; };
- 9BDFCCE508D4285100891F07 /* CMMCPConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMMCPConnection.m; sourceTree = "<group>"; };
- 9BDFCD1208D42B1900891F07 /* CMMCPResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMMCPResult.h; sourceTree = "<group>"; };
- 9BDFCD1308D42B1900891F07 /* CMMCPResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMMCPResult.m; sourceTree = "<group>"; };
- 9BE828B50908269400A18070 /* SSHTunnel.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SSHTunnel.h; sourceTree = "<group>"; };
- 9BE828B60908269400A18070 /* SSHTunnel.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SSHTunnel.m; sourceTree = "<group>"; };
- 9BFF536B08F43B9D004D6BCB /* SSHTunnel_old.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = SSHTunnel_old.h; sourceTree = "<group>"; };
- 9BFF536C08F43B9E004D6BCB /* SSHTunnel_old.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = SSHTunnel_old.m; sourceTree = "<group>"; };
- 9BFF53AF08F44B40004D6BCB /* askForPass.sh */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; path = askForPass.sh; sourceTree = "<group>"; };
- B51C206E0DCFEA4F00A9A004 /* SPTableInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableInfo.h; sourceTree = "<group>"; };
- B51C206F0DCFEA4F00A9A004 /* SPTableInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableInfo.m; sourceTree = "<group>"; };
- B550AF9D0DD1795C006CFEF0 /* CodeAssistantProtocol.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = CodeAssistantProtocol.tiff; path = images/CodeAssistantProtocol.tiff; sourceTree = "<group>"; };
- B55D81370E7A4E3F00FF337B /* MCPKit_bundled.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MCPKit_bundled.framework; sourceTree = "<group>"; };
- B5A78E6C0E4AC08D00684D3F /* grabber-horizontal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "grabber-horizontal.png"; path = "images/grabber-horizontal.png"; sourceTree = "<group>"; };
- B5A78E6D0E4AC08D00684D3F /* grabber-vertical.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "grabber-vertical.png"; path = "images/grabber-vertical.png"; sourceTree = "<group>"; };
- B5A78E6E0E4AC08D00684D3F /* spyglass.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = spyglass.tiff; path = images/spyglass.tiff; sourceTree = "<group>"; };
- B5A78E6F0E4AC08D00684D3F /* table-small.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "table-small.tif"; path = "images/table-small.tif"; sourceTree = "<group>"; };
- B5BD35030DCF31CB005723A7 /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = "<group>"; };
- B5BD35040DCF31CB005723A7 /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = "<group>"; };
- B5C801AB0E7210030011253E /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = "<group>"; };
- B5C801C50E7212E00011253E /* Growl Registration Ticket.growlRegDict */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Growl Registration Ticket.growlRegDict"; sourceTree = "<group>"; };
- F503C88F02B387CB01C66673 /* appicon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = appicon.icns; path = images/appicon.icns; sourceTree = "<group>"; };
- F51547F604E8E9B901000103 /* selectnone.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = selectnone.tiff; path = images/selectnone.tiff; sourceTree = "<group>"; };
- F51B86B3050A4E4F01000103 /* connectioncopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = connectioncopy.tiff; path = images/connectioncopy.tiff; sourceTree = "<group>"; };
- F51B86B4050A4E4F01000103 /* querycopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = querycopy.tiff; path = images/querycopy.tiff; sourceTree = "<group>"; };
- F51B8773050A8A1701000103 /* CMImageView.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CMImageView.h; sourceTree = "<group>"; };
- F51B8774050A8A1701000103 /* CMImageView.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CMImageView.m; sourceTree = "<group>"; };
- F52BA08003BA16430100012B /* KeyChain.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = KeyChain.h; sourceTree = "<group>"; };
- F52BA45F03BA3D0B0100012B /* KeyChain.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = KeyChain.m; sourceTree = "<group>"; };
- F52FA4AC0509EF6201000103 /* columnadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = columnadd.tiff; path = images/columnadd.tiff; sourceTree = "<group>"; };
- F52FA4AE0509F05101000103 /* columndelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = columndelete.tiff; path = images/columndelete.tiff; sourceTree = "<group>"; };
- F52FA4B00509F0CA01000103 /* columnrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = columnrefresh.tiff; path = images/columnrefresh.tiff; sourceTree = "<group>"; };
- F52FA4B40509F1B801000103 /* connectionadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = connectionadd.tiff; path = images/connectionadd.tiff; sourceTree = "<group>"; };
- F52FA4B50509F1B801000103 /* connectiondelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = connectiondelete.tiff; path = images/connectiondelete.tiff; sourceTree = "<group>"; };
- F52FA4B60509F1B801000103 /* connectionrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = connectionrefresh.tiff; path = images/connectionrefresh.tiff; sourceTree = "<group>"; };
- F52FA4BA0509F6C601000103 /* hideconsole.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = hideconsole.tiff; path = images/hideconsole.tiff; sourceTree = "<group>"; };
- F52FA4BB0509F6C601000103 /* showconsole.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = showconsole.tiff; path = images/showconsole.tiff; sourceTree = "<group>"; };
- F52FA4BE0509FB3E01000103 /* query.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = query.tiff; path = images/query.tiff; sourceTree = "<group>"; };
- F52FA4BF0509FB3E01000103 /* queryadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = queryadd.tiff; path = images/queryadd.tiff; sourceTree = "<group>"; };
- F52FA4C00509FB3E01000103 /* querydelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = querydelete.tiff; path = images/querydelete.tiff; sourceTree = "<group>"; };
- F52FA4C10509FB3E01000103 /* queryrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = queryrefresh.tiff; path = images/queryrefresh.tiff; sourceTree = "<group>"; };
- F52FA4C90509FDDF01000103 /* rowadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = rowadd.tiff; path = images/rowadd.tiff; sourceTree = "<group>"; };
- F52FA4CA0509FDDF01000103 /* rowdelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = rowdelete.tiff; path = images/rowdelete.tiff; sourceTree = "<group>"; };
- F52FA4CB0509FDDF01000103 /* rowrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = rowrefresh.tiff; path = images/rowrefresh.tiff; sourceTree = "<group>"; };
- F52FA4CF0509FF6401000103 /* sheettotable.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = sheettotable.tiff; path = images/sheettotable.tiff; sourceTree = "<group>"; };
- F52FA4D00509FF6401000103 /* tabletosheet.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = tabletosheet.tiff; path = images/tabletosheet.tiff; sourceTree = "<group>"; };
- F52FA4D10509FF6401000103 /* textencode.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = textencode.tiff; path = images/textencode.tiff; sourceTree = "<group>"; };
- F548087A027F870A01DDA526 /* TableContent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TableContent.h; sourceTree = "<group>"; };
- F548087B027F870A01DDA526 /* TableContent.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TableContent.m; sourceTree = "<group>"; };
- F548087C027F870A01DDA526 /* TableSource.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TableSource.h; sourceTree = "<group>"; };
- F548087D027F870A01DDA526 /* TableSource.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TableSource.m; sourceTree = "<group>"; };
- F548087E027F870A01DDA526 /* TablesList.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TablesList.h; sourceTree = "<group>"; };
- F548087F027F870A01DDA526 /* TablesList.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TablesList.m; sourceTree = "<group>"; };
- F55ECCBE02C6156601738522 /* gpl.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = gpl.txt; sourceTree = "<group>"; };
- F570FC9502A05DFD0127F14A /* sort-down.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "sort-down.tiff"; path = "images/sort-down.tiff"; sourceTree = "<group>"; };
- F570FC9602A05DFD0127F14A /* sort-up.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = "sort-up.tiff"; path = "images/sort-up.tiff"; sourceTree = "<group>"; };
- F58CAF14052C84EB01B3ED40 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/Localizable.strings; sourceTree = "<group>"; };
- F5981AA203BA574A0100012B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
- F5A1A33A02A16816018594E7 /* TableDump.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TableDump.h; sourceTree = "<group>"; };
- F5A1A33B02A16816018594E7 /* TableDump.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = TableDump.m; sourceTree = "<group>"; };
- F5A1F6DB04EE666101FE0D2B /* clearconsole.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = clearconsole.tiff; path = images/clearconsole.tiff; sourceTree = "<group>"; };
- F5A1F6DC04EE666101FE0D2B /* createtablesyntax.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = createtablesyntax.tiff; path = images/createtablesyntax.tiff; sourceTree = "<group>"; };
- F5A1F6DD04EE666101FE0D2B /* flushprivileges.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = flushprivileges.tiff; path = images/flushprivileges.tiff; sourceTree = "<group>"; };
- F5A1F6DE04EE666101FE0D2B /* optimizetable.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = optimizetable.tiff; path = images/optimizetable.tiff; sourceTree = "<group>"; };
- F5A1F6E004EE666101FE0D2B /* showvariables.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = showvariables.tiff; path = images/showvariables.tiff; sourceTree = "<group>"; };
- F5C810CE0281C5A20139D141 /* CustomQuery.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CustomQuery.h; sourceTree = "<group>"; };
- F5C810CF0281C5A20139D141 /* CustomQuery.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CustomQuery.m; sourceTree = "<group>"; };
- F5DB91390510F4B60186457F /* English */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = folder; name = English; path = English.lproj/english_help; sourceTree = "<group>"; };
- F5E57A3702B2B518018C3E81 /* reload.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = reload.tiff; path = images/reload.tiff; sourceTree = "<group>"; };
- F5E57A3902B2B518018C3E81 /* selectall.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = selectall.tiff; path = images/selectall.tiff; sourceTree = "<group>"; };
- F5EC12FC04EE385401FE0D2B /* rowcopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = rowcopy.tiff; path = images/rowcopy.tiff; sourceTree = "<group>"; };
- F5EC12FD04EE385401FE0D2B /* columncopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = columncopy.tiff; path = images/columncopy.tiff; sourceTree = "<group>"; };
- F5EC130004EE444801FE0D2B /* tablecopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = tablecopy.tiff; path = images/tablecopy.tiff; sourceTree = "<group>"; };
- F5EC130104EE444801FE0D2B /* databases.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = databases.tiff; path = images/databases.tiff; sourceTree = "<group>"; };
- F5EC130204EE444801FE0D2B /* dbadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = dbadd.tiff; path = images/dbadd.tiff; sourceTree = "<group>"; };
- F5EC130304EE444801FE0D2B /* dbdelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = dbdelete.tiff; path = images/dbdelete.tiff; sourceTree = "<group>"; };
- F5EC130404EE444801FE0D2B /* dbrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = dbrefresh.tiff; path = images/dbrefresh.tiff; sourceTree = "<group>"; };
- F5EC130704EE444801FE0D2B /* indexadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = indexadd.tiff; path = images/indexadd.tiff; sourceTree = "<group>"; };
- F5EC130804EE444801FE0D2B /* indexdelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = indexdelete.tiff; path = images/indexdelete.tiff; sourceTree = "<group>"; };
- F5EC130B04EE444801FE0D2B /* tableadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = tableadd.tiff; path = images/tableadd.tiff; sourceTree = "<group>"; };
- F5EC130C04EE444801FE0D2B /* tabledelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = tabledelete.tiff; path = images/tabledelete.tiff; sourceTree = "<group>"; };
- F5EC130D04EE444801FE0D2B /* tablerefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = tablerefresh.tiff; path = images/tablerefresh.tiff; sourceTree = "<group>"; };
- F5EC130E04EE444801FE0D2B /* tables.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; name = tables.tiff; path = images/tables.tiff; sourceTree = "<group>"; };
- F5FB320C029E966601566C24 /* MainController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MainController.h; sourceTree = "<group>"; };
- F5FB320D029E966601566C24 /* MainController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = MainController.m; sourceTree = "<group>"; };
+ 32DBCF750370BD2300C91783 /* sequel-pro_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "sequel-pro_Prefix.pch"; sourceTree = "<group>"; };
+ 4D700CF20EC2B97C00C9F09E /* appicon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = appicon.icns; sourceTree = "<group>"; };
+ 4D700CF30EC2B97C00C9F09E /* clearconsole.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = clearconsole.tiff; sourceTree = "<group>"; };
+ 4D700CF40EC2B97C00C9F09E /* CodeAssistantProtocol.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = CodeAssistantProtocol.tiff; sourceTree = "<group>"; };
+ 4D700CF50EC2B97C00C9F09E /* columnadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = columnadd.tiff; sourceTree = "<group>"; };
+ 4D700CF60EC2B97C00C9F09E /* columncopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = columncopy.tiff; sourceTree = "<group>"; };
+ 4D700CF70EC2B97C00C9F09E /* columndelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = columndelete.tiff; sourceTree = "<group>"; };
+ 4D700CF80EC2B97C00C9F09E /* columnrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = columnrefresh.tiff; sourceTree = "<group>"; };
+ 4D700CF90EC2B97C00C9F09E /* connectionadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = connectionadd.tiff; sourceTree = "<group>"; };
+ 4D700CFA0EC2B97C00C9F09E /* connectioncopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = connectioncopy.tiff; sourceTree = "<group>"; };
+ 4D700CFB0EC2B97C00C9F09E /* connectiondelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = connectiondelete.tiff; sourceTree = "<group>"; };
+ 4D700CFC0EC2B97C00C9F09E /* connectionrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = connectionrefresh.tiff; sourceTree = "<group>"; };
+ 4D700CFD0EC2B97C00C9F09E /* createtablesyntax.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = createtablesyntax.tiff; sourceTree = "<group>"; };
+ 4D700CFE0EC2B97C00C9F09E /* databases.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = databases.tiff; sourceTree = "<group>"; };
+ 4D700CFF0EC2B97C00C9F09E /* dbadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = dbadd.tiff; sourceTree = "<group>"; };
+ 4D700D000EC2B97C00C9F09E /* dbdelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = dbdelete.tiff; sourceTree = "<group>"; };
+ 4D700D010EC2B97C00C9F09E /* dbrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = dbrefresh.tiff; sourceTree = "<group>"; };
+ 4D700D020EC2B97C00C9F09E /* flushprivileges.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = flushprivileges.tiff; sourceTree = "<group>"; };
+ 4D700D030EC2B97C00C9F09E /* grabber-horizontal.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "grabber-horizontal.png"; sourceTree = "<group>"; };
+ 4D700D040EC2B97C00C9F09E /* grabber-vertical.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "grabber-vertical.png"; sourceTree = "<group>"; };
+ 4D700D050EC2B97C00C9F09E /* hideconsole.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = hideconsole.tiff; sourceTree = "<group>"; };
+ 4D700D060EC2B97C00C9F09E /* indexadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = indexadd.tiff; sourceTree = "<group>"; };
+ 4D700D070EC2B97C00C9F09E /* indexdelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = indexdelete.tiff; sourceTree = "<group>"; };
+ 4D700D080EC2B97C00C9F09E /* logo-48.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "logo-48.png"; sourceTree = "<group>"; };
+ 4D700D090EC2B97C00C9F09E /* optimizetable.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = optimizetable.tiff; sourceTree = "<group>"; };
+ 4D700D0A0EC2B97C00C9F09E /* query.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = query.tiff; sourceTree = "<group>"; };
+ 4D700D0B0EC2B97C00C9F09E /* queryadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = queryadd.tiff; sourceTree = "<group>"; };
+ 4D700D0C0EC2B97C00C9F09E /* querycopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = querycopy.tiff; sourceTree = "<group>"; };
+ 4D700D0D0EC2B97C00C9F09E /* querydelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = querydelete.tiff; sourceTree = "<group>"; };
+ 4D700D0E0EC2B97C00C9F09E /* queryrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = queryrefresh.tiff; sourceTree = "<group>"; };
+ 4D700D0F0EC2B97C00C9F09E /* reload.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = reload.tiff; sourceTree = "<group>"; };
+ 4D700D100EC2B97C00C9F09E /* rowadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = rowadd.tiff; sourceTree = "<group>"; };
+ 4D700D110EC2B97C00C9F09E /* rowcopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = rowcopy.tiff; sourceTree = "<group>"; };
+ 4D700D120EC2B97C00C9F09E /* rowdelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = rowdelete.tiff; sourceTree = "<group>"; };
+ 4D700D130EC2B97C00C9F09E /* rowrefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = rowrefresh.tiff; sourceTree = "<group>"; };
+ 4D700D140EC2B97C00C9F09E /* selectall.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = selectall.tiff; sourceTree = "<group>"; };
+ 4D700D150EC2B97C00C9F09E /* selectnone.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = selectnone.tiff; sourceTree = "<group>"; };
+ 4D700D160EC2B97C00C9F09E /* sheettotable.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = sheettotable.tiff; sourceTree = "<group>"; };
+ 4D700D170EC2B97C00C9F09E /* showconsole.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = showconsole.tiff; sourceTree = "<group>"; };
+ 4D700D180EC2B97C00C9F09E /* showvariables.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = showvariables.tiff; sourceTree = "<group>"; };
+ 4D700D190EC2B97C00C9F09E /* sort-down.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "sort-down.tiff"; sourceTree = "<group>"; };
+ 4D700D1A0EC2B97C00C9F09E /* sort-up.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "sort-up.tiff"; sourceTree = "<group>"; };
+ 4D700D1B0EC2B97C00C9F09E /* spyglass.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = spyglass.tiff; sourceTree = "<group>"; };
+ 4D700D1C0EC2B97C00C9F09E /* table-small.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "table-small.tif"; sourceTree = "<group>"; };
+ 4D700D1D0EC2B97C00C9F09E /* tableadd.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = tableadd.tiff; sourceTree = "<group>"; };
+ 4D700D1E0EC2B97C00C9F09E /* tablecopy.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = tablecopy.tiff; sourceTree = "<group>"; };
+ 4D700D1F0EC2B97C00C9F09E /* tabledelete.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = tabledelete.tiff; sourceTree = "<group>"; };
+ 4D700D200EC2B97C00C9F09E /* tablerefresh.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = tablerefresh.tiff; sourceTree = "<group>"; };
+ 4D700D210EC2B97C00C9F09E /* tables.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = tables.tiff; sourceTree = "<group>"; };
+ 4D700D220EC2B97C00C9F09E /* tabletosheet.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = tabletosheet.tiff; sourceTree = "<group>"; };
+ 4D700D230EC2B97C00C9F09E /* textencode.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = textencode.tiff; sourceTree = "<group>"; };
+ 4D700D240EC2B97C00C9F09E /* toolbar-switch-to-browse.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "toolbar-switch-to-browse.png"; sourceTree = "<group>"; };
+ 4D700D250EC2B97C00C9F09E /* toolbar-switch-to-sql.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "toolbar-switch-to-sql.png"; sourceTree = "<group>"; };
+ 4D700D260EC2B97C00C9F09E /* toolbar-switch-to-structure.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "toolbar-switch-to-structure.png"; sourceTree = "<group>"; };
+ 4D700D270EC2B97C00C9F09E /* toolbar-switch-to-table-info.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "toolbar-switch-to-table-info.png"; sourceTree = "<group>"; };
+ 4DECC3320EC2A170008D359E /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Sparkle.framework; sourceTree = "<group>"; };
+ 4DECC3330EC2A170008D359E /* MCPKit_bundled.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MCPKit_bundled.framework; sourceTree = "<group>"; };
+ 4DECC3340EC2A170008D359E /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Growl.framework; sourceTree = "<group>"; };
+ 4DECC3BA0EC2A4AD008D359E /* TableDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDocument.h; sourceTree = "<group>"; };
+ 4DECC3BB0EC2A4AD008D359E /* TableDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDocument.m; sourceTree = "<group>"; };
+ 4DECC3BC0EC2A4AD008D359E /* MainController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainController.h; sourceTree = "<group>"; };
+ 4DECC3BD0EC2A4AD008D359E /* MainController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainController.m; sourceTree = "<group>"; };
+ 4DECC3BE0EC2A4AD008D359E /* TableSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableSource.h; sourceTree = "<group>"; };
+ 4DECC3BF0EC2A4AD008D359E /* TableSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableSource.m; sourceTree = "<group>"; };
+ 4DECC3C00EC2A4AD008D359E /* TableContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableContent.h; sourceTree = "<group>"; };
+ 4DECC3C10EC2A4AD008D359E /* TableContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableContent.m; sourceTree = "<group>"; };
+ 4DECC3C20EC2A4AD008D359E /* CustomQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomQuery.h; sourceTree = "<group>"; };
+ 4DECC3C30EC2A4AD008D359E /* CustomQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomQuery.m; sourceTree = "<group>"; };
+ 4DECC3C40EC2A4AD008D359E /* TableDump.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDump.h; sourceTree = "<group>"; };
+ 4DECC3C50EC2A4AD008D359E /* TableDump.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDump.m; sourceTree = "<group>"; };
+ 4DECC3CC0EC2A4B9008D359E /* TableStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableStatus.h; sourceTree = "<group>"; };
+ 4DECC3CD0EC2A4B9008D359E /* TableStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableStatus.m; sourceTree = "<group>"; };
+ 4DECC3CE0EC2A4B9008D359E /* TablesList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TablesList.h; sourceTree = "<group>"; };
+ 4DECC3CF0EC2A4B9008D359E /* TablesList.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TablesList.m; sourceTree = "<group>"; };
+ 4DECC3D00EC2A4B9008D359E /* SPTableInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SPTableInfo.h; sourceTree = "<group>"; };
+ 4DECC3D10EC2A4B9008D359E /* SPTableInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SPTableInfo.m; sourceTree = "<group>"; };
+ 4DECC3DB0EC2A4D3008D359E /* ImageAndTextCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageAndTextCell.h; sourceTree = "<group>"; };
+ 4DECC3DC0EC2A4D3008D359E /* ImageAndTextCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ImageAndTextCell.m; sourceTree = "<group>"; };
+ 4DECC3DD0EC2A4D3008D359E /* TableDocumentSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TableDocumentSplitView.h; sourceTree = "<group>"; };
+ 4DECC3DE0EC2A4D3008D359E /* TableDocumentSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TableDocumentSplitView.m; sourceTree = "<group>"; };
+ 4DECC3E10EC2A528008D359E /* CMMCPConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMMCPConnection.h; sourceTree = "<group>"; };
+ 4DECC3E20EC2A528008D359E /* CMMCPConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMMCPConnection.m; sourceTree = "<group>"; };
+ 4DECC3E30EC2A528008D359E /* CMMCPResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMMCPResult.h; sourceTree = "<group>"; };
+ 4DECC3E40EC2A528008D359E /* CMMCPResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMMCPResult.m; sourceTree = "<group>"; };
+ 4DECC3E70EC2A534008D359E /* KeyChain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyChain.h; sourceTree = "<group>"; };
+ 4DECC3E80EC2A534008D359E /* KeyChain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KeyChain.m; sourceTree = "<group>"; };
+ 4DECC3EA0EC2A54E008D359E /* CMCopyTable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMCopyTable.h; sourceTree = "<group>"; };
+ 4DECC3EB0EC2A54E008D359E /* CMCopyTable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMCopyTable.m; sourceTree = "<group>"; };
+ 4DECC3EC0EC2A54E008D359E /* CMImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMImageView.h; sourceTree = "<group>"; };
+ 4DECC3ED0EC2A54E008D359E /* CMImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMImageView.m; sourceTree = "<group>"; };
+ 4DECC3EE0EC2A54E008D359E /* CMTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CMTextView.h; sourceTree = "<group>"; };
+ 4DECC3EF0EC2A54E008D359E /* CMTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CMTextView.m; sourceTree = "<group>"; };
+ 4DECC3F30EC2A573008D359E /* SSHTunnel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSHTunnel.h; sourceTree = "<group>"; };
+ 4DECC3F40EC2A573008D359E /* SSHTunnel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSHTunnel.m; sourceTree = "<group>"; };
+ 4DECC3F50EC2A573008D359E /* askForPass.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = askForPass.sh; sourceTree = "<group>"; };
+ 4DECC3F60EC2A573008D359E /* sequel-pro.scriptTerminology */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.scriptTerminology; path = "sequel-pro.scriptTerminology"; sourceTree = "<group>"; };
+ 4DECC3F70EC2A573008D359E /* sequel-pro.scriptSuite */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.scriptSuite; path = "sequel-pro.scriptSuite"; sourceTree = "<group>"; };
+ 4DECC3F80EC2A573008D359E /* SSHTunnel_old.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSHTunnel_old.h; sourceTree = "<group>"; };
+ 4DECC3F90EC2A573008D359E /* SSHTunnel_old.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSHTunnel_old.m; sourceTree = "<group>"; };
+ 4DECC46E0EC2B109008D359E /* English */ = {isa = PBXFileReference; lastKnownFileType = folder; name = English; path = English.lproj/english_help; sourceTree = "<group>"; };
+ 4DECC48B0EC2B180008D359E /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/DBView.xib; sourceTree = "<group>"; };
+ 4DECC4FF0EC2B76E008D359E /* Growl Registration Ticket.growlRegDict */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = "Growl Registration Ticket.growlRegDict"; sourceTree = "<group>"; };
+ 8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 8D15AC370486D014006FF6A4 /* Sequel Pro.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Sequel Pro.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ B5EAC0FC0EC87FF900CC579C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
- 9B9ACEE008DEBE70009E313E /* Frameworks */ = {
+ 8D15AC330486D014006FF6A4 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 9B9ACEE108DEBE70009E313E /* AppKit.framework in Frameworks */,
- 9B9ACEE208DEBE70009E313E /* Carbon.framework in Frameworks */,
- 9B9ACEE308DEBE70009E313E /* Foundation.framework in Frameworks */,
- 4B370C660E699C3D0002ABD0 /* Sparkle.framework in Frameworks */,
- B5C801AC0E7210030011253E /* Growl.framework in Frameworks */,
- B55D81380E7A4E3F00FF337B /* MCPKit_bundled.framework in Frameworks */,
+ 8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */,
+ 4DECC3350EC2A170008D359E /* Sparkle.framework in Frameworks */,
+ 4DECC3360EC2A170008D359E /* MCPKit_bundled.framework in Frameworks */,
+ 4DECC3370EC2A170008D359E /* Growl.framework in Frameworks */,
+ B5EAC0FD0EC87FF900CC579C /* Security.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -274,9 +248,9 @@
1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
- B55D81370E7A4E3F00FF337B /* MCPKit_bundled.framework */,
- B5C801AB0E7210030011253E /* Growl.framework */,
- 4B370C650E699C3D0002ABD0 /* Sparkle.framework */,
+ 4DECC3320EC2A170008D359E /* Sparkle.framework */,
+ 4DECC3330EC2A170008D359E /* MCPKit_bundled.framework */,
+ 4DECC3340EC2A170008D359E /* Growl.framework */,
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
@@ -285,9 +259,9 @@
1058C7A8FEA54F5311CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
- 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */,
+ B5EAC0FC0EC87FF900CC579C /* Security.framework */,
2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */,
- F5981AA203BA574A0100012B /* Carbon.framework */,
+ 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
@@ -295,38 +269,36 @@
19C28FB0FE9D524F11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
- 9B9ACEEA08DEBE70009E313E /* Sequel Pro.app */,
+ 8D15AC370486D014006FF6A4 /* Sequel Pro.app */,
);
name = Products;
sourceTree = "<group>";
};
- 2A37F4AAFDCFA73011CA2CEA /* Sequel Pro */ = {
+ 2A37F4AAFDCFA73011CA2CEA /* sequel-pro */ = {
isa = PBXGroup;
children = (
- 38F42AC20DBFEEA000B58FFB /* Controllers */,
- 38F42AD90DBFF03E00B58FFB /* Model */,
- 38F42ADD0DBFF14A00B58FFB /* Views */,
- 38F42ADA0DBFF0EE00B58FFB /* Other */,
+ 4DECC3B20EC2A42B008D359E /* Controllers */,
+ 4DECC3B30EC2A432008D359E /* Model */,
+ 4DECC3B40EC2A43E008D359E /* Views */,
+ 4DECC3B50EC2A442008D359E /* Other */,
2A37F4B8FDCFA73011CA2CEA /* Resources */,
2A37F4C3FDCFA73011CA2CEA /* Frameworks */,
19C28FB0FE9D524F11CA2CBB /* Products */,
- F55ECCBE02C6156601738522 /* gpl.txt */,
);
- name = "Sequel Pro";
+ name = "sequel-pro";
sourceTree = "<group>";
};
2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
- B5C801C50E7212E00011253E /* Growl Registration Ticket.growlRegDict */,
- F503C88F02B387CB01C66673 /* appicon.icns */,
- 9B9ACEE908DEBE70009E313E /* Info.plist */,
- F5E4F1AC03C8B2CB01000125 /* images */,
- 38E9C92B0DBF71C5009E9395 /* MainMenu.xib */,
- 38E9C9300DBF7293009E9395 /* DBView.xib */,
- F58CAF13052C84EB01B3ED40 /* Localizable.strings */,
+ 4D700CF10EC2B97C00C9F09E /* images */,
+ 4DECC4FF0EC2B76E008D359E /* Growl Registration Ticket.growlRegDict */,
+ 4DECC48A0EC2B180008D359E /* DBView.xib */,
+ 4DECC46D0EC2B109008D359E /* english_help */,
2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */,
- F5DB91380510F4B60186457F /* english_help */,
+ 8D15AC360486D014006FF6A4 /* Info.plist */,
+ 089C165FFE840EACC02AAC07 /* InfoPlist.strings */,
+ 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */,
);
name = Resources;
sourceTree = "<group>";
@@ -340,217 +312,190 @@
name = Frameworks;
sourceTree = "<group>";
};
- 38F42AC20DBFEEA000B58FFB /* Controllers */ = {
+ 4D700CF10EC2B97C00C9F09E /* images */ = {
+ isa = PBXGroup;
+ children = (
+ 4D700CF20EC2B97C00C9F09E /* appicon.icns */,
+ 4D700CF30EC2B97C00C9F09E /* clearconsole.tiff */,
+ 4D700CF40EC2B97C00C9F09E /* CodeAssistantProtocol.tiff */,
+ 4D700CF50EC2B97C00C9F09E /* columnadd.tiff */,
+ 4D700CF60EC2B97C00C9F09E /* columncopy.tiff */,
+ 4D700CF70EC2B97C00C9F09E /* columndelete.tiff */,
+ 4D700CF80EC2B97C00C9F09E /* columnrefresh.tiff */,
+ 4D700CF90EC2B97C00C9F09E /* connectionadd.tiff */,
+ 4D700CFA0EC2B97C00C9F09E /* connectioncopy.tiff */,
+ 4D700CFB0EC2B97C00C9F09E /* connectiondelete.tiff */,
+ 4D700CFC0EC2B97C00C9F09E /* connectionrefresh.tiff */,
+ 4D700CFD0EC2B97C00C9F09E /* createtablesyntax.tiff */,
+ 4D700CFE0EC2B97C00C9F09E /* databases.tiff */,
+ 4D700CFF0EC2B97C00C9F09E /* dbadd.tiff */,
+ 4D700D000EC2B97C00C9F09E /* dbdelete.tiff */,
+ 4D700D010EC2B97C00C9F09E /* dbrefresh.tiff */,
+ 4D700D020EC2B97C00C9F09E /* flushprivileges.tiff */,
+ 4D700D030EC2B97C00C9F09E /* grabber-horizontal.png */,
+ 4D700D040EC2B97C00C9F09E /* grabber-vertical.png */,
+ 4D700D050EC2B97C00C9F09E /* hideconsole.tiff */,
+ 4D700D060EC2B97C00C9F09E /* indexadd.tiff */,
+ 4D700D070EC2B97C00C9F09E /* indexdelete.tiff */,
+ 4D700D080EC2B97C00C9F09E /* logo-48.png */,
+ 4D700D090EC2B97C00C9F09E /* optimizetable.tiff */,
+ 4D700D0A0EC2B97C00C9F09E /* query.tiff */,
+ 4D700D0B0EC2B97C00C9F09E /* queryadd.tiff */,
+ 4D700D0C0EC2B97C00C9F09E /* querycopy.tiff */,
+ 4D700D0D0EC2B97C00C9F09E /* querydelete.tiff */,
+ 4D700D0E0EC2B97C00C9F09E /* queryrefresh.tiff */,
+ 4D700D0F0EC2B97C00C9F09E /* reload.tiff */,
+ 4D700D100EC2B97C00C9F09E /* rowadd.tiff */,
+ 4D700D110EC2B97C00C9F09E /* rowcopy.tiff */,
+ 4D700D120EC2B97C00C9F09E /* rowdelete.tiff */,
+ 4D700D130EC2B97C00C9F09E /* rowrefresh.tiff */,
+ 4D700D140EC2B97C00C9F09E /* selectall.tiff */,
+ 4D700D150EC2B97C00C9F09E /* selectnone.tiff */,
+ 4D700D160EC2B97C00C9F09E /* sheettotable.tiff */,
+ 4D700D170EC2B97C00C9F09E /* showconsole.tiff */,
+ 4D700D180EC2B97C00C9F09E /* showvariables.tiff */,
+ 4D700D190EC2B97C00C9F09E /* sort-down.tiff */,
+ 4D700D1A0EC2B97C00C9F09E /* sort-up.tiff */,
+ 4D700D1B0EC2B97C00C9F09E /* spyglass.tiff */,
+ 4D700D1C0EC2B97C00C9F09E /* table-small.tif */,
+ 4D700D1D0EC2B97C00C9F09E /* tableadd.tiff */,
+ 4D700D1E0EC2B97C00C9F09E /* tablecopy.tiff */,
+ 4D700D1F0EC2B97C00C9F09E /* tabledelete.tiff */,
+ 4D700D200EC2B97C00C9F09E /* tablerefresh.tiff */,
+ 4D700D210EC2B97C00C9F09E /* tables.tiff */,
+ 4D700D220EC2B97C00C9F09E /* tabletosheet.tiff */,
+ 4D700D230EC2B97C00C9F09E /* textencode.tiff */,
+ 4D700D240EC2B97C00C9F09E /* toolbar-switch-to-browse.png */,
+ 4D700D250EC2B97C00C9F09E /* toolbar-switch-to-sql.png */,
+ 4D700D260EC2B97C00C9F09E /* toolbar-switch-to-structure.png */,
+ 4D700D270EC2B97C00C9F09E /* toolbar-switch-to-table-info.png */,
+ );
+ path = images;
+ sourceTree = "<group>";
+ };
+ 4DECC3B20EC2A42B008D359E /* Controllers */ = {
isa = PBXGroup;
children = (
- 2A37F4AEFDCFA73011CA2CEA /* TableDocument.h */,
- 2A37F4ACFDCFA73011CA2CEA /* TableDocument.m */,
- F5FB320C029E966601566C24 /* MainController.h */,
- F5FB320D029E966601566C24 /* MainController.m */,
- F548087C027F870A01DDA526 /* TableSource.h */,
- F548087D027F870A01DDA526 /* TableSource.m */,
- F548087A027F870A01DDA526 /* TableContent.h */,
- F548087B027F870A01DDA526 /* TableContent.m */,
- F5C810CE0281C5A20139D141 /* CustomQuery.h */,
- F5C810CF0281C5A20139D141 /* CustomQuery.m */,
- F5A1A33A02A16816018594E7 /* TableDump.h */,
- F5A1A33B02A16816018594E7 /* TableDump.m */,
+ 4DECC3BA0EC2A4AD008D359E /* TableDocument.h */,
+ 4DECC3BB0EC2A4AD008D359E /* TableDocument.m */,
+ 4DECC3BC0EC2A4AD008D359E /* MainController.h */,
+ 4DECC3BD0EC2A4AD008D359E /* MainController.m */,
+ 4DECC3BE0EC2A4AD008D359E /* TableSource.h */,
+ 4DECC3BF0EC2A4AD008D359E /* TableSource.m */,
+ 4DECC3C00EC2A4AD008D359E /* TableContent.h */,
+ 4DECC3C10EC2A4AD008D359E /* TableContent.m */,
+ 4DECC3C20EC2A4AD008D359E /* CustomQuery.h */,
+ 4DECC3C30EC2A4AD008D359E /* CustomQuery.m */,
+ 4DECC3C40EC2A4AD008D359E /* TableDump.h */,
+ 4DECC3C50EC2A4AD008D359E /* TableDump.m */,
);
name = Controllers;
sourceTree = "<group>";
};
- 38F42AD90DBFF03E00B58FFB /* Model */ = {
+ 4DECC3B30EC2A432008D359E /* Model */ = {
isa = PBXGroup;
children = (
- 9B220E640751EE2700DA3E19 /* TableStatus.h */,
- 9B220E650751EE2700DA3E19 /* TableStatus.m */,
- F548087E027F870A01DDA526 /* TablesList.h */,
- F548087F027F870A01DDA526 /* TablesList.m */,
- B51C206E0DCFEA4F00A9A004 /* SPTableInfo.h */,
- B51C206F0DCFEA4F00A9A004 /* SPTableInfo.m */,
+ 4DECC3CC0EC2A4B9008D359E /* TableStatus.h */,
+ 4DECC3CD0EC2A4B9008D359E /* TableStatus.m */,
+ 4DECC3CE0EC2A4B9008D359E /* TablesList.h */,
+ 4DECC3CF0EC2A4B9008D359E /* TablesList.m */,
+ 4DECC3D00EC2A4B9008D359E /* SPTableInfo.h */,
+ 4DECC3D10EC2A4B9008D359E /* SPTableInfo.m */,
);
name = Model;
sourceTree = "<group>";
};
- 38F42ADA0DBFF0EE00B58FFB /* Other */ = {
+ 4DECC3B40EC2A43E008D359E /* Views */ = {
isa = PBXGroup;
children = (
- 2A37F4B0FDCFA73011CA2CEA /* main.m */,
- 38F42ADB0DBFF11100B58FFB /* KeyChain */,
- 9BC3EEB409AC6EAB00F6B295 /* MCPKit */,
- 9BC3EEB509AC6EBB00F6B295 /* GUI */,
- 9BFF53AE08F44AFF004D6BCB /* SSHTunnel */,
+ 4DECC3DB0EC2A4D3008D359E /* ImageAndTextCell.h */,
+ 4DECC3DC0EC2A4D3008D359E /* ImageAndTextCell.m */,
+ 4DECC3DD0EC2A4D3008D359E /* TableDocumentSplitView.h */,
+ 4DECC3DE0EC2A4D3008D359E /* TableDocumentSplitView.m */,
);
- name = Other;
+ name = Views;
sourceTree = "<group>";
};
- 38F42ADB0DBFF11100B58FFB /* KeyChain */ = {
+ 4DECC3B50EC2A442008D359E /* Other */ = {
isa = PBXGroup;
children = (
- F52BA08003BA16430100012B /* KeyChain.h */,
- F52BA45F03BA3D0B0100012B /* KeyChain.m */,
+ 2A37F4B0FDCFA73011CA2CEA /* main.m */,
+ 32DBCF750370BD2300C91783 /* sequel-pro_Prefix.pch */,
+ 4DECC3B60EC2A44D008D359E /* KeyChain */,
+ 4DECC3B70EC2A453008D359E /* MCPKit */,
+ 4DECC3B80EC2A458008D359E /* GUI */,
+ 4DECC3B90EC2A45C008D359E /* SSHTunnel */,
);
- name = KeyChain;
+ name = Other;
sourceTree = "<group>";
};
- 38F42ADD0DBFF14A00B58FFB /* Views */ = {
+ 4DECC3B60EC2A44D008D359E /* KeyChain */ = {
isa = PBXGroup;
children = (
- B5BD35030DCF31CB005723A7 /* ImageAndTextCell.h */,
- B5BD35040DCF31CB005723A7 /* ImageAndTextCell.m */,
- 38F42ADE0DBFF16500B58FFB /* TableDocumentSplitView.h */,
- 38F42ADF0DBFF16500B58FFB /* TableDocumentSplitView.m */,
+ 4DECC3E70EC2A534008D359E /* KeyChain.h */,
+ 4DECC3E80EC2A534008D359E /* KeyChain.m */,
);
- name = Views;
+ name = KeyChain;
sourceTree = "<group>";
};
- 9BC3EEB409AC6EAB00F6B295 /* MCPKit */ = {
+ 4DECC3B70EC2A453008D359E /* MCPKit */ = {
isa = PBXGroup;
children = (
- 9BDFCCE408D4285100891F07 /* CMMCPConnection.h */,
- 9BDFCCE508D4285100891F07 /* CMMCPConnection.m */,
- 9BDFCD1208D42B1900891F07 /* CMMCPResult.h */,
- 9BDFCD1308D42B1900891F07 /* CMMCPResult.m */,
+ 4DECC3E10EC2A528008D359E /* CMMCPConnection.h */,
+ 4DECC3E20EC2A528008D359E /* CMMCPConnection.m */,
+ 4DECC3E30EC2A528008D359E /* CMMCPResult.h */,
+ 4DECC3E40EC2A528008D359E /* CMMCPResult.m */,
);
name = MCPKit;
sourceTree = "<group>";
};
- 9BC3EEB509AC6EBB00F6B295 /* GUI */ = {
+ 4DECC3B80EC2A458008D359E /* GUI */ = {
isa = PBXGroup;
children = (
- 9B40F86207461DC500D81DFB /* CMCopyTable.h */,
- 9B40F86307461DC500D81DFB /* CMCopyTable.m */,
- F51B8773050A8A1701000103 /* CMImageView.h */,
- F51B8774050A8A1701000103 /* CMImageView.m */,
- 9BC3EEB809AC6EE100F6B295 /* CMTextView.h */,
- 9BC3EEB909AC6EE100F6B295 /* CMTextView.m */,
+ 4DECC3EA0EC2A54E008D359E /* CMCopyTable.h */,
+ 4DECC3EB0EC2A54E008D359E /* CMCopyTable.m */,
+ 4DECC3EC0EC2A54E008D359E /* CMImageView.h */,
+ 4DECC3ED0EC2A54E008D359E /* CMImageView.m */,
+ 4DECC3EE0EC2A54E008D359E /* CMTextView.h */,
+ 4DECC3EF0EC2A54E008D359E /* CMTextView.m */,
);
name = GUI;
sourceTree = "<group>";
};
- 9BFF53AE08F44AFF004D6BCB /* SSHTunnel */ = {
+ 4DECC3B90EC2A45C008D359E /* SSHTunnel */ = {
isa = PBXGroup;
children = (
- 9BE828B50908269400A18070 /* SSHTunnel.h */,
- 9BE828B60908269400A18070 /* SSHTunnel.m */,
- 9BFF53AF08F44B40004D6BCB /* askForPass.sh */,
- 3861DD740DA78690003236DE /* sequel-pro.scriptTerminology */,
- 3861DD750DA78690003236DE /* sequel-pro.scriptSuite */,
- 9BFF536B08F43B9D004D6BCB /* SSHTunnel_old.h */,
- 9BFF536C08F43B9E004D6BCB /* SSHTunnel_old.m */,
+ 4DECC3F30EC2A573008D359E /* SSHTunnel.h */,
+ 4DECC3F40EC2A573008D359E /* SSHTunnel.m */,
+ 4DECC3F50EC2A573008D359E /* askForPass.sh */,
+ 4DECC3F60EC2A573008D359E /* sequel-pro.scriptTerminology */,
+ 4DECC3F70EC2A573008D359E /* sequel-pro.scriptSuite */,
+ 4DECC3F80EC2A573008D359E /* SSHTunnel_old.h */,
+ 4DECC3F90EC2A573008D359E /* SSHTunnel_old.m */,
);
name = SSHTunnel;
sourceTree = "<group>";
};
- F5E4F1AC03C8B2CB01000125 /* images */ = {
- isa = PBXGroup;
- children = (
- B550AF9D0DD1795C006CFEF0 /* CodeAssistantProtocol.tiff */,
- 383DAC100DCACB4B000499B6 /* logo-48.png */,
- F52FA4B40509F1B801000103 /* connectionadd.tiff */,
- F52FA4B50509F1B801000103 /* connectiondelete.tiff */,
- F51B86B3050A4E4F01000103 /* connectioncopy.tiff */,
- F52FA4B60509F1B801000103 /* connectionrefresh.tiff */,
- F5EC130104EE444801FE0D2B /* databases.tiff */,
- F5EC130204EE444801FE0D2B /* dbadd.tiff */,
- F5EC130304EE444801FE0D2B /* dbdelete.tiff */,
- F5EC130404EE444801FE0D2B /* dbrefresh.tiff */,
- F5EC130E04EE444801FE0D2B /* tables.tiff */,
- F5EC130B04EE444801FE0D2B /* tableadd.tiff */,
- F5EC130C04EE444801FE0D2B /* tabledelete.tiff */,
- F5EC130004EE444801FE0D2B /* tablecopy.tiff */,
- F5EC130D04EE444801FE0D2B /* tablerefresh.tiff */,
- F52FA4D10509FF6401000103 /* textencode.tiff */,
- F52FA4AC0509EF6201000103 /* columnadd.tiff */,
- F52FA4AE0509F05101000103 /* columndelete.tiff */,
- F52FA4B00509F0CA01000103 /* columnrefresh.tiff */,
- F5EC12FD04EE385401FE0D2B /* columncopy.tiff */,
- F5EC130704EE444801FE0D2B /* indexadd.tiff */,
- F5EC130804EE444801FE0D2B /* indexdelete.tiff */,
- F52FA4C90509FDDF01000103 /* rowadd.tiff */,
- F5EC12FC04EE385401FE0D2B /* rowcopy.tiff */,
- F52FA4CA0509FDDF01000103 /* rowdelete.tiff */,
- F52FA4CB0509FDDF01000103 /* rowrefresh.tiff */,
- F52FA4BE0509FB3E01000103 /* query.tiff */,
- F52FA4BF0509FB3E01000103 /* queryadd.tiff */,
- F52FA4C00509FB3E01000103 /* querydelete.tiff */,
- F51B86B4050A4E4F01000103 /* querycopy.tiff */,
- F52FA4C10509FB3E01000103 /* queryrefresh.tiff */,
- F5E57A3902B2B518018C3E81 /* selectall.tiff */,
- F51547F604E8E9B901000103 /* selectnone.tiff */,
- F570FC9502A05DFD0127F14A /* sort-down.tiff */,
- F570FC9602A05DFD0127F14A /* sort-up.tiff */,
- F5E57A3702B2B518018C3E81 /* reload.tiff */,
- F52FA4CF0509FF6401000103 /* sheettotable.tiff */,
- F52FA4D00509FF6401000103 /* tabletosheet.tiff */,
- F52FA4BB0509F6C601000103 /* showconsole.tiff */,
- F52FA4BA0509F6C601000103 /* hideconsole.tiff */,
- F5A1F6DB04EE666101FE0D2B /* clearconsole.tiff */,
- F5A1F6E004EE666101FE0D2B /* showvariables.tiff */,
- F5A1F6DD04EE666101FE0D2B /* flushprivileges.tiff */,
- F5A1F6DE04EE666101FE0D2B /* optimizetable.tiff */,
- B5A78E6C0E4AC08D00684D3F /* grabber-horizontal.png */,
- B5A78E6D0E4AC08D00684D3F /* grabber-vertical.png */,
- B5A78E6E0E4AC08D00684D3F /* spyglass.tiff */,
- B5A78E6F0E4AC08D00684D3F /* table-small.tif */,
- F5A1F6DC04EE666101FE0D2B /* createtablesyntax.tiff */,
- 383DAC130DCACE1D000499B6 /* toolbar-switch-to-browse.png */,
- 383DAC150DCACE1D000499B6 /* toolbar-switch-to-sql.png */,
- 3863D2ED0E845D47004172E9 /* toolbar-switch-to-structure.png */,
- 383DAC190DCACE68000499B6 /* toolbar-switch-to-table-info.png */,
- );
- name = images;
- sourceTree = "<group>";
- };
/* End PBXGroup section */
-/* Begin PBXHeadersBuildPhase section */
- 9B9ACE9108DEBE70009E313E /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 9B9ACE9208DEBE70009E313E /* TableDocument.h in Headers */,
- 9B9ACE9308DEBE70009E313E /* TableContent.h in Headers */,
- 9B9ACE9408DEBE70009E313E /* TableSource.h in Headers */,
- 9B9ACE9508DEBE70009E313E /* CustomQuery.h in Headers */,
- 9B9ACE9608DEBE70009E313E /* TablesList.h in Headers */,
- 9B9ACE9708DEBE70009E313E /* MainController.h in Headers */,
- 9B9ACE9808DEBE70009E313E /* TableDump.h in Headers */,
- 9B9ACE9908DEBE70009E313E /* KeyChain.h in Headers */,
- 9B9ACE9A08DEBE70009E313E /* CMImageView.h in Headers */,
- 9B9ACE9B08DEBE70009E313E /* CMCopyTable.h in Headers */,
- 9B9ACE9C08DEBE70009E313E /* TableStatus.h in Headers */,
- 9B9ACE9D08DEBE70009E313E /* CMMCPConnection.h in Headers */,
- 9B9ACE9E08DEBE70009E313E /* CMMCPResult.h in Headers */,
- 9BE828B70908269400A18070 /* SSHTunnel.h in Headers */,
- 9BC3EEBA09AC6EE100F6B295 /* CMTextView.h in Headers */,
- 38F42AE00DBFF16500B58FFB /* TableDocumentSplitView.h in Headers */,
- B5BD35050DCF31CB005723A7 /* ImageAndTextCell.h in Headers */,
- B51C20700DCFEA4F00A9A004 /* SPTableInfo.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
/* Begin PBXNativeTarget section */
- 9B9ACE9008DEBE70009E313E /* Sequel Pro */ = {
+ 8D15AC270486D014006FF6A4 /* Sequel Pro */ = {
isa = PBXNativeTarget;
- buildConfigurationList = 9B9ACEE508DEBE70009E313E /* Build configuration list for PBXNativeTarget "Sequel Pro" */;
+ buildConfigurationList = C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Sequel Pro" */;
buildPhases = (
- 9B9ACE9108DEBE70009E313E /* Headers */,
- 9B9ACE9F08DEBE70009E313E /* Resources */,
- 9B9ACECF08DEBE70009E313E /* Sources */,
- 9B9ACEDE08DEBE70009E313E /* CopyFiles */,
- 9B9ACEE008DEBE70009E313E /* Frameworks */,
- 4B370C6C0E699D230002ABD0 /* CopyFiles */,
+ 8D15AC2B0486D014006FF6A4 /* Resources */,
+ 8D15AC300486D014006FF6A4 /* Sources */,
+ 8D15AC330486D014006FF6A4 /* Frameworks */,
+ 4DECC4940EC2B447008D359E /* CopyFiles */,
);
buildRules = (
);
dependencies = (
);
name = "Sequel Pro";
- productName = "Sequel Pro";
- productReference = 9B9ACEEA08DEBE70009E313E /* Sequel Pro.app */;
+ productInstallPath = "$(HOME)/Applications";
+ productName = "sequel-pro";
+ productReference = 8D15AC370486D014006FF6A4 /* Sequel Pro.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
@@ -558,301 +503,249 @@
/* Begin PBXProject section */
2A37F4A9FDCFA73011CA2CEA /* Project object */ = {
isa = PBXProject;
- buildConfigurationList = 9BED648908C0E73200C18B6E /* Build configuration list for PBXProject "sequel-pro" */;
- compatibilityVersion = "Xcode 2.4";
+ buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "sequel-pro" */;
+ compatibilityVersion = "Xcode 3.1";
hasScannedForEncodings = 1;
- mainGroup = 2A37F4AAFDCFA73011CA2CEA /* Sequel Pro */;
+ mainGroup = 2A37F4AAFDCFA73011CA2CEA /* sequel-pro */;
projectDirPath = "";
projectRoot = "";
targets = (
- 9B9ACE9008DEBE70009E313E /* Sequel Pro */,
+ 8D15AC270486D014006FF6A4 /* Sequel Pro */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
- 9B9ACE9F08DEBE70009E313E /* Resources */ = {
+ 8D15AC2B0486D014006FF6A4 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- B5C801C60E7212E00011253E /* Growl Registration Ticket.growlRegDict in Resources */,
- 9B9ACEA008DEBE70009E313E /* Credits.rtf in Resources */,
- 9B9ACEA408DEBE70009E313E /* sort-down.tiff in Resources */,
- 9B9ACEA508DEBE70009E313E /* sort-up.tiff in Resources */,
- 9B9ACEA608DEBE70009E313E /* selectall.tiff in Resources */,
- 9B9ACEA708DEBE70009E313E /* appicon.icns in Resources */,
- 9B9ACEA808DEBE70009E313E /* gpl.txt in Resources */,
- 9B9ACEA908DEBE70009E313E /* selectnone.tiff in Resources */,
- 9B9ACEAA08DEBE70009E313E /* rowcopy.tiff in Resources */,
- 9B9ACEAB08DEBE70009E313E /* columncopy.tiff in Resources */,
- 9B9ACEAC08DEBE70009E313E /* tablecopy.tiff in Resources */,
- 9B9ACEAD08DEBE70009E313E /* databases.tiff in Resources */,
- 9B9ACEAE08DEBE70009E313E /* dbadd.tiff in Resources */,
- 9B9ACEAF08DEBE70009E313E /* dbdelete.tiff in Resources */,
- 9B9ACEB008DEBE70009E313E /* dbrefresh.tiff in Resources */,
- 9B9ACEB108DEBE70009E313E /* indexadd.tiff in Resources */,
- 9B9ACEB208DEBE70009E313E /* indexdelete.tiff in Resources */,
- 9B9ACEB308DEBE70009E313E /* tableadd.tiff in Resources */,
- 9B9ACEB408DEBE70009E313E /* tabledelete.tiff in Resources */,
- 9B9ACEB508DEBE70009E313E /* tablerefresh.tiff in Resources */,
- 9B9ACEB608DEBE70009E313E /* tables.tiff in Resources */,
- 9B9ACEB708DEBE70009E313E /* clearconsole.tiff in Resources */,
- 9B9ACEB808DEBE70009E313E /* createtablesyntax.tiff in Resources */,
- 9B9ACEB908DEBE70009E313E /* flushprivileges.tiff in Resources */,
- 9B9ACEBA08DEBE70009E313E /* optimizetable.tiff in Resources */,
- 9B9ACEBB08DEBE70009E313E /* showvariables.tiff in Resources */,
- 9B9ACEBC08DEBE70009E313E /* columnadd.tiff in Resources */,
- 9B9ACEBD08DEBE70009E313E /* columndelete.tiff in Resources */,
- 9B9ACEBE08DEBE70009E313E /* columnrefresh.tiff in Resources */,
- 9B9ACEBF08DEBE70009E313E /* connectionadd.tiff in Resources */,
- 9B9ACEC008DEBE70009E313E /* connectiondelete.tiff in Resources */,
- 9B9ACEC108DEBE70009E313E /* hideconsole.tiff in Resources */,
- 9B9ACEC208DEBE70009E313E /* showconsole.tiff in Resources */,
- 9B9ACEC308DEBE70009E313E /* queryadd.tiff in Resources */,
- 9B9ACEC408DEBE70009E313E /* querydelete.tiff in Resources */,
- 9B9ACEC508DEBE70009E313E /* rowadd.tiff in Resources */,
- 9B9ACEC608DEBE70009E313E /* rowdelete.tiff in Resources */,
- 9B9ACEC708DEBE70009E313E /* rowrefresh.tiff in Resources */,
- 9B9ACEC808DEBE70009E313E /* sheettotable.tiff in Resources */,
- 9B9ACEC908DEBE70009E313E /* tabletosheet.tiff in Resources */,
- 9B9ACECA08DEBE70009E313E /* textencode.tiff in Resources */,
- 9B9ACECB08DEBE70009E313E /* connectioncopy.tiff in Resources */,
- 9B9ACECC08DEBE70009E313E /* querycopy.tiff in Resources */,
- 9B9ACECD08DEBE70009E313E /* english_help in Resources */,
- 9B9ACECE08DEBE70009E313E /* Localizable.strings in Resources */,
- 9BFF53B208F44B40004D6BCB /* askForPass.sh in Resources */,
- 3861DD760DA78690003236DE /* sequel-pro.scriptTerminology in Resources */,
- 3861DD770DA78690003236DE /* sequel-pro.scriptSuite in Resources */,
- 38E9C92D0DBF71C5009E9395 /* MainMenu.xib in Resources */,
- 38E9C9320DBF7293009E9395 /* DBView.xib in Resources */,
- 383DAC110DCACB4B000499B6 /* logo-48.png in Resources */,
- 383DAC160DCACE1D000499B6 /* toolbar-switch-to-browse.png in Resources */,
- 383DAC180DCACE1D000499B6 /* toolbar-switch-to-sql.png in Resources */,
- 383DAC1A0DCACE68000499B6 /* toolbar-switch-to-table-info.png in Resources */,
- B550AF9E0DD1795C006CFEF0 /* CodeAssistantProtocol.tiff in Resources */,
- B5A78E700E4AC08D00684D3F /* grabber-horizontal.png in Resources */,
- B5A78E710E4AC08D00684D3F /* grabber-vertical.png in Resources */,
- B5A78E720E4AC08D00684D3F /* spyglass.tiff in Resources */,
- B5A78E730E4AC08D00684D3F /* table-small.tif in Resources */,
- 3863D2EE0E845D47004172E9 /* toolbar-switch-to-structure.png in Resources */,
+ 8D15AC2C0486D014006FF6A4 /* Credits.rtf in Resources */,
+ 8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */,
+ 1DDD582D0DA1D0D100B32029 /* MainMenu.xib in Resources */,
+ 4DECC3FB0EC2A573008D359E /* askForPass.sh in Resources */,
+ 4DECC3FC0EC2A573008D359E /* sequel-pro.scriptTerminology in Resources */,
+ 4DECC3FD0EC2A573008D359E /* sequel-pro.scriptSuite in Resources */,
+ 4DECC4870EC2B109008D359E /* english_help in Resources */,
+ 4DECC48C0EC2B180008D359E /* DBView.xib in Resources */,
+ 4DECC5000EC2B76E008D359E /* Growl Registration Ticket.growlRegDict in Resources */,
+ 4D700D280EC2B97C00C9F09E /* appicon.icns in Resources */,
+ 4D700D290EC2B97C00C9F09E /* clearconsole.tiff in Resources */,
+ 4D700D2A0EC2B97C00C9F09E /* CodeAssistantProtocol.tiff in Resources */,
+ 4D700D2B0EC2B97C00C9F09E /* columnadd.tiff in Resources */,
+ 4D700D2C0EC2B97C00C9F09E /* columncopy.tiff in Resources */,
+ 4D700D2D0EC2B97C00C9F09E /* columndelete.tiff in Resources */,
+ 4D700D2E0EC2B97C00C9F09E /* columnrefresh.tiff in Resources */,
+ 4D700D2F0EC2B97C00C9F09E /* connectionadd.tiff in Resources */,
+ 4D700D300EC2B97C00C9F09E /* connectioncopy.tiff in Resources */,
+ 4D700D310EC2B97C00C9F09E /* connectiondelete.tiff in Resources */,
+ 4D700D320EC2B97C00C9F09E /* connectionrefresh.tiff in Resources */,
+ 4D700D330EC2B97C00C9F09E /* createtablesyntax.tiff in Resources */,
+ 4D700D340EC2B97C00C9F09E /* databases.tiff in Resources */,
+ 4D700D350EC2B97C00C9F09E /* dbadd.tiff in Resources */,
+ 4D700D360EC2B97C00C9F09E /* dbdelete.tiff in Resources */,
+ 4D700D370EC2B97C00C9F09E /* dbrefresh.tiff in Resources */,
+ 4D700D380EC2B97C00C9F09E /* flushprivileges.tiff in Resources */,
+ 4D700D390EC2B97C00C9F09E /* grabber-horizontal.png in Resources */,
+ 4D700D3A0EC2B97C00C9F09E /* grabber-vertical.png in Resources */,
+ 4D700D3B0EC2B97C00C9F09E /* hideconsole.tiff in Resources */,
+ 4D700D3C0EC2B97C00C9F09E /* indexadd.tiff in Resources */,
+ 4D700D3D0EC2B97C00C9F09E /* indexdelete.tiff in Resources */,
+ 4D700D3E0EC2B97C00C9F09E /* logo-48.png in Resources */,
+ 4D700D3F0EC2B97C00C9F09E /* optimizetable.tiff in Resources */,
+ 4D700D400EC2B97C00C9F09E /* query.tiff in Resources */,
+ 4D700D410EC2B97C00C9F09E /* queryadd.tiff in Resources */,
+ 4D700D420EC2B97C00C9F09E /* querycopy.tiff in Resources */,
+ 4D700D430EC2B97C00C9F09E /* querydelete.tiff in Resources */,
+ 4D700D440EC2B97C00C9F09E /* queryrefresh.tiff in Resources */,
+ 4D700D450EC2B97C00C9F09E /* reload.tiff in Resources */,
+ 4D700D460EC2B97C00C9F09E /* rowadd.tiff in Resources */,
+ 4D700D470EC2B97C00C9F09E /* rowcopy.tiff in Resources */,
+ 4D700D480EC2B97C00C9F09E /* rowdelete.tiff in Resources */,
+ 4D700D490EC2B97C00C9F09E /* rowrefresh.tiff in Resources */,
+ 4D700D4A0EC2B97C00C9F09E /* selectall.tiff in Resources */,
+ 4D700D4B0EC2B97C00C9F09E /* selectnone.tiff in Resources */,
+ 4D700D4C0EC2B97C00C9F09E /* sheettotable.tiff in Resources */,
+ 4D700D4D0EC2B97C00C9F09E /* showconsole.tiff in Resources */,
+ 4D700D4E0EC2B97C00C9F09E /* showvariables.tiff in Resources */,
+ 4D700D4F0EC2B97C00C9F09E /* sort-down.tiff in Resources */,
+ 4D700D500EC2B97C00C9F09E /* sort-up.tiff in Resources */,
+ 4D700D510EC2B97C00C9F09E /* spyglass.tiff in Resources */,
+ 4D700D520EC2B97C00C9F09E /* table-small.tif in Resources */,
+ 4D700D530EC2B97C00C9F09E /* tableadd.tiff in Resources */,
+ 4D700D540EC2B97C00C9F09E /* tablecopy.tiff in Resources */,
+ 4D700D550EC2B97C00C9F09E /* tabledelete.tiff in Resources */,
+ 4D700D560EC2B97C00C9F09E /* tablerefresh.tiff in Resources */,
+ 4D700D570EC2B97C00C9F09E /* tables.tiff in Resources */,
+ 4D700D580EC2B97C00C9F09E /* tabletosheet.tiff in Resources */,
+ 4D700D590EC2B97C00C9F09E /* textencode.tiff in Resources */,
+ 4D700D5A0EC2B97C00C9F09E /* toolbar-switch-to-browse.png in Resources */,
+ 4D700D5B0EC2B97C00C9F09E /* toolbar-switch-to-sql.png in Resources */,
+ 4D700D5C0EC2B97C00C9F09E /* toolbar-switch-to-structure.png in Resources */,
+ 4D700D5D0EC2B97C00C9F09E /* toolbar-switch-to-table-info.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
- 9B9ACECF08DEBE70009E313E /* Sources */ = {
+ 8D15AC300486D014006FF6A4 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- 9B9ACED008DEBE70009E313E /* TableDocument.m in Sources */,
- 9B9ACED108DEBE70009E313E /* main.m in Sources */,
- 9B9ACED208DEBE70009E313E /* TableContent.m in Sources */,
- 9B9ACED308DEBE70009E313E /* TableSource.m in Sources */,
- 9B9ACED408DEBE70009E313E /* TablesList.m in Sources */,
- 9B9ACED508DEBE70009E313E /* CustomQuery.m in Sources */,
- 9B9ACED608DEBE70009E313E /* MainController.m in Sources */,
- 9B9ACED708DEBE70009E313E /* TableDump.m in Sources */,
- 9B9ACED808DEBE70009E313E /* KeyChain.m in Sources */,
- 9B9ACED908DEBE70009E313E /* CMImageView.m in Sources */,
- 9B9ACEDA08DEBE70009E313E /* CMCopyTable.m in Sources */,
- 9B9ACEDB08DEBE70009E313E /* TableStatus.m in Sources */,
- 9B9ACEDC08DEBE70009E313E /* CMMCPConnection.m in Sources */,
- 9B9ACEDD08DEBE70009E313E /* CMMCPResult.m in Sources */,
- 9BE828B80908269400A18070 /* SSHTunnel.m in Sources */,
- 9BC3EEBB09AC6EE100F6B295 /* CMTextView.m in Sources */,
- 38F42AE10DBFF16500B58FFB /* TableDocumentSplitView.m in Sources */,
- B5BD35060DCF31CB005723A7 /* ImageAndTextCell.m in Sources */,
- B51C20710DCFEA4F00A9A004 /* SPTableInfo.m in Sources */,
+ 8D15AC320486D014006FF6A4 /* main.m in Sources */,
+ 4DECC3C60EC2A4AD008D359E /* TableDocument.m in Sources */,
+ 4DECC3C70EC2A4AD008D359E /* MainController.m in Sources */,
+ 4DECC3C80EC2A4AD008D359E /* TableSource.m in Sources */,
+ 4DECC3C90EC2A4AD008D359E /* TableContent.m in Sources */,
+ 4DECC3CA0EC2A4AD008D359E /* CustomQuery.m in Sources */,
+ 4DECC3CB0EC2A4AD008D359E /* TableDump.m in Sources */,
+ 4DECC3D20EC2A4B9008D359E /* TableStatus.m in Sources */,
+ 4DECC3D30EC2A4B9008D359E /* TablesList.m in Sources */,
+ 4DECC3D40EC2A4B9008D359E /* SPTableInfo.m in Sources */,
+ 4DECC3DF0EC2A4D3008D359E /* ImageAndTextCell.m in Sources */,
+ 4DECC3E00EC2A4D3008D359E /* TableDocumentSplitView.m in Sources */,
+ 4DECC3E50EC2A528008D359E /* CMMCPConnection.m in Sources */,
+ 4DECC3E60EC2A528008D359E /* CMMCPResult.m in Sources */,
+ 4DECC3E90EC2A534008D359E /* KeyChain.m in Sources */,
+ 4DECC3F00EC2A54E008D359E /* CMCopyTable.m in Sources */,
+ 4DECC3F10EC2A54E008D359E /* CMImageView.m in Sources */,
+ 4DECC3F20EC2A54E008D359E /* CMTextView.m in Sources */,
+ 4DECC3FA0EC2A573008D359E /* SSHTunnel.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
- 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */ = {
+ 089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
- 2A37F4BAFDCFA73011CA2CEA /* English */,
+ 089C1660FE840EACC02AAC07 /* English */,
);
- name = Credits.rtf;
+ name = InfoPlist.strings;
sourceTree = "<group>";
};
- 38E9C92B0DBF71C5009E9395 /* MainMenu.xib */ = {
+ 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */ = {
isa = PBXVariantGroup;
children = (
- 38E9C92C0DBF71C5009E9395 /* English */,
+ 1DDD582B0DA1D0D100B32029 /* English */,
);
name = MainMenu.xib;
sourceTree = "<group>";
};
- 38E9C9300DBF7293009E9395 /* DBView.xib */ = {
+ 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */ = {
isa = PBXVariantGroup;
children = (
- 38E9C9310DBF7293009E9395 /* English */,
+ 2A37F4BAFDCFA73011CA2CEA /* English */,
);
- name = DBView.xib;
+ name = Credits.rtf;
sourceTree = "<group>";
};
- F58CAF13052C84EB01B3ED40 /* Localizable.strings */ = {
+ 4DECC46D0EC2B109008D359E /* english_help */ = {
isa = PBXVariantGroup;
children = (
- F58CAF14052C84EB01B3ED40 /* English */,
+ 4DECC46E0EC2B109008D359E /* English */,
);
- name = Localizable.strings;
+ name = english_help;
sourceTree = "<group>";
};
- F5DB91380510F4B60186457F /* english_help */ = {
+ 4DECC48A0EC2B180008D359E /* DBView.xib */ = {
isa = PBXVariantGroup;
children = (
- F5DB91390510F4B60186457F /* English */,
+ 4DECC48B0EC2B180008D359E /* English */,
);
- name = english_help;
+ name = DBView.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
- 9B9ACEE608DEBE70009E313E /* Development */ = {
+ C05733C808A9546B00998B17 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = "$(NATIVE_ARCH)";
+ ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
- .,
- "$(SRCROOT)",
+ "$(inherited)",
+ "\"$(SRCROOT)\"",
);
GCC_DYNAMIC_NO_PIC = NO;
GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VALUE = NO;
- GCC_WARN_UNUSED_VARIABLE = YES;
- HEADER_SEARCH_PATHS = "";
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "sequel-pro_Prefix.pch";
INFOPLIST_FILE = Info.plist;
- LIBRARY_SEARCH_PATHS = "";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
+ INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "Sequel Pro";
- SECTORDER_FLAGS = "";
- WARNING_CFLAGS = (
- "-Wmost",
- "-Wno-four-char-constants",
- "-Wno-unknown-pragmas",
- );
- WRAPPER_EXTENSION = app;
- ZERO_LINK = YES;
};
- name = Development;
+ name = Debug;
};
- 9B9ACEE708DEBE70009E313E /* Deployment */ = {
+ C05733C908A9546B00998B17 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = (
- ppc,
- i386,
- );
- COPY_PHASE_STRIP = YES;
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
- .,
- "$(SRCROOT)",
+ "$(inherited)",
+ "\"$(SRCROOT)\"",
);
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
- GCC_OPTIMIZATION_LEVEL = 3;
- HEADER_SEARCH_PATHS = "";
+ GCC_MODEL_TUNING = G5;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "sequel-pro_Prefix.pch";
INFOPLIST_FILE = Info.plist;
- LIBRARY_SEARCH_PATHS = "";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
- MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
- MACOSX_DEPLOYMENT_TARGET_ppc = 10.3;
+ INSTALL_PATH = "$(HOME)/Applications";
PRODUCT_NAME = "Sequel Pro";
- SECTORDER_FLAGS = "";
- VALID_ARCHS = "i386 ppc64 ppc7400 ppc970 ppc";
- VERSIONING_SYSTEM = "";
- WARNING_CFLAGS = (
- "-Wmost",
- "-Wno-four-char-constants",
- "-Wno-unknown-pragmas",
- );
- WRAPPER_EXTENSION = app;
- ZERO_LINK = NO;
};
- name = Deployment;
+ name = Release;
};
- 9B9ACEE808DEBE70009E313E /* Default */ = {
+ C05733CC08A9546B00998B17 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
- ARCHS = (
- ppc,
- i386,
- );
- FRAMEWORK_SEARCH_PATHS = (
- .,
- "$(SRCROOT)",
- );
- GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
- HEADER_SEARCH_PATHS = "";
- INFOPLIST_FILE = Info.plist;
- LIBRARY_SEARCH_PATHS = "";
- MACOSX_DEPLOYMENT_TARGET = 10.4;
- PRODUCT_NAME = "Sequel Pro";
- SECTORDER_FLAGS = "";
- WARNING_CFLAGS = (
- "-Wmost",
- "-Wno-four-char-constants",
- "-Wno-unknown-pragmas",
- );
- WRAPPER_EXTENSION = app;
- };
- name = Default;
- };
- 9BED648A08C0E73200C18B6E /* Development */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
- };
- name = Development;
- };
- 9BED648B08C0E73200C18B6E /* Deployment */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1)";
- ARCHS_STANDARD_32_BIT_PRE_XCODE_3_1 = "ppc i386";
- SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.4;
};
- name = Deployment;
+ name = Debug;
};
- 9BED648C08C0E73200C18B6E /* Default */ = {
+ C05733CD08A9546B00998B17 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
- SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.4;
};
- name = Default;
+ name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
- 9B9ACEE508DEBE70009E313E /* Build configuration list for PBXNativeTarget "Sequel Pro" */ = {
+ C05733C708A9546B00998B17 /* Build configuration list for PBXNativeTarget "Sequel Pro" */ = {
isa = XCConfigurationList;
buildConfigurations = (
- 9B9ACEE608DEBE70009E313E /* Development */,
- 9B9ACEE708DEBE70009E313E /* Deployment */,
- 9B9ACEE808DEBE70009E313E /* Default */,
+ C05733C808A9546B00998B17 /* Debug */,
+ C05733C908A9546B00998B17 /* Release */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Default;
+ defaultConfigurationName = Release;
};
- 9BED648908C0E73200C18B6E /* Build configuration list for PBXProject "sequel-pro" */ = {
+ C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "sequel-pro" */ = {
isa = XCConfigurationList;
buildConfigurations = (
- 9BED648A08C0E73200C18B6E /* Development */,
- 9BED648B08C0E73200C18B6E /* Deployment */,
- 9BED648C08C0E73200C18B6E /* Default */,
+ C05733CC08A9546B00998B17 /* Debug */,
+ C05733CD08A9546B00998B17 /* Release */,
);
defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Default;
+ defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
diff --git a/sequel-pro_Prefix.pch b/sequel-pro_Prefix.pch
new file mode 100644
index 00000000..8df1011d
--- /dev/null
+++ b/sequel-pro_Prefix.pch
@@ -0,0 +1,7 @@
+//
+// Prefix header for all source files of the 'sequel-pro' target in the 'sequel-pro' project
+//
+
+#ifdef __OBJC__
+ #import <Cocoa/Cocoa.h>
+#endif