aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPDatabaseData.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2009-12-02 00:27:00 +0000
committerrowanbeentje <rowan@beent.je>2009-12-02 00:27:00 +0000
commit65778099b6b5084bf9d2e7a6bbefa42b6f303f68 (patch)
tree6eb6f0002c7d1f8a3ece284884bc34fea6b84008 /Source/SPDatabaseData.m
parent8b2503aaed2a149c932697eb58d993aff25f3fdd (diff)
downloadsequelpro-65778099b6b5084bf9d2e7a6bbefa42b6f303f68.tar.gz
sequelpro-65778099b6b5084bf9d2e7a6bbefa42b6f303f68.tar.bz2
sequelpro-65778099b6b5084bf9d2e7a6bbefa42b6f303f68.zip
- Fix display of the bottom row in the query console by reloading table data *after* the scroll
- Quote timestamp and connection when copying rows from the table console - Reduce queries when fetching database collations or encodings by removing an additional check and adapting logic to match
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 {