diff options
author | Bibiko <bibiko@eva.mpg.de> | 2010-01-06 20:54:03 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2010-01-06 20:54:03 +0000 |
commit | fcb6ce6cbb0bd4179e22a3dd17dd12e4a3529cdd (patch) | |
tree | 72b2be91dd765765415705e5105d04780792cc6e /Source/SPDatabaseData.m | |
parent | 644befb3e7d6c3fcce85da8a54d6b89de4ae2bbf (diff) | |
download | sequelpro-fcb6ce6cbb0bd4179e22a3dd17dd12e4a3529cdd.tar.gz sequelpro-fcb6ce6cbb0bd4179e22a3dd17dd12e4a3529cdd.tar.bz2 sequelpro-fcb6ce6cbb0bd4179e22a3dd17dd12e4a3529cdd.zip |
• avoid querying the server for `information_schema` table for MySQL version < 5 - this speeds up SP esp. for slow connections
Diffstat (limited to 'Source/SPDatabaseData.m')
-rw-r--r-- | Source/SPDatabaseData.m | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 07220f59..e8782fad 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -234,7 +234,8 @@ const CHAR_SETS charsets[] = if ([collations count] == 0) { // Try to retrieve the available collations from the database - [collations addObjectsFromArray:[self _getDatabaseDataForQuery:@"SELECT * FROM `information_schema.collations` ORDER BY `collation_name` ASC"]]; + if ([connection serverMajorVersion] >= 5) + [collations addObjectsFromArray:[self _getDatabaseDataForQuery:@"SELECT * FROM `information_schema.collations` ORDER BY `collation_name` ASC"]]; // If that failed, get the list of collations from the hard-coded list if (![collations count]) { @@ -266,7 +267,8 @@ const CHAR_SETS charsets[] = characterSetEncoding = [[NSString alloc] initWithString:encoding]; // Try to retrieve the available collations for the supplied encoding from the database - [characterSetCollations addObjectsFromArray:[self _getDatabaseDataForQuery:[NSString stringWithFormat:@"SELECT * FROM `information_schema`.`collations` WHERE character_set_name = '%@' ORDER BY `collation_name` ASC", characterSetEncoding]]]; + if ([connection serverMajorVersion] >= 5) + [characterSetCollations addObjectsFromArray:[self _getDatabaseDataForQuery:[NSString stringWithFormat:@"SELECT * FROM `information_schema`.`collations` WHERE character_set_name = '%@' ORDER BY `collation_name` ASC", characterSetEncoding]]]; // If that failed, get the list of collations matching the supplied encoding from the hard-coded list if (![characterSetCollations count]) { @@ -377,8 +379,9 @@ const CHAR_SETS charsets[] = if ([characterSetEncodings count] == 0) { // Try to retrieve the available character set encodings from the database - // Check the information_schema.collations table is accessible - [characterSetEncodings addObjectsFromArray:[self _getDatabaseDataForQuery:@"SELECT * FROM `information_schema`.`character_sets` ORDER BY `character_set_name` ASC"]]; + // Check the information_schema.character_sets table is accessible + if ([connection serverMajorVersion] >= 5) + [characterSetEncodings addObjectsFromArray:[self _getDatabaseDataForQuery:@"SELECT * FROM `information_schema`.`character_sets` ORDER BY `character_set_name` ASC"]]; // If that failed, get the list of character set encodings from the hard-coded list if (![characterSetEncodings count]) { |