diff options
author | rowanbeentje <rowan@beent.je> | 2010-01-03 13:37:54 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-01-03 13:37:54 +0000 |
commit | 44cdc2f18931a6d5a7571b2dc485120a73b33b57 (patch) | |
tree | 6b7b49f0c7efb80f1fe42b6ab37656660f5c2884 /Source/TablesList.m | |
parent | e42f000e98e9ff33a91a86a3e2a0cf04c6778102 (diff) | |
download | sequelpro-44cdc2f18931a6d5a7571b2dc485120a73b33b57.tar.gz sequelpro-44cdc2f18931a6d5a7571b2dc485120a73b33b57.tar.bz2 sequelpro-44cdc2f18931a6d5a7571b2dc485120a73b33b57.zip |
- Ensure all results for server variable requests are returned as strings, to avoid binary-mode result issues with certain versions of MySQL (including 4.1.14). This should address Issue #509.
- TableDocument now requests the server version string from MCPConnection, aiding caching
Diffstat (limited to 'Source/TablesList.m')
-rw-r--r-- | Source/TablesList.m | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/Source/TablesList.m b/Source/TablesList.m index 6d60faed..3a6462a7 100644 --- a/Source/TablesList.m +++ b/Source/TablesList.m @@ -1242,10 +1242,8 @@ return; } - id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; - - if ([tableSyntax isKindOfClass:[NSData class]]) - tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease]; + [theResult setReturnDataAsStrings:YES]; + NSString *tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; // replace the old name by the new one and drop the old one [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", tableType] withString:[anObject backtickQuotedString]]]; @@ -1991,7 +1989,8 @@ [tableType uppercaseString], [[filteredTables objectAtIndex:[tablesListView selectedRow]] backtickQuotedString] ]]; - + [queryResult setReturnDataAsStrings:YES]; + if ( ![queryResult numOfRows] ) { //error while getting table structure NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil, @@ -2044,10 +2043,8 @@ return; } - id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; - - if ([tableSyntax isKindOfClass:[NSData class]]) - tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease]; + [theResult setReturnDataAsStrings:YES]; + NSString *tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; // replace the old name by the new one and drop the old one [mySQLConnection queryString:[tableSyntax stringByReplacingOccurrencesOfRegex:[NSString stringWithFormat:@"(?<=%@ )(`[^`]+?`)", [tableType uppercaseString]] withString:[[copyTableNameField stringValue] backtickQuotedString]]]; @@ -2173,14 +2170,12 @@ } return; } - - id tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; - - if ([tableSyntax isKindOfClass:[NSData class]]) - tableSyntax = [[[NSString alloc] initWithData:tableSyntax encoding:[mySQLConnection encoding]] autorelease]; - + + [theResult setReturnDataAsStrings:YES]; + NSString *tableSyntax = [[theResult fetchRowAsArray] objectAtIndex:2]; + NSString *tableType; - + switch([self tableType]){ case SP_TABLETYPE_TABLE: tableType = NSLocalizedString(@"table",@"table"); |