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
45
46
47
48
49
50
51
52
53
|
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
45
46
47
48
49
|
-
-
-
+
+
+
-
-
+
+
-
+
-
+
-
-
-
+
-
-
-
+
+
-
-
+
|
#import "PGCommandFailedException.h"
@implementation PGCommandFailedException
+ exceptionWithClass: (Class)class
connection: (PGConnection*)connection
command: (OFString*)command
{
return [[[self alloc] initWithClass: class
connection: connection
command: command] autorelease];
}
- initWithClass: (Class)class_
connection: (PGConnection*)connection_
command: (OFString*)command_
- initWithClass: (Class)class
connection: (PGConnection*)connection
command: (OFString*)command
{
self = [super initWithClass: class_
connection: connection_];
self = [super initWithClass: class
connection: connection];
@try {
command = [command_ copy];
_command = [command copy];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[command release];
[_command release];
[super dealloc];
}
- (OFString*)description
{
if (description != nil)
return description;
return [OFString stringWithFormat:
description = [[OFString alloc] initWithFormat:
@"A PostgreSQL command in class %@ failed: %s\nCommand: %@",
inClass, PQerrorMessage([connection PG_connection]), command];
[self inClass], PQerrorMessage([_connection PG_connection]),
_command];
return description;
}
- (OFString*)command
{
OF_GETTER(command, NO)
OF_GETTER(_command, NO)
}
@end
|