aboutsummaryrefslogtreecommitdiffstats
path: root/Source
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
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')
-rw-r--r--Source/SPDatabaseData.m41
-rw-r--r--Source/SPQueryController.m10
2 files changed, 22 insertions, 29 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 {
diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m
index 6e9e561e..8a054ce3 100644
--- a/Source/SPQueryController.m
+++ b/Source/SPQueryController.m
@@ -191,14 +191,17 @@ static SPQueryController *sharedQueryController = nil;
// If the timestamp column is not hidden we need to include them in the copy
if (!dateColumnIsHidden) {
+ [string appendString:@"/* "];
[string appendString:[dateFormatter stringFromDate:[message messageDate]]];
- [string appendString:@" "];
+ if (connectionColumnIsHidden) [string appendString:@" */ "];
+ else [string appendString:@" "];
}
// If the connection column is not hidden we need to include them in the copy
if (!connectionColumnIsHidden) {
+ if (dateColumnIsHidden) [string appendString:@"/* "];
[string appendString:[message messageConnection]];
- [string appendString:@" "];
+ [string appendString:@" */ "];
}
[string appendString:[message message]];
@@ -865,8 +868,9 @@ static SPQueryController *sharedQueryController = nil;
// Reload the table and scroll to the new message if it's visible (for speed)
if (allowConsoleUpdate && [[self window] isVisible]) {
- [consoleTableView reloadData];
+ [consoleTableView noteNumberOfRowsChanged];
[consoleTableView scrollRowToVisible:([messagesVisibleSet count] - 1)];
+ [consoleTableView reloadData];
}
}