From fee0c54fdbba51cbb12287d236196cf333de5360 Mon Sep 17 00:00:00 2001 From: Anthony Tuininga Date: Mon, 25 Jun 2018 15:55:42 -0600 Subject: [PATCH] Ensure that the row count for queries is reset to zero when the statement is executed (https://github.com/oracle/python-cx_Oracle/issues/193). --- src/dpiStmt.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/dpiStmt.c b/src/dpiStmt.c index cf93727e..e1c24e7c 100644 --- a/src/dpiStmt.c +++ b/src/dpiStmt.c @@ -605,11 +605,13 @@ static int dpiStmt__execute(dpiStmt *stmt, uint32_t numIters, } } - // create query variables (if applicable) - if (stmt->statementType == DPI_STMT_TYPE_SELECT && - !(mode & DPI_MODE_EXEC_PARSE_ONLY) && - dpiStmt__createQueryVars(stmt, error) < 0) - return DPI_FAILURE; + // create query variables (if applicable) and reset row count to zero + if (stmt->statementType == DPI_STMT_TYPE_SELECT) { + stmt->rowCount = 0; + if (!(mode & DPI_MODE_EXEC_PARSE_ONLY) && + dpiStmt__createQueryVars(stmt, error) < 0) + return DPI_FAILURE; + } return DPI_SUCCESS; }