From a5135f45289c8106f7afd86d6d3cbdc5e38ef5b1 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Fri, 10 Jun 2005 06:32:36 +0000 Subject: [PATCH] Patch from zhao ming sen. --- ext/pdo_dblib/dblib_stmt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/pdo_dblib/dblib_stmt.c b/ext/pdo_dblib/dblib_stmt.c index f5bfa71cd4..68b0f287f1 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; -- 2.50.1