aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-01-21 00:45:34 +0000
committerrowanbeentje <rowan@beent.je>2010-01-21 00:45:34 +0000
commitce340132e43b5f0d90286704d1232f77f6ffbc8a (patch)
tree6c37a93a9f97ad82ac3317e84c46952577478528 /Source
parent3eb2dc85b5bd6e2efcb65a900293627d0d977078 (diff)
downloadsequelpro-ce340132e43b5f0d90286704d1232f77f6ffbc8a.tar.gz
sequelpro-ce340132e43b5f0d90286704d1232f77f6ffbc8a.tar.bz2
sequelpro-ce340132e43b5f0d90286704d1232f77f6ffbc8a.zip
- Correctly escape field names when creating foreign keys, and escape the database name when looking up tables to add to the dropdown. Addresses Issue #537.
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTableRelations.m6
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m
index ee72fd3a..acb5c29c 100644
--- a/Source/SPTableRelations.m
+++ b/Source/SPTableRelations.m
@@ -115,9 +115,9 @@
NSString *query = [NSString stringWithFormat:@"ALTER TABLE %@ ADD FOREIGN KEY (%@) REFERENCES %@ (%@)",
[thisTable backtickQuotedString],
- thisColumn,
+ [thisColumn backtickQuotedString],
[thatTable backtickQuotedString],
- thatColumn];
+ [thatColumn backtickQuotedString]];
// If required add ON DELETE
if ([onDeletePopUpButton indexOfSelectedItem] > 0) {
@@ -176,7 +176,7 @@
[refTablePopUpButton removeAllItems];
// Get all InnoDB tables in the current database
- MCPResult *result = [connection queryString:[NSString stringWithFormat:@"SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND engine = 'InnoDB' AND table_schema = '%@'", [tableDocumentInstance database]]];
+ MCPResult *result = [connection queryString:[NSString stringWithFormat:@"SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND engine = 'InnoDB' AND table_schema = %@", [[tableDocumentInstance database] tickQuotedString]]];
[result dataSeek:0];