aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseData.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPDatabaseData.m')
-rw-r--r--Source/SPDatabaseData.m11
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]) {