diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-06-18 08:18:33 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-06-18 08:18:33 +0000 |
commit | b54a768bc63b01475a79426ea519d22217a001c5 (patch) | |
tree | 27b6124e2d7488f7a7c05c69de79fee720f96e32 /Source/CMMCPConnection.m | |
parent | e1af7c62ee26b33be9ced00561bda8873ada8fc6 (diff) | |
download | sequelpro-b54a768bc63b01475a79426ea519d22217a001c5.tar.gz sequelpro-b54a768bc63b01475a79426ea519d22217a001c5.tar.bz2 sequelpro-b54a768bc63b01475a79426ea519d22217a001c5.zip |
• some tiny improvements to speed up queryString:
- cache the function pointer for delegate willPerformQuery:
- if Console Log window is NOT visible suppress reloadData and scrolling to last line (this speeds it up remarkably); if user opens the Console log window it will be synchronized
- timeIntervall for execution time will be divide by CLOCKS_PER_SEC in [NSString stringForTimeInterval]
- removed for utf8 enc in cString the return UTF8String (no significant difference)
• now execution time shows only the time for mysql_real_query
Diffstat (limited to 'Source/CMMCPConnection.m')
-rw-r--r-- | Source/CMMCPConnection.m | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/Source/CMMCPConnection.m b/Source/CMMCPConnection.m index 7dc8804f..68056ba1 100644 --- a/Source/CMMCPConnection.m +++ b/Source/CMMCPConnection.m @@ -665,15 +665,6 @@ static void forcePingTimeout(int signalNumber); /* - * Override the standard queryString: method to default to the connection encoding, as before, - * before pssing on to queryString: usingEncoding:. - */ -- (CMMCPResult *)queryString:(NSString *) query -{ - return [self queryString:query usingEncoding:mEncoding]; -} - -/* * Via that method the current mySQLConnection will be informed * which object sent the current query. */ @@ -690,6 +681,15 @@ static void forcePingTimeout(int signalNumber); } +/* + * Override the standard queryString: method to default to the connection encoding, as before, + * before pssing on to queryString: usingEncoding:. + */ +- (CMMCPResult *)queryString:(NSString *) query +{ + return [self queryString:query usingEncoding:mEncoding]; +} + /* * Modified version of queryString to be used in Sequel Pro. @@ -700,7 +700,7 @@ static void forcePingTimeout(int signalNumber); - (CMMCPResult *)queryString:(NSString *) query usingEncoding:(NSStringEncoding) encoding { CMMCPResult *theResult = nil; - float queryStartTime; + int queryStartTime; const char *theCQuery; unsigned long theCQueryLength; int queryResultCode; @@ -724,12 +724,11 @@ static void forcePingTimeout(int signalNumber); [self stopKeepAliveTimer]; - queryStartTime = clock(); + // queryStartTime = clock(); // Inform the delegate about the query - if (delegateResponseToWillQueryString) { - [delegate willQueryString:query]; - } + if (delegateResponseToWillQueryString) + (void)(NSString*)(*willQueryStringPtr)(delegate, @selector(willQueryString:), query); // Derive the query string in the correct encoding theCQuery = [self cStringFromString:query usingEncoding:encoding]; @@ -782,8 +781,9 @@ static void forcePingTimeout(int signalNumber); // Run (or re-run) the query, timing the execution time of the query - note // that this time will include network lag. + queryStartTime = clock(); queryResultCode = mysql_real_query(mConnection, theCQuery, theCQueryLength); - lastQueryExecutionTime = (clock() - queryStartTime)/CLOCKS_PER_SEC; + lastQueryExecutionTime = (clock() - queryStartTime); // On success, capture the results if (0 == queryResultCode) { @@ -932,6 +932,7 @@ static void forcePingTimeout(int signalNumber); { delegate = object; delegateResponseToWillQueryString = (delegate && [delegate respondsToSelector:@selector(willQueryString:)]); + willQueryStringPtr = [delegate methodForSelector:@selector(willQueryString:)]; } /* Getting the currently used time zone (in communication with the DB server). */ @@ -1134,9 +1135,6 @@ static void forcePingTimeout(int signalNumber) - (const char *) cStringFromString:(NSString *) theString usingEncoding:(NSStringEncoding) encoding { - if(encoding == NSUTF8StringEncoding) - return [theString UTF8String]; - NSMutableData *theData; if (! theString) { |