Skip to content

Commit

Permalink
Fix an error where Sequel Pro was unable to detect the default charse…
Browse files Browse the repository at this point in the history
…t of partitioned tables (#2761)
  • Loading branch information
dmoagx committed Apr 10, 2017
1 parent d1373bf commit 4daa0e1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Source/SPTableData.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4daa0e1

Please sign in to comment.