Change prefix to PGSQL

Two letter prefixes are too risky to cause collisions.

FossilOrigin-Name: 77c26b4fcecfc3e46c1e0b9412a9a88d0139604e2ad45e54b0c8734d464ea2c6
This commit is contained in:
Jonathan Schleifer 2024-08-11 18:00:52 +00:00
parent 181e9b2e62
commit d205d00765
20 changed files with 112 additions and 111 deletions

View file

@ -13,5 +13,5 @@ PREDEFINED = OF_DESIGNATED_INITIALIZER= \
OF_SENTINEL OF_SENTINEL
MACRO_EXPANSION = YES MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = YES EXPAND_ONLY_PREDEF = YES
IGNORE_PREFIX = PG IGNORE_PREFIX = PGSQL
EXTRACT_STATIC = yes EXTRACT_STATIC = yes

View file

@ -16,10 +16,10 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGResult.h" #import "PGSQLResult.h"
#import "PGResultRow.h" #import "PGSQLResultRow.h"
#import "PGConnection.h" #import "PGSQLConnection.h"
#import "PGException.h" #import "PGSQLException.h"
#import "PGCommandFailedException.h" #import "PGSQLExecuteCommandFailedException.h"
#import "PGConnectionFailedException.h" #import "PGSQLConnectionFailedException.h"

View file

@ -16,11 +16,11 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGConnection.h" #import "PGSQLConnection.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
@interface PGConnection () @interface PGSQLConnection ()
@property (readonly, nonatomic) PGconn *pg_connection; @property (readonly, nonatomic) PGconn *pg_connection;
@end @end

View file

@ -20,7 +20,7 @@
#import <ObjFW/ObjFW.h> #import <ObjFW/ObjFW.h>
#import "PGResult.h" #import "PGSQLResult.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
@ -29,14 +29,14 @@ OF_ASSUME_NONNULL_BEGIN
/** /**
* @brief A result row. * @brief A result row.
*/ */
typedef OFDictionary OF_GENERIC(OFString *, id) *PGRow; typedef OFDictionary OF_GENERIC(OFString *, id) *PGSQLRow;
/** /**
* @class PGConnection PGConnection.h ObjPgSQL/ObjPgSQL.h * @class PGSQLConnection PGSQLConnection.h ObjPgSQL/ObjPgSQL.h
* *
* @brief A connection to a database. * @brief A connection to a database.
*/ */
@interface PGConnection: OFObject @interface PGSQLConnection: OFObject
{ {
PGconn *_connection; PGconn *_connection;
OFDictionary OF_GENERIC(OFString *, OFString *) *_parameters; OFDictionary OF_GENERIC(OFString *, OFString *) *_parameters;
@ -52,7 +52,7 @@ typedef OFDictionary OF_GENERIC(OFString *, id) *PGRow;
/** /**
* @brief Connects to the database. * @brief Connects to the database.
* *
* @throw PGConnectionFailedException The connection failed * @throw PGSQLConnectionFailedException The connection failed
*/ */
- (void)connect; - (void)connect;
@ -71,9 +71,9 @@ typedef OFDictionary OF_GENERIC(OFString *, id) *PGRow;
* *
* @param command The command to execute * @param command The command to execute
* @return The result of the command, if any * @return The result of the command, if any
* @throw PGCommandFailedException Executing the command failed. * @throw PGSQLCommandFailedException Executing the command failed.
*/ */
- (nullable PGResult *)executeCommand: (OFConstantString *)command; - (nullable PGSQLResult *)executeCommand: (OFConstantString *)command;
/** /**
* @brief Executes the specified command. * @brief Executes the specified command.
@ -81,9 +81,9 @@ typedef OFDictionary OF_GENERIC(OFString *, id) *PGRow;
* @param command The command to execute * @param command The command to execute
* @param firstParameter First parameter for the command * @param firstParameter First parameter for the command
* @return The result of the command, if any * @return The result of the command, if any
* @throw PGCommandFailedException Executing the command failed. * @throw PGSQLCommandFailedException Executing the command failed.
*/ */
- (nullable PGResult *)executeCommand: (OFConstantString *)command - (nullable PGSQLResult *)executeCommand: (OFConstantString *)command
parameters: (id)firstParameter, ... OF_SENTINEL; parameters: (id)firstParameter, ... OF_SENTINEL;
@end @end

View file

@ -16,15 +16,15 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGConnection.h" #import "PGSQLConnection.h"
#import "PGConnection+Private.h" #import "PGSQLConnection+Private.h"
#import "PGResult.h" #import "PGSQLResult.h"
#import "PGResult+Private.h" #import "PGSQLResult+Private.h"
#import "PGConnectionFailedException.h" #import "PGSQLConnectionFailedException.h"
#import "PGExecuteCommandFailedException.h" #import "PGSQLExecuteCommandFailedException.h"
@implementation PGConnection @implementation PGSQLConnection
@synthesize pg_connection = _connection, parameters = _parameters; @synthesize pg_connection = _connection, parameters = _parameters;
- (instancetype)init - (instancetype)init
@ -73,7 +73,7 @@
@throw [OFOutOfMemoryException exception]; @throw [OFOutOfMemoryException exception];
if (PQstatus(_connection) == CONNECTION_BAD) if (PQstatus(_connection) == CONNECTION_BAD)
@throw [PGConnectionFailedException @throw [PGSQLConnectionFailedException
exceptionWithConnection: self]; exceptionWithConnection: self];
objc_autoreleasePoolPop(pool); objc_autoreleasePoolPop(pool);
@ -92,32 +92,32 @@
_connection = NULL; _connection = NULL;
} }
- (PGResult *)executeCommand: (OFConstantString *)command - (PGSQLResult *)executeCommand: (OFConstantString *)command
{ {
PGresult *result = PQexec(_connection, command.UTF8String); PGresult *result = PQexec(_connection, command.UTF8String);
if (PQresultStatus(result) == PGRES_FATAL_ERROR) { if (PQresultStatus(result) == PGRES_FATAL_ERROR) {
PQclear(result); PQclear(result);
@throw [PGExecuteCommandFailedException @throw [PGSQLExecuteCommandFailedException
exceptionWithConnection: self exceptionWithConnection: self
command: command]; command: command];
} }
switch (PQresultStatus(result)) { switch (PQresultStatus(result)) {
case PGRES_TUPLES_OK: case PGRES_TUPLES_OK:
return [PGResult pg_resultWithResult: result]; return [PGSQLResult pg_resultWithResult: result];
case PGRES_COMMAND_OK: case PGRES_COMMAND_OK:
PQclear(result); PQclear(result);
return nil; return nil;
default: default:
PQclear(result); PQclear(result);
@throw [PGExecuteCommandFailedException @throw [PGSQLExecuteCommandFailedException
exceptionWithConnection: self exceptionWithConnection: self
command: command]; command: command];
} }
} }
- (PGResult *)executeCommand: (OFConstantString *)command - (PGSQLResult *)executeCommand: (OFConstantString *)command
parameters: (id)parameter, ... parameters: (id)parameter, ...
{ {
void *pool = objc_autoreleasePoolPush(); void *pool = objc_autoreleasePoolPush();
@ -167,13 +167,13 @@
switch (PQresultStatus(result)) { switch (PQresultStatus(result)) {
case PGRES_TUPLES_OK: case PGRES_TUPLES_OK:
return [PGResult pg_resultWithResult: result]; return [PGSQLResult pg_resultWithResult: result];
case PGRES_COMMAND_OK: case PGRES_COMMAND_OK:
PQclear(result); PQclear(result);
return nil; return nil;
default: default:
PQclear(result); PQclear(result);
@throw [PGExecuteCommandFailedException @throw [PGSQLExecuteCommandFailedException
exceptionWithConnection: self exceptionWithConnection: self
command: command]; command: command];
} }

View file

@ -16,11 +16,11 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGResult.h" #import "PGSQLResult.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
@interface PGResult () @interface PGSQLResult ()
@property (readonly, nonatomic) PGresult *pg_result; @property (readonly, nonatomic) PGresult *pg_result;
+ (instancetype)pg_resultWithResult: (PGresult *)result; + (instancetype)pg_resultWithResult: (PGresult *)result;

View file

@ -22,17 +22,17 @@
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
@class PGResultRow; @class PGSQLResultRow;
/** /**
* @class PGResult PGResult.h ObjPgSQL/ObjPgSQL.h * @class PGSQLResult PGSQLResult.h ObjPgSQL/ObjPgSQL.h
* *
* @brief A PostgreSQL result. * @brief A PostgreSQL result.
* *
* This is a regular OFArray, where each entry in the array represents a result * This is a regular OFArray, where each entry in the array represents a result
* row. * row.
*/ */
@interface PGResult: OFArray OF_GENERIC(PGResultRow *) @interface PGSQLResult: OFArray OF_GENERIC(PGSQLResultRow *)
{ {
PGresult *_result; PGresult *_result;
} }

View file

@ -16,12 +16,12 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGResult.h" #import "PGSQLResult.h"
#import "PGResult+Private.h" #import "PGSQLResult+Private.h"
#import "PGResultRow.h" #import "PGSQLResultRow.h"
#import "PGResultRow+Private.h" #import "PGSQLResultRow+Private.h"
@implementation PGResult @implementation PGSQLResult
@synthesize pg_result = _result; @synthesize pg_result = _result;
+ (instancetype)pg_resultWithResult: (PGresult *)result + (instancetype)pg_resultWithResult: (PGresult *)result
@ -56,6 +56,6 @@
if (index > LONG_MAX || (long)index > PQntuples(_result)) if (index > LONG_MAX || (long)index > PQntuples(_result))
@throw [OFOutOfRangeException exception]; @throw [OFOutOfRangeException exception];
return [PGResultRow pg_rowWithResult: self row: (int)index]; return [PGSQLResultRow pg_rowWithResult: self row: (int)index];
} }
@end @end

View file

@ -16,13 +16,13 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGResultRow.h" #import "PGSQLResultRow.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
@interface PGResultRow () @interface PGSQLResultRow ()
+ (instancetype)pg_rowWithResult: (PGResult *)result row: (int)row; + (instancetype)pg_rowWithResult: (PGSQLResult *)result row: (int)row;
- (instancetype)pg_initWithResult: (PGResult *)result row: (int)row; - (instancetype)pg_initWithResult: (PGSQLResult *)result row: (int)row;
@end @end
OF_ASSUME_NONNULL_END OF_ASSUME_NONNULL_END

View file

@ -20,21 +20,21 @@
#import <ObjFW/ObjFW.h> #import <ObjFW/ObjFW.h>
#import "PGResult.h" #import "PGSQLResult.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
/** /**
* @class PGResult PGResult.h ObjPgSQL/ObjPgSQL.h * @class PGSQLResult PGSQLResult.h ObjPgSQL/ObjPgSQL.h
* *
* @brief A PostgreSQL result row. * @brief A PostgreSQL result row.
* *
* This is a regular OFDictionary, where each entry in the dictionary * This is a regular OFDictionary, where each entry in the dictionary
* represents a column of the result row. * represents a column of the result row.
*/ */
@interface PGResultRow: OFDictionary OF_GENERIC(OFString *, id) @interface PGSQLResultRow: OFDictionary OF_GENERIC(OFString *, id)
{ {
PGResult *_result; PGSQLResult *_result;
PGresult *_res; PGresult *_res;
int _row; int _row;
} }

View file

@ -16,8 +16,8 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGResultRow.h" #import "PGSQLResultRow.h"
#import "PGResult+Private.h" #import "PGSQLResult+Private.h"
static id static id
convertType(PGresult *res, int column, OFString *string) convertType(PGresult *res, int column, OFString *string)
@ -46,29 +46,29 @@ convertType(PGresult *res, int column, OFString *string)
return string; return string;
} }
@interface PGResultRowEnumerator: OFEnumerator @interface PGSQLResultRowEnumerator: OFEnumerator
{ {
PGResult *_result; PGSQLResult *_result;
PGresult *_res; PGresult *_res;
int _row, _pos, _count; int _row, _pos, _count;
} }
- (instancetype)initWithResult: (PGResult*)result row: (int)row; - (instancetype)initWithResult: (PGSQLResult*)result row: (int)row;
@end @end
@interface PGResultRowKeyEnumerator: PGResultRowEnumerator @interface PGSQLResultRowKeyEnumerator: PGSQLResultRowEnumerator
@end @end
@interface PGResultRowObjectEnumerator: PGResultRowEnumerator @interface PGSQLResultRowObjectEnumerator: PGSQLResultRowEnumerator
@end @end
@implementation PGResultRow @implementation PGSQLResultRow
+ (instancetype)pg_rowWithResult: (PGResult *)result row: (int)row + (instancetype)pg_rowWithResult: (PGSQLResult *)result row: (int)row
{ {
return [[[self alloc] pg_initWithResult: result row: row] autorelease]; return [[[self alloc] pg_initWithResult: result row: row] autorelease];
} }
- (instancetype)pg_initWithResult: (PGResult *)result row: (int)row - (instancetype)pg_initWithResult: (PGSQLResult *)result row: (int)row
{ {
self = [super init]; self = [super init];
@ -115,14 +115,14 @@ convertType(PGresult *res, int column, OFString *string)
- (OFEnumerator *)keyEnumerator - (OFEnumerator *)keyEnumerator
{ {
return [[[PGResultRowKeyEnumerator alloc] return [[[PGSQLResultRowKeyEnumerator alloc]
initWithResult: _result initWithResult: _result
row: _row] autorelease]; row: _row] autorelease];
} }
- (OFEnumerator *)objectEnumerator - (OFEnumerator *)objectEnumerator
{ {
return [[[PGResultRowObjectEnumerator alloc] return [[[PGSQLResultRowObjectEnumerator alloc]
initWithResult: _result initWithResult: _result
row: _row] autorelease]; row: _row] autorelease];
} }
@ -160,8 +160,8 @@ convertType(PGresult *res, int column, OFString *string)
} }
@end @end
@implementation PGResultRowEnumerator @implementation PGSQLResultRowEnumerator
- (instancetype)initWithResult: (PGResult *)result row: (int)row - (instancetype)initWithResult: (PGSQLResult *)result row: (int)row
{ {
self = [super init]; self = [super init];
@ -186,7 +186,7 @@ convertType(PGresult *res, int column, OFString *string)
} }
@end @end
@implementation PGResultRowKeyEnumerator @implementation PGSQLResultRowKeyEnumerator
- (id)nextObject - (id)nextObject
{ {
if (_pos >= _count) if (_pos >= _count)
@ -202,7 +202,7 @@ convertType(PGresult *res, int column, OFString *string)
} }
@end @end
@implementation PGResultRowObjectEnumerator @implementation PGSQLResultRowObjectEnumerator
- (id)nextObject - (id)nextObject
{ {
id object; id object;

View file

@ -16,17 +16,17 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGException.h" #import "PGSQLException.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
/** /**
* @class PGConnectionFailedException PGConnectionFailedException.h * @class PGSQLConnectionFailedException PGSQLConnectionFailedException.h
* PgSQL/PgSQL.h * PgSQL/PgSQL.h
* *
* @brief An exception indicating that connecting to the database failed. * @brief An exception indicating that connecting to the database failed.
*/ */
@interface PGConnectionFailedException: PGException @interface PGSQLConnectionFailedException: PGSQLException
@end @end
OF_ASSUME_NONNULL_END OF_ASSUME_NONNULL_END

View file

@ -16,9 +16,9 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGConnectionFailedException.h" #import "PGSQLConnectionFailedException.h"
@implementation PGConnectionFailedException @implementation PGSQLConnectionFailedException
- (OFString *)description - (OFString *)description
{ {
return [OFString stringWithFormat: return [OFString stringWithFormat:

View file

@ -18,25 +18,25 @@
#import <ObjFW/ObjFW.h> #import <ObjFW/ObjFW.h>
#import "PGConnection.h" #import "PGSQLConnection.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
/** /**
* @class PGException PGException.h ObjPgSQL/ObjPgSQL.h * @class PGSQLException PGSQLException.h ObjPgSQL/ObjPgSQL.h
* *
* @brief A PostgreSQL exception. * @brief A PostgreSQL exception.
*/ */
@interface PGException: OFException @interface PGSQLException: OFException
{ {
PGConnection *_connection; PGSQLConnection *_connection;
OFString *_errorMessage; OFString *_errorMessage;
} }
/** /**
* @brief The connection for which the exception occurred. * @brief The connection for which the exception occurred.
*/ */
@property (readonly, nonatomic) PGConnection *connection; @property (readonly, nonatomic) PGSQLConnection *connection;
/** /**
* @brief An error message for the exception. * @brief An error message for the exception.
@ -51,7 +51,7 @@ OF_ASSUME_NONNULL_BEGIN
* @param connection The connection for which the exception occurred * @param connection The connection for which the exception occurred
* @return A new, autoreleased PostgreSQL exception * @return A new, autoreleased PostgreSQL exception
*/ */
+ (instancetype)exceptionWithConnection: (PGConnection *)connection; + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection;
- (instancetype)init OF_UNAVAILABLE; - (instancetype)init OF_UNAVAILABLE;
@ -61,7 +61,7 @@ OF_ASSUME_NONNULL_BEGIN
* @param connection The connection for which the exception occurred * @param connection The connection for which the exception occurred
* @return An initialized PostgreSQL exception * @return An initialized PostgreSQL exception
*/ */
- (instancetype)initWithConnection: (PGConnection *)connection - (instancetype)initWithConnection: (PGSQLConnection *)connection
OF_DESIGNATED_INITIALIZER; OF_DESIGNATED_INITIALIZER;
@end @end

View file

@ -16,10 +16,10 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGException.h" #import "PGSQLException.h"
#import "PGConnection+Private.h" #import "PGSQLConnection+Private.h"
@implementation PGException @implementation PGSQLException
@synthesize connection = _connection, errorMessage = _errorMessage; @synthesize connection = _connection, errorMessage = _errorMessage;
+ (instancetype)exception + (instancetype)exception
@ -27,7 +27,7 @@
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
+ (instancetype)exceptionWithConnection: (PGConnection *)connection + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection
{ {
return [[[self alloc] initWithConnection: connection] autorelease]; return [[[self alloc] initWithConnection: connection] autorelease];
} }
@ -37,7 +37,7 @@
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- (instancetype)initWithConnection: (PGConnection *)connection - (instancetype)initWithConnection: (PGSQLConnection *)connection
{ {
self = [super init]; self = [super init];

View file

@ -16,17 +16,18 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGException.h" #import "PGSQLException.h"
OF_ASSUME_NONNULL_BEGIN OF_ASSUME_NONNULL_BEGIN
/** /**
* @class PGExecuteCommandFailedException PGExecuteCommandFailedException.h * @class PGSQLExecuteCommandFailedException
* PGSQLExecuteCommandFailedException.h
* ObjPgSQL/ObjPgSQL.h * ObjPgSQL/ObjPgSQL.h
* *
* @brief An exception indicating that executing a command failed. * @brief An exception indicating that executing a command failed.
*/ */
@interface PGExecuteCommandFailedException: PGException @interface PGSQLExecuteCommandFailedException: PGSQLException
{ {
OFConstantString *_command; OFConstantString *_command;
} }
@ -36,7 +37,7 @@ OF_ASSUME_NONNULL_BEGIN
*/ */
@property (readonly, nonatomic) OFConstantString *command; @property (readonly, nonatomic) OFConstantString *command;
+ (instancetype)exceptionWithConnection: (PGConnection *)connection + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection
OF_UNAVAILABLE; OF_UNAVAILABLE;
/** /**
@ -46,10 +47,11 @@ OF_ASSUME_NONNULL_BEGIN
* @param command The command which could not be executed * @param command The command which could not be executed
* @return A new, autoreleased execute command failed exception * @return A new, autoreleased execute command failed exception
*/ */
+ (instancetype)exceptionWithConnection: (PGConnection *)connection + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection
command: (OFConstantString *)command; command: (OFConstantString *)command;
- (instancetype)initWithConnection: (PGConnection *)connection OF_UNAVAILABLE; - (instancetype)initWithConnection: (PGSQLConnection *)connection
OF_UNAVAILABLE;
/** /**
* @brief Initializes an already allocated execte command failed exception. * @brief Initializes an already allocated execte command failed exception.
@ -58,7 +60,7 @@ OF_ASSUME_NONNULL_BEGIN
* @param command The command which could not be executed * @param command The command which could not be executed
* @return An initialized execute command failed exception * @return An initialized execute command failed exception
*/ */
- (instancetype)initWithConnection: (PGConnection *)connection - (instancetype)initWithConnection: (PGSQLConnection *)connection
command: (OFConstantString *)command command: (OFConstantString *)command
OF_DESIGNATED_INITIALIZER; OF_DESIGNATED_INITIALIZER;
@end @end

View file

@ -16,29 +16,29 @@
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
#import "PGExecuteCommandFailedException.h" #import "PGSQLExecuteCommandFailedException.h"
@implementation PGExecuteCommandFailedException @implementation PGSQLExecuteCommandFailedException
@synthesize command = _command; @synthesize command = _command;
+ (instancetype)exceptionWithConnection: (PGConnection *)connection + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection
{ {
OF_UNRECOGNIZED_SELECTOR OF_UNRECOGNIZED_SELECTOR
} }
+ (instancetype)exceptionWithConnection: (PGConnection *)connection + (instancetype)exceptionWithConnection: (PGSQLConnection *)connection
command: (OFConstantString *)command command: (OFConstantString *)command
{ {
return [[[self alloc] initWithConnection: connection return [[[self alloc] initWithConnection: connection
command: command] autorelease]; command: command] autorelease];
} }
- (instancetype)initWithConnection: (PGConnection *)connection - (instancetype)initWithConnection: (PGSQLConnection *)connection
{ {
OF_INVALID_INIT_METHOD OF_INVALID_INIT_METHOD
} }
- (instancetype)initWithConnection: (PGConnection *)connection - (instancetype)initWithConnection: (PGSQLConnection *)connection
command: (OFConstantString *)command command: (OFConstantString *)command
{ {
self = [super initWithConnection: connection]; self = [super initWithConnection: connection];

View file

@ -1,5 +1,5 @@
exceptions_sources = files( exceptions_sources = files(
'PGConnectionFailedException.m', 'PGSQLConnectionFailedException.m',
'PGException.m', 'PGSQLException.m',
'PGExecuteCommandFailedException.m', 'PGSQLExecuteCommandFailedException.m',
) )

View file

@ -3,9 +3,9 @@ fs = import('fs')
subdir('exceptions') subdir('exceptions')
sources = files( sources = files(
'PGConnection.m', 'PGSQLConnection.m',
'PGResult.m', 'PGSQLResult.m',
'PGResultRow.m', 'PGSQLResultRow.m',
) )
objpgsql = library('objpgsql', objpgsql = library('objpgsql',

View file

@ -18,12 +18,11 @@
#import <ObjFW/ObjFW.h> #import <ObjFW/ObjFW.h>
#import "PGConnection.h" #import "ObjPgSQL.h"
#import "PGConnectionFailedException.h"
@interface Test: OFObject <OFApplicationDelegate> @interface Test: OFObject <OFApplicationDelegate>
{ {
PGConnection *_connection; PGSQLConnection *_connection;
} }
@end @end
@ -34,9 +33,9 @@ OF_APPLICATION_DELEGATE(Test)
{ {
OFString *username = OFString *username =
[[OFApplication environment] objectForKey: @"USER"]; [[OFApplication environment] objectForKey: @"USER"];
PGResult *result; PGSQLResult *result;
_connection = [[PGConnection alloc] init]; _connection = [[PGSQLConnection alloc] init];
[_connection setParameters: [_connection setParameters:
[OFDictionary dictionaryWithKeysAndObjects: @"user", username, [OFDictionary dictionaryWithKeysAndObjects: @"user", username,
@"dbname", username, @"dbname", username,