Permalink
Browse files

Fix an error where Sequel Pro was unable to detect the default charse…

…t of partitioned tables (#2761)
  • Loading branch information...
dmoagx committed Apr 10, 2017
1 parent d1373bf commit 4daa0e1419ac63abcfb87b9ba7e9f3db5861a95a
Showing with 5 additions and 2 deletions.
  1. +5 −2 Source/SPTableData.m
View
@@ -524,14 +524,17 @@ - (NSDictionary *) informationForTable:(NSString *)tableName
}
/**
* 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
*
* 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 @@ - (NSDictionary *)parseCreateStatement:(NSString *)tableDef ofType:(NSString *)t
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:

0 comments on commit 4daa0e1

Please sign in to comment.