commit 71b69f108ed08923c57706a66ecea6fb92bc0156
parent 39a9f7d6f0eec7c9c47c1563e04f1b1bba6e754c
Author: Joris Vink <joris@coders.se>
Date: Tue, 1 Apr 2014 21:44:32 +0200
Fixup the actual example
Diffstat:
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/contrib/modules/pgsql_test/src/pgsql_test.c b/contrib/modules/pgsql_test/src/pgsql_test.c
@@ -25,7 +25,8 @@ int serve_pgsql_test(struct http_request *);
int
serve_pgsql_test(struct http_request *req)
{
- //int r;
+ int r, i;
+ char *col1, *col2;
KORE_PGSQL(req, "SELECT * FROM test", 0, {
if (req->pgsql[0]->state == KORE_PGSQL_STATE_ERROR) {
@@ -34,8 +35,14 @@ serve_pgsql_test(struct http_request *req)
req->pgsql[0]->error : "unknown");
http_response(req, 500, "fail", 4);
return (KORE_RESULT_OK);
- } else {
- //r = kore_pgsql_ntuples(req, 0);
+ }
+
+ r = kore_pgsql_ntuples(req->pgsql[0]);
+ for (i = 0; i < r; i++) {
+ col1 = kore_pgsql_getvalue(req->pgsql[0], i, 0);
+ col2 = kore_pgsql_getvalue(req->pgsql[0], i, 1);
+
+ kore_log(LOG_NOTICE, "%s and %s", col1, col2);
}
});