diff options
author | Max <post@wickenrode.com> | 2017-04-10 06:58:47 +0200 |
---|---|---|
committer | Max <post@wickenrode.com> | 2017-04-10 06:58:47 +0200 |
commit | 4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a (patch) | |
tree | 49bbde8fe38cb95cd2dce758b998ce08df35841b /Source | |
parent | d1373bf8ce6b42179669d4001fa027ca1a6e2ec6 (diff) | |
download | sequelpro-4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a.tar.gz sequelpro-4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a.tar.bz2 sequelpro-4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a.zip |
Fix an error where Sequel Pro was unable to detect the default charset of partitioned tables (#2761)
Diffstat (limited to 'Source')
-rw-r--r-- | Source/SPTableData.m | 7 |
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: |