BOOL exec_end = FALSE, recycled = FALSE, recycle = TRUE;
SQLSMALLINT num_params;
- MYLOG(0, "entering...%x\n", flag);
+ MYLOG(0, "entering...%x %p status=%d\n", flag, stmt, stmt->status);
stmt->has_notice = 0;
conn = SC_get_conn(stmt);
* If the statement was previously described, just recycle the old result
* set that contained just the column information.
*/
- if (stmt->prepare && stmt->status == STMT_DESCRIBED)
+ if ((stmt->prepare && stmt->status == STMT_DESCRIBED) ||
+ (stmt->status == STMT_FINISHED && 0 != (flag & PODBC_RECYCLE_STATEMENT)))
{
stmt->exec_current_row = -1;
SC_recycle_statement(stmt);
goto next_param_row;
}
cleanup:
-MYLOG(0, "leaving retval=%d\n", retval);
+MYLOG(0, "leaving %p retval=%d status=%d\n", stmt, retval, stmt->status);
SC_setInsertedTable(stmt, retval);
#undef return
if (SQL_SUCCESS == retval &&
ENTER_STMT_CS(stmt);
SC_clear_error(stmt);
- flag |= PODBC_WITH_HOLD;
+ flag |= (PODBC_RECYCLE_STATEMENT | PODBC_WITH_HOLD);
if (SC_opencheck(stmt, func))
ret = SQL_ERROR;
else
{
StartRollbackState(stmt);
stmt->exec_current_row = -1;
+ //// SC_set_Result(StatementHandle, NULL);
ret = PGAPI_Execute(StatementHandle, flag);
ret = DiscardStatementSvp(stmt, ret, FALSE);
}
/* Internal flags for PGAPI_Exec... functions */
#define PODBC_WITH_HOLD 1L
#define PODBC_RDONLY (1L << 1)
+#define PODBC_RECYCLE_STATEMENT (1L << 2)
/* Flags for the error handling */
#define PODBC_ALLOW_PARTIAL_EXTRACT 1L
/* #define PODBC_ERROR_CLEAR (1L << 1) no longer used */
if (CONN_DOWN != conn->status)
conn->status = oldstatus;
self->status = STMT_FINISHED;
+MYLOG(0, "set %p STMT_FINISHED\n", self);
LEAVE_INNER_CONN_CS(func_cs_count, conn);
/* Check the status of the result */
{
self->cancel_info = 0;
self->status = STMT_FINISHED;
+MYLOG(0, "set %p STMT_FINISHED\n", self);
exeSet = TRUE;
}
LEAVE_COMMON_CS;