Add -[PGConnection close].

FossilOrigin-Name: 52b090139e1672d79c01e1a7e3d681cd342101efbe04a6c1d4f395c6b65c797a
This commit is contained in:
Jonathan Schleifer 2013-05-18 01:37:42 +00:00
parent 228f2ecdca
commit 16dc91b0e7
2 changed files with 10 additions and 2 deletions

View file

@ -18,6 +18,7 @@
- (OFDictionary*)parameters; - (OFDictionary*)parameters;
- (void)connect; - (void)connect;
- (void)reset; - (void)reset;
- (void)close;
- (PGResult*)executeCommand: (OFConstantString*)command; - (PGResult*)executeCommand: (OFConstantString*)command;
- (PGResult*)executeCommand: (OFConstantString*)command - (PGResult*)executeCommand: (OFConstantString*)command
parameters: (id)firstParameter, ... OF_SENTINEL; parameters: (id)firstParameter, ... OF_SENTINEL;

View file

@ -8,8 +8,7 @@
{ {
[_parameters release]; [_parameters release];
if (_connnection != NULL) [self close];
PQfinish(_connnection);
[super dealloc]; [super dealloc];
} }
@ -58,6 +57,14 @@
PQreset(_connnection); PQreset(_connnection);
} }
- (void)close
{
if (_connnection != NULL)
PQfinish(_connnection);
_connnection = NULL;
}
- (PGResult*)executeCommand: (OFConstantString*)command - (PGResult*)executeCommand: (OFConstantString*)command
{ {
PGresult *result = PQexec(_connnection, [command UTF8String]); PGresult *result = PQexec(_connnection, [command UTF8String]);