aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseData.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPDatabaseData.m')
-rw-r--r--Source/SPDatabaseData.m41
1 files changed, 15 insertions, 26 deletions
diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m
index 895700e2..98fedd4f 100644
--- a/Source/SPDatabaseData.m
+++ b/Source/SPDatabaseData.m
@@ -233,15 +233,11 @@ const CHAR_SETS charsets[] =
{
if ([collations count] == 0) {
- // Check the information_schema.collations table is accessible
- MCPResult *result = [connection queryString:@"SELECT * FROM `information_schema`.`collations` LIMIT 1"];
-
- if ([result numOfRows] == 1) {
- // Table is accessible so get available collations
- [collations addObjectsFromArray:[self _getDatabaseDataForQuery:@"SELECT * FROM `information_schema.collations` ORDER BY `collation_name` ASC"]];
- }
- else {
- // Get the list of collations from our hard coded list
+ // Try to retrieve the available collations from the database
+ [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]) {
const CHAR_SETS *c = charsets;
do {
@@ -269,15 +265,11 @@ const CHAR_SETS charsets[] =
characterSetEncoding = [[NSString alloc] initWithString:encoding];
- // Check the information_schema.collations table is accessible
- MCPResult *result = [connection queryString:@"SELECT * FROM `information_schema`.`collations` LIMIT 1"];
-
- if ([result numOfRows] == 1) {
- // Table is accessible so get available collations for the supplied encoding
- [characterSetCollations addObjectsFromArray:[self _getDatabaseDataForQuery:[NSString stringWithFormat:@"SELECT * FROM `information_schema`.`collations` WHERE character_set_name = '%@' ORDER BY `collation_name` ASC", characterSetEncoding]]];
- }
- else {
- // Get the list of collations matching the supplied encoding from our hard coded list
+ // 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 that failed, get the list of collations matching the supplied encoding from the hard-coded list
+ if (![characterSetCollations count]) {
const CHAR_SETS *c = charsets;
do {
@@ -383,15 +375,12 @@ 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
- MCPResult *result = [connection queryString:@"SELECT * FROM `information_schema`.`character_sets` LIMIT 1"];
-
- if ([result numOfRows] == 1) {
- // Table is accessible so get available encodings for the supplied encoding
- [characterSetEncodings addObjectsFromArray:[self _getDatabaseDataForQuery:@"SELECT * FROM `information_schema`.`character_sets` ORDER BY `character_set_name` ASC"]];
- }
- else {
- // Get the list of collations matching the supplied encoding from our hard coded list
+ [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]) {
const CHAR_SETS *c = charsets;
do {