commit e1be630b841d080d6cc697bad0f325c002136664
parent 3b09683f5cdded942c7bb8159395d03f6077aed6
Author: Joris Vink <joris@coders.se>
Date: Sun, 28 Sep 2014 23:03:49 +0200
Add kore_pgsql_getlength() which will return length of a column.
Diffstat:
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/includes/pgsql.h b/includes/pgsql.h
@@ -56,6 +56,7 @@ int kore_pgsql_ntuples(struct kore_pgsql *);
void kore_pgsql_logerror(struct kore_pgsql *);
void kore_pgsql_queue_remove(struct http_request *);
char *kore_pgsql_getvalue(struct kore_pgsql *, int, int);
+int kore_pgsql_getlength(struct kore_pgsql *, int, int);
#define KORE_PGSQL_STATE_INIT 1
#define KORE_PGSQL_STATE_WAIT 2
diff --git a/src/pgsql.c b/src/pgsql.c
@@ -228,6 +228,12 @@ kore_pgsql_ntuples(struct kore_pgsql *pgsql)
return (PQntuples(pgsql->result));
}
+int
+kore_pgsql_getlength(struct kore_pgsql *pgsql, int row, int col)
+{
+ return (PQgetlength(pgsql->result, row, col));
+}
+
char *
kore_pgsql_getvalue(struct kore_pgsql *pgsql, int row, int col)
{