1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
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];
if (_connnection != NULL)
[self close];
PQfinish(_connnection);
[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
|
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);
|