summaryrefslogtreecommitdiff
path: root/ext/pdo_dblib/dblib_stmt.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-06-10 06:32:36 (GMT)
committerWez Furlong <wez@php.net>2005-06-10 06:32:36 (GMT)
commita5135f45289c8106f7afd86d6d3cbdc5e38ef5b1 (patch)
treecb52dd3c69b46e3707d5df7411fc2be4e3a62150 /ext/pdo_dblib/dblib_stmt.c
parentfcff6a079a7badbf05055ce3425b8981db244385 (diff)
downloadphp-a5135f45289c8106f7afd86d6d3cbdc5e38ef5b1.tar.gz
Patch from zhao ming sen.
Diffstat (limited to 'ext/pdo_dblib/dblib_stmt.c')
-rw-r--r--ext/pdo_dblib/dblib_stmt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c
index f5bfa71..68b0f28 100644
--- a/ext/pdo_dblib/dblib_stmt.c
+++ b/ext/pdo_dblib/dblib_stmt.c
@@ -95,6 +95,10 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
ret = dbnextrow(H->link);
+ if (ret == NO_MORE_ROWS) {
+ return 0;
+ }
+
if (!S->cols) {
S->ncols = dbnumcols(H->link);
@@ -133,7 +137,7 @@ static int pdo_dblib_stmt_execute(pdo_stmt_t *stmt TSRMLS_DC)
S->rows = erealloc(S->rows, arows * size);
}
for (i = 0; i < S->ncols; i++) {
- pdo_dblib_colval *val = &S->rows[S->nrows] + i;
+ pdo_dblib_colval *val = &S->rows[S->nrows * S->ncols + i];
switch (S->cols[i].coltype) {
case SQLCHAR:
@@ -226,7 +230,7 @@ static int pdo_dblib_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr,
unsigned long *len, int *caller_frees TSRMLS_DC)
{
pdo_dblib_stmt *S = (pdo_dblib_stmt*)stmt->driver_data;
- pdo_dblib_colval *val = &S->rows[S->current] + colno;
+ pdo_dblib_colval *val = &S->rows[S->current * S->ncols + colno];
*ptr = val->data;
*len = val->len;