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];
|
command: command];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PQresultStatus(result) == PGRES_TUPLES_OK)
|
switch (PQresultStatus(result)) {
|
||||||
|
case PGRES_TUPLES_OK:
|
||||||
return [PGResult PG_resultWithResult: result];
|
return [PGResult PG_resultWithResult: result];
|
||||||
|
case PGRES_COMMAND_OK:
|
||||||
PQclear(result);
|
PQclear(result);
|
||||||
return nil;
|
return nil;
|
||||||
|
default:
|
||||||
|
PQclear(result);
|
||||||
|
@throw [PGCommandFailedException
|
||||||
|
exceptionWithClass: [self class]
|
||||||
|
connection: self
|
||||||
|
command: command];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (PGResult*)executeCommand: (OFConstantString*)command
|
- (PGResult*)executeCommand: (OFConstantString*)command
|
||||||
|
@ -124,19 +132,19 @@
|
||||||
|
|
||||||
[pool release];
|
[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);
|
PQclear(result);
|
||||||
@throw [PGCommandFailedException
|
@throw [PGCommandFailedException
|
||||||
exceptionWithClass: [self class]
|
exceptionWithClass: [self class]
|
||||||
connection: self
|
connection: self
|
||||||
command: command];
|
command: command];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PQresultStatus(result) == PGRES_TUPLES_OK)
|
|
||||||
return [PGResult PG_resultWithResult: result];
|
|
||||||
|
|
||||||
PQclear(result);
|
|
||||||
return nil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)insertRow: (OFDictionary*)row
|
- (void)insertRow: (OFDictionary*)row
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue