ObjPgSQL  Check-in [52b090139e]

Overview
Comment:Add -[PGConnection close].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 52b090139e1672d79c01e1a7e3d681cd342101efbe04a6c1d4f395c6b65c797a
User & Date: js on 2013-05-18 01:37:43
Other Links: manifest | tags
Context
2013-07-23
14:11
Improve exceptions. check-in: 12b5ef483a user: js tags: trunk
2013-05-18
01:37
Add -[PGConnection close]. check-in: 52b090139e user: js tags: trunk
2013-02-14
23:30
Improve Makefile. check-in: f069ee6cec user: js tags: trunk
Changes

Modified PGConnection.h from [fdaa72966b] to [37db765c44].

14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
@property (copy) OFDictionary *parameters;
#endif

- (void)setParameters: (OFDictionary*)parameters;
- (OFDictionary*)parameters;
- (void)connect;
- (void)reset;

- (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







>









14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
@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

Modified PGConnection.m from [215cf6715b] to [81c3c0036a].

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

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

@implementation PGConnection
- (void)dealloc
{
	[_parameters release];

	if (_connnection != NULL)
		PQfinish(_connnection);

	[super dealloc];
}

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










|
<







1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
#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)
53
54
55
56
57
58
59








60
61
62
63
64
65
66
	[pool release];
}

- (void)reset
{
	PQreset(_connnection);
}









- (PGResult*)executeCommand: (OFConstantString*)command
{
	PGresult *result = PQexec(_connnection, [command UTF8String]);

	if (PQresultStatus(result) == PGRES_FATAL_ERROR) {
		PQclear(result);







>
>
>
>
>
>
>
>







52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	[pool release];
}

- (void)reset
{
	PQreset(_connnection);
}

- (void)close
{
	if (_connnection != NULL)
		PQfinish(_connnection);

	_connnection = NULL;
}

- (PGResult*)executeCommand: (OFConstantString*)command
{
	PGresult *result = PQexec(_connnection, [command UTF8String]);

	if (PQresultStatus(result) == PGRES_FATAL_ERROR) {
		PQclear(result);