summaryrefslogtreecommitdiff
path: root/dbd
diff options
context:
space:
mode:
authorbojan <bojan@13f79535-47bb-0310-9956-ffa450edef68>2008-05-18 08:54:09 +0000
committerbojan <bojan@13f79535-47bb-0310-9956-ffa450edef68>2008-05-18 08:54:09 +0000
commit547f64ad635d12f8a11e5dada2bfcd7ef51dc808 (patch)
tree25c084de5bc5e8fcacc1d22c53faabb711b204b6 /dbd
parentaf1d72402e6f4f0fa434239588ed27f4fef90478 (diff)
downloadlibapr-util-547f64ad635d12f8a11e5dada2bfcd7ef51dc808.tar.gz
Make sure PGSQL and MySQL drivers count rows from 1, not 0
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@657516 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dbd')
-rw-r--r--dbd/apr_dbd_mysql.c4
-rw-r--r--dbd/apr_dbd_pgsql.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/dbd/apr_dbd_mysql.c b/dbd/apr_dbd_mysql.c
index 58d2aad3..9349e4e1 100644
--- a/dbd/apr_dbd_mysql.c
+++ b/dbd/apr_dbd_mysql.c
@@ -269,7 +269,7 @@ static int dbd_mysql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
if (res->statement) {
if (res->random) {
if (rownum >= 0) {
- mysql_stmt_data_seek(res->statement, (my_ulonglong)rownum);
+ mysql_stmt_data_seek(res->statement, (my_ulonglong) --rownum);
}
}
ret = mysql_stmt_fetch(res->statement);
@@ -288,7 +288,7 @@ static int dbd_mysql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
else {
if (res->random) {
if (rownum >= 0) {
- mysql_data_seek(res->res, (my_ulonglong) rownum);
+ mysql_data_seek(res->res, (my_ulonglong) --rownum);
}
}
r = mysql_fetch_row(res->res);
diff --git a/dbd/apr_dbd_pgsql.c b/dbd/apr_dbd_pgsql.c
index 20908a8c..cb3cfae9 100644
--- a/dbd/apr_dbd_pgsql.c
+++ b/dbd/apr_dbd_pgsql.c
@@ -231,14 +231,14 @@ static int dbd_pgsql_get_row(apr_pool_t *pool, apr_dbd_results_t *res,
row = apr_palloc(pool, sizeof(apr_dbd_row_t));
*rowp = row;
row->res = res;
- row->n = sequential ? 0 : rownum;
+ row->n = sequential ? 0 : --rownum;
}
else {
if ( sequential ) {
++row->n;
}
else {
- row->n = rownum;
+ row->n = --rownum;
}
}