summaryrefslogtreecommitdiff
path: root/dbd
diff options
context:
space:
mode:
authorniq <niq@13f79535-47bb-0310-9956-ffa450edef68>2006-03-31 12:09:39 +0000
committerniq <niq@13f79535-47bb-0310-9956-ffa450edef68>2006-03-31 12:09:39 +0000
commitbfbc276c12f1cf0c7835c57243ba9b258c1a8169 (patch)
treef5b03caab13e62c70b263342a8db462920d7d401 /dbd
parent22272f2aa79d6cc724275f48bc243476b8d99bf4 (diff)
downloadlibapr-util-bfbc276c12f1cf0c7835c57243ba9b258c1a8169.tar.gz
apr_dbd_get_name driver patches from Bojan Smojver
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@390399 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dbd')
-rw-r--r--dbd/apr_dbd_pgsql.c6
-rw-r--r--dbd/apr_dbd_sqlite2.c10
-rw-r--r--dbd/apr_dbd_sqlite3.c10
3 files changed, 26 insertions, 0 deletions
diff --git a/dbd/apr_dbd_pgsql.c b/dbd/apr_dbd_pgsql.c
index dda894a4..a283cfc1 100644
--- a/dbd/apr_dbd_pgsql.c
+++ b/dbd/apr_dbd_pgsql.c
@@ -116,6 +116,11 @@ static int dbd_pgsql_select(apr_pool_t *pool, apr_dbd_t *sql,
return 0;
}
+static const char *dbd_pgsql_get_name(const apr_dbd_results_t *res, int n)
+{
+ return (res->res ? PQfname(res->res, n) : NULL);
+}
+
static int dbd_pgsql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
apr_dbd_row_t **rowp, int rownum)
{
@@ -640,5 +645,6 @@ APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_pgsql_driver = {
dbd_pgsql_pvselect,
dbd_pgsql_pquery,
dbd_pgsql_pselect,
+ dbd_pgsql_get_name
};
#endif
diff --git a/dbd/apr_dbd_sqlite2.c b/dbd/apr_dbd_sqlite2.c
index 0444d004..c741a236 100644
--- a/dbd/apr_dbd_sqlite2.c
+++ b/dbd/apr_dbd_sqlite2.c
@@ -114,6 +114,15 @@ static int dbd_sqlite_select(apr_pool_t * pool, apr_dbd_t * sql,
return ret;
}
+static const char *dbd_sqlite_get_name(const apr_dbd_results_t *res, int n)
+{
+ if ((n < 0) || (n >= res->sz)) {
+ return NULL;
+ }
+
+ return res->res[n];
+}
+
static int dbd_sqlite_get_row(apr_pool_t * pool, apr_dbd_results_t * res,
apr_dbd_row_t ** rowp, int rownum)
{
@@ -387,5 +396,6 @@ APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_sqlite2_driver = {
dbd_sqlite_pvselect,
dbd_sqlite_pquery,
dbd_sqlite_pselect,
+ dbd_sqlite_get_name
};
#endif
diff --git a/dbd/apr_dbd_sqlite3.c b/dbd/apr_dbd_sqlite3.c
index 2a2fea83..60d04d5f 100644
--- a/dbd/apr_dbd_sqlite3.c
+++ b/dbd/apr_dbd_sqlite3.c
@@ -186,6 +186,15 @@ static int dbd_sqlite3_select(apr_pool_t * pool, apr_dbd_t * sql, apr_dbd_result
return ret;
}
+static const char *dbd_sqlite3_get_name(const apr_dbd_results_t *res, int n)
+{
+ if ((n < 0) || (n >= res->sz)) {
+ return NULL;
+ }
+
+ return res->next_row->columns[n]->name;
+}
+
static int dbd_sqlite3_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
apr_dbd_row_t **rowp, int rownum)
{
@@ -424,5 +433,6 @@ APU_DECLARE_DATA const apr_dbd_driver_t apr_dbd_sqlite3_driver = {
dbd_sqlite3_pvselect,
dbd_sqlite3_pquery,
dbd_sqlite3_pselect,
+ dbd_sqlite3_get_name
};
#endif