aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTableData.m
diff options
context:
space:
mode:
authorAbhi Beckert <abhi@abhibeckert.com>2017-04-15 08:14:41 +1000
committerAbhi Beckert <abhi@abhibeckert.com>2017-04-15 08:14:41 +1000
commitd20ad5fecb5d68f7dbee83aa56bdd1d262698bc7 (patch)
tree49bbde8fe38cb95cd2dce758b998ce08df35841b /Source/SPTableData.m
parent1d12c0e41319ffd2a1f1ab62305bd2688910f151 (diff)
parent4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a (diff)
downloadsequelpro-d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7.tar.gz
sequelpro-d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7.tar.bz2
sequelpro-d20ad5fecb5d68f7dbee83aa56bdd1d262698bc7.zip
Merge remote-tracking branch 'sequelpro/master'
Diffstat (limited to 'Source/SPTableData.m')
-rw-r--r--Source/SPTableData.m7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/SPTableData.m b/Source/SPTableData.m
index 8033d5a0..d095c33b 100644
--- a/Source/SPTableData.m
+++ b/Source/SPTableData.m
@@ -524,7 +524,7 @@
}
/**
- * Analyse a CREATE TABLE tring to extract the field details, primary key, unique keys, and table encoding.
+ * Analyse a CREATE TABLE string to extract the field details, primary key, unique keys, and table encoding.
* @param tableDef @"CREATE TABLE ..."
* @param tableType Can either be Table or View. Value is copied to the result and not used otherwise
* @return A dict containing info about the table's structure
@@ -532,6 +532,9 @@
* In future this could also be used to retrieve the majority of index information
* assuming information like cardinality isn't needed.
* This function is rather long due to the painful parsing required, but is fast.
+ *
+ * *WARNING* This method is only designed to handle the output of a "SHOW CREATE ..." query.
+ * DO NOT try to use it with user-defined input. The code does not handle the full possible syntax!
*/
- (NSDictionary *)parseCreateStatement:(NSString *)tableDef ofType:(NSString *)tableType
{
@@ -785,7 +788,7 @@
NSUInteger stringStart = NSMaxRange(charsetDefinitionRange);
NSUInteger i;
for (i = stringStart; i < [createTableParser length]; i++) {
- if ([createTableParser characterAtIndex:i] == ' ') break;
+ if ([whitespaceAndNewlineSet characterIsMember:[createTableParser characterAtIndex:i]]) break;
}
// Catch the "default" character encoding: