ObjPgSQL  Check-in [b80a03bd2f]

Overview
Comment:Adjust to ObjFW changes
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: b80a03bd2fd4ff11dc0d9c7ce330695ebc060f78034b9ade2d7eb53d88c7bb80
User & Date: js on 2016-02-21 11:08:17
Other Links: manifest | tags
Context
2017-01-22
04:41
Update buildsys check-in: e5ac3ed936 user: js tags: trunk
2016-02-21
11:08
Adjust to ObjFW changes check-in: b80a03bd2f user: js tags: trunk
2015-09-06
16:17
Adjust to ObjFW changes check-in: 8af0a7a766 user: js tags: trunk
Changes

Modified src/PGConnection.h from [37db765c44] to [68ece51d08].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <libpq-fe.h>

#import <ObjFW/ObjFW.h>

#import "PGResult.h"

@interface PGConnection: OFObject
{
	PGconn *_connnection;
	OFDictionary *_parameters;
}

#ifdef OF_HAVE_PROPERTIES
@property (copy) OFDictionary *parameters;
#endif

- (void)setParameters: (OFDictionary*)parameters;
- (OFDictionary*)parameters;
- (void)connect;
- (void)reset;
- (void)close;
- (PGResult*)executeCommand: (OFConstantString*)command;
- (PGResult*)executeCommand: (OFConstantString*)command
		 parameters: (id)firstParameter, ... OF_SENTINEL;
- (PGconn*)PG_connection;
- (void)insertRow: (OFDictionary*)row
	intoTable: (OFString*)table;
- (void)insertRows: (OFArray*)rows
	 intoTable: (OFString*)table;
@end












<

<

<
<












1
2
3
4
5
6
7
8
9
10
11
12

13

14


15
16
17
18
19
20
21
22
23
24
25
26
#include <libpq-fe.h>

#import <ObjFW/ObjFW.h>

#import "PGResult.h"

@interface PGConnection: OFObject
{
	PGconn *_connnection;
	OFDictionary *_parameters;
}


@property (copy) OFDictionary *parameters;




- (void)connect;
- (void)reset;
- (void)close;
- (PGResult*)executeCommand: (OFConstantString*)command;
- (PGResult*)executeCommand: (OFConstantString*)command
		 parameters: (id)firstParameter, ... OF_SENTINEL;
- (PGconn*)PG_connection;
- (void)insertRow: (OFDictionary*)row
	intoTable: (OFString*)table;
- (void)insertRows: (OFArray*)rows
	 intoTable: (OFString*)table;
@end

Modified src/PGConnection.m from [85877956d2] to [66118a42be].

1
2
3
4
5
6


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import "PGConnection.h"

#import "PGConnectionFailedException.h"
#import "PGCommandFailedException.h"

@implementation PGConnection


- (void)dealloc
{
	[_parameters release];

	[self close];

	[super dealloc];
}

- (void)setParameters: (OFDictionary*)parameters
{
	OF_SETTER(_parameters, parameters, YES, YES)
}

- (OFDictionary*)parameters
{
	OF_GETTER(_parameters, YES)
}

- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFEnumerator *keyEnumerator = [_parameters keyEnumerator];
	OFEnumerator *objectEnumerator = [_parameters objectEnumerator];
	OFMutableString *connectionInfo = nil;
	OFString *key, *object;






>
>









<
<
<
<
<
<
<
<
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17










18
19
20
21
22
23
24
#import "PGConnection.h"

#import "PGConnectionFailedException.h"
#import "PGCommandFailedException.h"

@implementation PGConnection
@synthesize parameters = _parameters;

- (void)dealloc
{
	[_parameters release];

	[self close];

	[super dealloc];
}











- (void)connect
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFEnumerator *keyEnumerator = [_parameters keyEnumerator];
	OFEnumerator *objectEnumerator = [_parameters objectEnumerator];
	OFMutableString *connectionInfo = nil;
	OFString *key, *object;

Modified src/exceptions/PGCommandFailedException.h from [4d78dea5a5] to [c0757cbfd8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#import "PGException.h"

@interface PGCommandFailedException: PGException
{
	OFString *_command;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy, nonatomic) OFString *command;
#endif

+ (instancetype)exceptionWithConnection: (PGConnection*)connection
				command: (OFString*)command;
- initWithConnection: (PGConnection*)connection
	     command: (OFString*)command;
- (OFString*)command;
@end







<
|
<





<

1
2
3
4
5
6
7

8

9
10
11
12
13

14
#import "PGException.h"

@interface PGCommandFailedException: PGException
{
	OFString *_command;
}


@property (readonly, copy) OFString *command;


+ (instancetype)exceptionWithConnection: (PGConnection*)connection
				command: (OFString*)command;
- initWithConnection: (PGConnection*)connection
	     command: (OFString*)command;

@end

Modified src/exceptions/PGCommandFailedException.m from [2780d9067f] to [7e22faf8ff].

1
2
3


4
5
6
7
8
9
10
#import "PGCommandFailedException.h"

@implementation PGCommandFailedException


+ (instancetype)exceptionWithConnection: (PGConnection*)connection
				command: (OFString*)command
{
	return [[[self alloc] initWithConnection: connection
					 command: command] autorelease];
}




>
>







1
2
3
4
5
6
7
8
9
10
11
12
#import "PGCommandFailedException.h"

@implementation PGCommandFailedException
@synthesize command = _command;

+ (instancetype)exceptionWithConnection: (PGConnection*)connection
				command: (OFString*)command
{
	return [[[self alloc] initWithConnection: connection
					 command: command] autorelease];
}

31
32
33
34
35
36
37
38
39
40
41
42
43
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"A PostgreSQL command failed: %@\n"
					   @"Command: %@", _error, _command];
}

- (OFString*)command
{
	OF_GETTER(_command, NO)
}
@end







<
<
<
<
<

33
34
35
36
37
38
39





40
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"A PostgreSQL command failed: %@\n"
					   @"Command: %@", _error, _command];
}





@end

Modified src/exceptions/PGException.h from [9572250036] to [f5eecc1954].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#import <ObjFW/ObjFW.h>

#import "PGConnection.h"

@interface PGException: OFException
{
	PGConnection *_connection;
	OFString *_error;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, retain, nonatomic) PGConnection *connection;
#endif

+ (instancetype)exceptionWithConnection: (PGConnection*)connection;
- initWithConnection: (PGConnection*)connection;
- (PGConnection*)connection;
@end










<
|
<



<

1
2
3
4
5
6
7
8
9
10

11

12
13
14

15
#import <ObjFW/ObjFW.h>

#import "PGConnection.h"

@interface PGException: OFException
{
	PGConnection *_connection;
	OFString *_error;
}


@property (readonly, retain) PGConnection *connection;


+ (instancetype)exceptionWithConnection: (PGConnection*)connection;
- initWithConnection: (PGConnection*)connection;

@end

Modified src/exceptions/PGException.m from [4f6df79034] to [3b03b54ad4].

1
2
3


4
5
6
7
8
9
10
#import "PGException.h"

@implementation PGException


+ (instancetype)exceptionWithConnection: (PGConnection*)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
}

- initWithConnection: (PGConnection*)connection
{



>
>







1
2
3
4
5
6
7
8
9
10
11
12
#import "PGException.h"

@implementation PGException
@synthesize connection = _connection;

+ (instancetype)exceptionWithConnection: (PGConnection*)connection
{
	return [[[self alloc] initWithConnection: connection] autorelease];
}

- initWithConnection: (PGConnection*)connection
{
32
33
34
35
36
37
38
39
40
41
42
43
44
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"A PostgreSQL operation failed: %@",
					   _error];
}

- (PGConnection*)connection
{
	OF_GETTER(_connection, NO)
}
@end







<
<
<
<
<

34
35
36
37
38
39
40





41
}

- (OFString*)description
{
	return [OFString stringWithFormat: @"A PostgreSQL operation failed: %@",
					   _error];
}





@end