diff options
author | stuconnolly <stuart02@gmail.com> | 2012-09-10 09:05:27 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2012-09-10 09:05:27 +0000 |
commit | eca60f20dcc8a90964999a4ed8b90cdb40965c08 (patch) | |
tree | 01147a7b571087757b03b7bcfa4e051c71f9e704 | |
parent | 668c3f691ac236bb0ce5c16314b5349c34a01eb8 (diff) | |
download | sequelpro-eca60f20dcc8a90964999a4ed8b90cdb40965c08.tar.gz sequelpro-eca60f20dcc8a90964999a4ed8b90cdb40965c08.tar.bz2 sequelpro-eca60f20dcc8a90964999a4ed8b90cdb40965c08.zip |
Return NSNull instead of nil during error checking.
-rw-r--r-- | Frameworks/PostgresKit/Source/FLXPostgresTypeDateTimeHandler.m | 8 |
1 files 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]; |