Stricter error checking.
FossilOrigin-Name: cbc15fadc1bcf0dc8623f72e33d144803c4cf0d8bf740302a8915ae04cec1372
This commit is contained in:
parent
dee1a1ddde
commit
d830fda977
1 changed files with 19 additions and 11 deletions
|
@ -70,11 +70,19 @@
|
|||
command: command];
|
||||
}
|
||||
|
||||
if (PQresultStatus(result) == PGRES_TUPLES_OK)
|
||||
switch (PQresultStatus(result)) {
|
||||
case PGRES_TUPLES_OK:
|
||||
return [PGResult PG_resultWithResult: result];
|
||||
|
||||
PQclear(result);
|
||||
return nil;
|
||||
case PGRES_COMMAND_OK:
|
||||
PQclear(result);
|
||||
return nil;
|
||||
default:
|
||||
PQclear(result);
|
||||
@throw [PGCommandFailedException
|
||||
exceptionWithClass: [self class]
|
||||
connection: self
|
||||
command: command];
|
||||
}
|
||||
}
|
||||
|
||||
- (PGResult*)executeCommand: (OFConstantString*)command
|
||||
|
@ -124,19 +132,19 @@
|
|||
|
||||
[pool release];
|
||||
|
||||
if (PQresultStatus(result) == PGRES_FATAL_ERROR) {
|
||||
switch (PQresultStatus(result)) {
|
||||
case PGRES_TUPLES_OK:
|
||||
return [PGResult PG_resultWithResult: result];
|
||||
case PGRES_COMMAND_OK:
|
||||
PQclear(result);
|
||||
return nil;
|
||||
default:
|
||||
PQclear(result);
|
||||
@throw [PGCommandFailedException
|
||||
exceptionWithClass: [self class]
|
||||
connection: self
|
||||
command: command];
|
||||
}
|
||||
|
||||
if (PQresultStatus(result) == PGRES_TUPLES_OK)
|
||||
return [PGResult PG_resultWithResult: result];
|
||||
|
||||
PQclear(result);
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)insertRow: (OFDictionary*)row
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue