mirror of https://git.kore.io/kore.git
Convert pgsql-sync example after pgsql changes.
Only check if we bound something if we're asynchronous.
This commit is contained in:
parent
59f7e85f45
commit
a3ed3bf7eb
|
@ -49,6 +49,8 @@ page(struct http_request *req)
|
|||
|
||||
req->status = HTTP_STATUS_INTERNAL_ERROR;
|
||||
|
||||
kore_pgsql_init(&sql);
|
||||
|
||||
/*
|
||||
* Initialise our kore_pgsql data structure with the database name
|
||||
* we want to connect to (note that we registered this earlier with
|
||||
|
@ -56,7 +58,7 @@ page(struct http_request *req)
|
|||
* query (KORE_PGSQL_SYNC) and we do not need to pass our http_request
|
||||
* so we pass NULL instead.
|
||||
*/
|
||||
if (!kore_pgsql_query_init(&sql, NULL, "db", KORE_PGSQL_SYNC)) {
|
||||
if (!kore_pgsql_setup(&sql, "db", KORE_PGSQL_SYNC)) {
|
||||
kore_pgsql_logerror(&sql);
|
||||
goto out;
|
||||
}
|
||||
|
|
|
@ -110,9 +110,11 @@ kore_pgsql_setup(struct kore_pgsql *pgsql, const char *dbname, int flags)
|
|||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
|
||||
if (pgsql->req == NULL && pgsql->cb == NULL) {
|
||||
pgsql_set_error(pgsql, "nothing was bound");
|
||||
return (KORE_RESULT_ERROR);
|
||||
if (flags & KORE_PGSQL_ASYNC) {
|
||||
if (pgsql->req == NULL && pgsql->cb == NULL) {
|
||||
pgsql_set_error(pgsql, "nothing was bound");
|
||||
return (KORE_RESULT_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
db = NULL;
|
||||
|
|
Loading…
Reference in New Issue