@@ -1,6 +1,9 @@ #import "PGConnection.h" +#import "PGConnection+Private.h" +#import "PGResult.h" +#import "PGResult+Private.h" #import "PGConnectionFailedException.h" #import "PGCommandFailedException.h" @implementation PGConnection @@ -32,36 +35,36 @@ else connectionInfo = [OFMutableString stringWithFormat: @"%@=%@", key, object]; } - if ((_connnection = PQconnectdb([connectionInfo UTF8String])) == NULL) + if ((_connection = PQconnectdb([connectionInfo UTF8String])) == NULL) @throw [OFOutOfMemoryException exception]; - if (PQstatus(_connnection) == CONNECTION_BAD) + if (PQstatus(_connection) == CONNECTION_BAD) @throw [PGConnectionFailedException exceptionWithConnection: self]; objc_autoreleasePoolPop(pool); } - (void)reset { - PQreset(_connnection); + PQreset(_connection); } - (void)close { - if (_connnection != NULL) - PQfinish(_connnection); + if (_connection != NULL) + PQfinish(_connection); - _connnection = NULL; + _connection = NULL; } - (PGResult *)executeCommand: (OFConstantString *)command { - PGresult *result = PQexec(_connnection, [command UTF8String]); + PGresult *result = PQexec(_connection, [command UTF8String]); if (PQresultStatus(result) == PGRES_FATAL_ERROR) { PQclear(result); @throw [PGCommandFailedException exceptionWithConnection: self @@ -124,11 +127,11 @@ else values[i++] = [[parameter description] UTF8String]; } while ((parameter = va_arg(args, id)) != nil); - result = PQexecParams(_connnection, [command UTF8String], + result = PQexecParams(_connection, [command UTF8String], argsCount, NULL, values, NULL, NULL, 0); } @finally { [self freeMemory: values]; } @@ -192,11 +195,11 @@ [command appendFormat: @"$%zd", ++i]; } [command appendString: @")"]; - result = PQexecParams(_connnection, [command UTF8String], + result = PQexecParams(_connection, [command UTF8String], (int)count, NULL, values, NULL, NULL, 0); } @finally { [self freeMemory: values]; } @@ -220,8 +223,8 @@ intoTable: table]; } - (PGconn *)PG_connection { - return _connnection; + return _connection; } @end