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
33
34
35
36
37
38
39
40
41
42
43
44
|
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
33
34
35
36
37
38
39
|
-
-
+
+
-
+
-
+
-
+
-
-
-
+
-
-
-
+
+
-
-
-
+
|
#import "PGException.h"
@implementation PGException
+ exceptionWithClass: (Class)class
connection: (PGConnection*)connection
{
return [[[self alloc] initWithClass: class
connection: connection] autorelease];
}
- initWithClass: (Class)class_
connection: (PGConnection*)connection_
- initWithClass: (Class)class
connection: (PGConnection*)connection
{
self = [super initWithClass: class_];
self = [super initWithClass: class];
connection = [connection_ retain];
_connection = [connection retain];
return self;
}
- (void)dealloc
{
[connection release];
[_connection release];
[super dealloc];
}
- (OFString*)description
{
if (description != nil)
return description;
return [OFString stringWithFormat:
description = [[OFString alloc] initWithFormat:
@"A PostgreSQL operation in class %@ failed: %s", inClass,
PQerrorMessage([connection PG_connection])];
@"A PostgreSQL operation in class %@ failed: %s", [self inClass],
PQerrorMessage([_connection PG_connection])];
return description;
}
- (PGConnection*)connection
{
OF_GETTER(connection, NO)
OF_GETTER(_connection, NO)
}
@end
|