aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Source
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-09-06 11:04:43 +0000
committerstuconnolly <stuart02@gmail.com>2012-09-06 11:04:43 +0000
commitd702a0175e62dfa80537f2405c185d21b739883f (patch)
tree48d66fd00259f8fd9967145578901190380f3eda /Frameworks/PostgresKit/Source
parent9b71e97f74c4d09a5fed11f28c084ee87fccf321 (diff)
downloadsequelpro-d702a0175e62dfa80537f2405c185d21b739883f.tar.gz
sequelpro-d702a0175e62dfa80537f2405c185d21b739883f.tar.bz2
sequelpro-d702a0175e62dfa80537f2405c185d21b739883f.zip
When retrieving the value of a column only lookup the type once.
Diffstat (limited to 'Frameworks/PostgresKit/Source')
-rw-r--r--Frameworks/PostgresKit/Source/FLXPostgresResult.m13
1 files changed, 5 insertions, 8 deletions
diff --git a/Frameworks/PostgresKit/Source/FLXPostgresResult.m b/Frameworks/PostgresKit/Source/FLXPostgresResult.m
index 62e0d222..1aaeb1de 100644
--- a/Frameworks/PostgresKit/Source/FLXPostgresResult.m
+++ b/Frameworks/PostgresKit/Source/FLXPostgresResult.m
@@ -31,7 +31,7 @@ static NSString *FLXPostgresResultError = @"FLXPostgresResultError";
- (void)_populateFields;
- (id)_objectForRow:(unsigned int)row column:(unsigned int)column;
-- (id <FLXPostgresTypeHandlerProtocol>)_typeHandlerForColumn:(unsigned int)column;
+- (id <FLXPostgresTypeHandlerProtocol>)_typeHandlerForColumn:(unsigned int)column withType:(FLXPostgresOid)type;
@end
@@ -204,13 +204,12 @@ static NSString *FLXPostgresResultError = @"FLXPostgresResultError";
if (PQgetisnull(_result, row, column)) return [NSNull null];
// Get bytes and length
+ FLXPostgresOid type = PQftype(_result, column);
const void *bytes = PQgetvalue(_result, row, column);
-
NSUInteger length = PQgetlength(_result, row, column);
- FLXPostgresOid type = PQftype(_result, column);
// Get handler for this type
- id <FLXPostgresTypeHandlerProtocol> handler = [self _typeHandlerForColumn:column];
+ id <FLXPostgresTypeHandlerProtocol> handler = [self _typeHandlerForColumn:column withType:type];
if (!handler) {
NSLog(@"PostgresKit: Warning: No type handler found for type %d, return NSData.", type);
@@ -228,15 +227,13 @@ static NSString *FLXPostgresResultError = @"FLXPostgresResultError";
*
* @return The type handler or nil if out of this result's range.
*/
-- (id <FLXPostgresTypeHandlerProtocol>)_typeHandlerForColumn:(unsigned int)column
+- (id <FLXPostgresTypeHandlerProtocol>)_typeHandlerForColumn:(unsigned int)column withType:(FLXPostgresOid)type
{
if (column >= _numberOfFields) return nil;
id handler = _typeHandlers[column];
- if (!handler) {
- FLXPostgresOid type = PQftype(_result, column);
-
+ if (!handler) {
_typeHandlers[column] = [_connection typeHandlerForRemoteType:type];
handler = _typeHandlers[column];