diff options
author | rowanbeentje <rowan@beent.je> | 2009-08-31 23:00:39 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2009-08-31 23:00:39 +0000 |
commit | b2d168940430f6ab55d0aa635d38bcae1b64fcdb (patch) | |
tree | 49f9710ed77113830142d652cc2107f951b6cbc9 /Source/TableDocument.m | |
parent | 934f1d41fa8699b3baba3c4ab7631e136fee14b7 (diff) | |
download | sequelpro-b2d168940430f6ab55d0aa635d38bcae1b64fcdb.tar.gz sequelpro-b2d168940430f6ab55d0aa635d38bcae1b64fcdb.tar.bz2 sequelpro-b2d168940430f6ab55d0aa635d38bcae1b64fcdb.zip |
- Re-enable the fine-grained query logging preferences
- Add defaults for fine-grained logging preferences
- Add a method to TableDocument to allow setting the query mode, and use the query mode to control logging
- Set import/export and custom query to set the appropriate query modes
Diffstat (limited to 'Source/TableDocument.m')
-rw-r--r-- | Source/TableDocument.m | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/Source/TableDocument.m b/Source/TableDocument.m index ece7d376..84aad499 100644 --- a/Source/TableDocument.m +++ b/Source/TableDocument.m @@ -71,6 +71,7 @@ _mainNibLoaded = NO; _encoding = [[NSString alloc] initWithString:@"utf8"]; _isConnected = NO; + _queryMode = SP_QUERYMODE_INTERFACE; chooseDatabaseButton = nil; chooseDatabaseToolbarItem = nil; connectionController = nil; @@ -1051,6 +1052,14 @@ [[SPQueryConsole sharedQueryConsole] clearConsole:sender]; } +/** + * Set a query mode, used to control logging dependant on preferences + */ +- (void) setQueryMode:(int)theQueryMode +{ + _queryMode = theQueryMode; +} + #pragma mark - #pragma mark Encoding Methods @@ -2802,9 +2811,15 @@ * Invoked when the framework is about to perform a query. */ - (void)willQueryString:(NSString *)query connection:(id)connection -{ - if ([[NSUserDefaults standardUserDefaults] boolForKey:@"ConsoleEnableLogging"]) { - [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query]; +{ + NSLog(@"Mode is %i, bool is %@", _queryMode, [prefs boolForKey:@"ConsoleEnableImportExportLogging"]?@"on":@"off"); + if ([prefs boolForKey:@"ConsoleEnableLogging"]) { + if ((_queryMode == SP_QUERYMODE_INTERFACE && [prefs boolForKey:@"ConsoleEnableInterfaceLogging"]) + || (_queryMode == SP_QUERYMODE_CUSTOMQUERY && [prefs boolForKey:@"ConsoleEnableCustomQueryLogging"]) + || (_queryMode == SP_QUERYMODE_IMPORTEXPORT && [prefs boolForKey:@"ConsoleEnableImportExportLogging"])) + { + [[SPQueryConsole sharedQueryConsole] showMessageInConsole:query]; + } } } @@ -2813,7 +2828,9 @@ */ - (void)queryGaveError:(NSString *)error connection:(id)connection { - [[SPQueryConsole sharedQueryConsole] showErrorInConsole:error]; + if ([prefs boolForKey:@"ConsoleEnableLogging"] && [prefs boolForKey:@"ConsoleEnableErrorLogging"]) { + [[SPQueryConsole sharedQueryConsole] showErrorInConsole:error]; + } } /** |