aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Frameworks/PostgresKit/Source')
-rw-r--r--Frameworks/PostgresKit/Source/PGPostgresTypeBinaryHandler.m32
-rw-r--r--Frameworks/PostgresKit/Source/PGPostgresTypes.h3
2 files changed, 4 insertions, 31 deletions
diff --git a/Frameworks/PostgresKit/Source/PGPostgresTypeBinaryHandler.m b/Frameworks/PostgresKit/Source/PGPostgresTypeBinaryHandler.m
index f544fb39..6c40ca14 100644
--- a/Frameworks/PostgresKit/Source/PGPostgresTypeBinaryHandler.m
+++ b/Frameworks/PostgresKit/Source/PGPostgresTypeBinaryHandler.m
@@ -36,13 +36,6 @@ static PGPostgresOid PGPostgresTypeBinaryTypes[] =
0
};
-@interface PGPostgresTypeBinaryHandler ()
-
-- (id)_binaryDataFromResult;
-
-@end
-
-
@implementation PGPostgresTypeBinaryHandler
@synthesize row = _row;
@@ -70,32 +63,13 @@ static PGPostgresOid PGPostgresTypeBinaryTypes[] =
- (id)objectFromResult
{
- if (!_result || !_type) return [NSNull null];
-
- switch (_type)
- {
- case PGPostgresOidByteData:
- return [self _binaryDataFromResult];
- }
-
- return [NSNull null];
-}
-
-#pragma mark -
-#pragma mark Private API
-
-/**
- * Converts a binary data value to an NSData instance.
- *
- * @return The NSData representation of the data.
- */
-- (id)_binaryDataFromResult
-{
PGbytea data;
+ if (!_result || !_type) return [NSNull null];
+
if (!PQgetf(_result, _row, PGPostgresResultValueByteA, _column)) return [NSNull null];
- if (!data.data || !data.len) return [NSNull null];
+ if (!data.data || !data.len) return [NSData data];
return [NSData dataWithBytes:data.data length:data.len];
}
diff --git a/Frameworks/PostgresKit/Source/PGPostgresTypes.h b/Frameworks/PostgresKit/Source/PGPostgresTypes.h
index 993e824d..c5812c4e 100644
--- a/Frameworks/PostgresKit/Source/PGPostgresTypes.h
+++ b/Frameworks/PostgresKit/Source/PGPostgresTypes.h
@@ -26,12 +26,11 @@
typedef Oid PGPostgresOid;
// See PostgreSQL source: include/catalog/pg_type.h
-
enum
{
// BOOL
PGPostgresOidBool = 16, // NumberHandler => NSNumber
- PGPostgresOidByteData = 17, // Currently not supported
+ PGPostgresOidByteData = 17, // BinaryHandler => NSData
// Text
PGPostgresOidName = 19, // StringHandler => NSString