Improved error reporting
This commit is contained in:
parent
6cf7b52453
commit
457b09f15c
12 changed files with 110 additions and 94 deletions
|
|
@ -115,19 +115,21 @@ Result Connection::queryParam(const QString &command, const Params ¶ms)
|
|||
}
|
||||
|
||||
|
||||
bool Connection::sendQuery(const char *query)
|
||||
void Connection::sendQuery(const char *query)
|
||||
{
|
||||
int res = PQsendQuery(conn, query);
|
||||
return res == 1;
|
||||
if (res == 0)
|
||||
throw PgConnectionError(PQerrorMessage(conn));
|
||||
}
|
||||
|
||||
bool Connection::sendQueryParams(const char * command, const Params ¶ms)
|
||||
void Connection::sendQueryParams(const char * command, const Params ¶ms)
|
||||
{
|
||||
int res = PQsendQueryParams(conn, command, params.size(), params.types(),
|
||||
params.values(), params.lengths(), params.formats(),
|
||||
0); // text format
|
||||
|
||||
return res == 1;
|
||||
if (res == 0)
|
||||
throw PgConnectionError(PQerrorMessage(conn));
|
||||
}
|
||||
|
||||
std::shared_ptr<Result> Connection::getResult()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue