From eca60f20dcc8a90964999a4ed8b90cdb40965c08 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Mon, 10 Sep 2012 09:05:27 +0000 Subject: Return NSNull instead of nil during error checking. --- Frameworks/PostgresKit/Source/FLXPostgresTypeDateTimeHandler.m | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Frameworks/PostgresKit/Source/FLXPostgresTypeDateTimeHandler.m b/Frameworks/PostgresKit/Source/FLXPostgresTypeDateTimeHandler.m index 64c6f04c..2dbd6c28 100644 --- a/Frameworks/PostgresKit/Source/FLXPostgresTypeDateTimeHandler.m +++ b/Frameworks/PostgresKit/Source/FLXPostgresTypeDateTimeHandler.m @@ -107,11 +107,11 @@ static FLXPostgresOid FLXPostgresTypeDateTimeTypes[] = * * @return The NSDate representation. */ -- (NSDate *)_dateFromResult:(const PGresult *)result atRow:(NSUInteger)row column:(NSUInteger)column +- (id)_dateFromResult:(const PGresult *)result atRow:(NSUInteger)row column:(NSUInteger)column { PGdate date; - PQgetf(result, row, "%date", column, &date); + if (!PQgetf(result, row, "%date", column, &date)) return [NSNull null]; NSDateComponents *components = [[NSDateComponents alloc] init]; @@ -158,7 +158,7 @@ static FLXPostgresOid FLXPostgresTypeDateTimeTypes[] = BOOL hasTimeZone = type == FLXPostgresOidTimeTZ; - PQgetf(result, row, hasTimeZone ? "%timetz" : "%time", column, &time); + if (!PQgetf(result, row, hasTimeZone ? "%timetz" : "%time", column, &time)) return [NSNull null]; NSDateComponents *components = [[NSDateComponents alloc] init]; @@ -192,7 +192,7 @@ static FLXPostgresOid FLXPostgresTypeDateTimeTypes[] = BOOL hasTimeZone = type == FLXPostgresOidTimestampTZ; - PQgetf(result, row, hasTimeZone ? "%timstamptz" : "%timestamp", column, ×tamp); + if (!PQgetf(result, row, hasTimeZone ? "%timstamptz" : "%timestamp", column, ×tamp)) return [NSNull null]; FLXPostgresTimeTZ *timestampTZ = nil; NSDate *date = [NSDate dateWithTimeIntervalSince1970:timestamp.epoch]; -- cgit v1.2.3