ObjPgSQL/exceptions/PGException.m
Jonathan Schleifer b3eaf2f272 Prefix all ivars with an underscore.
FossilOrigin-Name: 8c8a4313228bba7114d582a6802a2df53a1fb357f5c0805ae58531dd4c799d8c
2013-02-13 23:40:58 +00:00

39 lines
706 B
Objective-C

#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