aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-11-30 00:16:36 +0000
committerrowanbeentje <rowan@beent.je>2009-11-30 00:16:36 +0000
commit90911e029a969588d62aa5a84a4bd297fff01edc (patch)
tree6f500813e7af8c6b31073e51c0346a06b151b25e /Source
parent574b1bb846f58edb5ada13ea404baea265851ec7 (diff)
downloadsequelpro-90911e029a969588d62aa5a84a4bd297fff01edc.tar.gz
sequelpro-90911e029a969588d62aa5a84a4bd297fff01edc.tar.bz2
sequelpro-90911e029a969588d62aa5a84a4bd297fff01edc.zip
- Fix copying SQL INSERTs for binary-type strings (regression somewhere since 0.9.6)
Diffstat (limited to 'Source')
-rw-r--r--Source/CMCopyTable.m11
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/CMCopyTable.m b/Source/CMCopyTable.m
index 98556a8d..1848e2d9 100644
--- a/Source/CMCopyTable.m
+++ b/Source/CMCopyTable.m
@@ -212,7 +212,7 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
else
[types addObject:[NSNumber numberWithInt:1]]; // string (fallback coevally)
}
-
+NSLog([types description]);
[result appendString:[NSString stringWithFormat:@"INSERT INTO %@ (%@)\nVALUES\n",
[(selectedTable == nil)?@"<table>":selectedTable backtickQuotedString], [tbHeader componentsJoinedAndBacktickQuoted]]];
@@ -245,8 +245,13 @@ int MENU_EDIT_COPY_AS_SQL = 2002;
[value appendString:[NSString stringWithFormat:@"%@, ", [rowData description]]];
break;
case 1: // string
- [value appendString:[NSString stringWithFormat:@"'%@', ",
- [mySQLConnection prepareString:[rowData description]]]];
+ if ([rowData isKindOfClass:[NSData class]]) {
+ [value appendString:[NSString stringWithFormat:@"X'%@', ",
+ [mySQLConnection prepareBinaryData:rowData]]];
+ } else {
+ [value appendString:[NSString stringWithFormat:@"'%@', ",
+ [mySQLConnection prepareString:[rowData description]]]];
+ }
break;
case 2: // blob
if (![[self delegate] isKindOfClass:[CustomQuery class]] && [rowData isSPNotLoaded]) {