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
|
#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_
{
self = [super initWithClass: class_];
connection = [connection_ retain];
return self;
}
- (void)dealloc
{
[connection release];
[super dealloc];
}
- (OFString*)description
{
if (description != nil)
return description;
description = [[OFString alloc] initWithFormat:
@"A PostgreSQL operation in class %@ failed: %s", inClass,
PQerrorMessage([connection PG_connection])];
return description;
}
- (PGConnection*)connection
{
OF_GETTER(connection, NO)
}
@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
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
{
self = [super initWithClass: class];
_connection = [connection retain];
return self;
}
- (void)dealloc
{
[_connection release];
[super dealloc];
}
- (OFString*)description
{
return [OFString stringWithFormat:
@"A PostgreSQL operation in class %@ failed: %s", [self inClass],
PQerrorMessage([_connection PG_connection])];
}
- (PGConnection*)connection
{
OF_GETTER(_connection, NO)
}
@end
|