{
static const char *func = "convert_escape";
RETCODE retval = SQL_SUCCESS;
- char buf[1024], key[65];
+ char buf[1024], buf_small[128], key[65];
unsigned char ucv;
UInt4 prtlen;
if (strcmp(key, "d") == 0)
{
/* Literal; return the escape part adding type cast */
- F_ExtractOldTo(qp, buf, '}', sizeof(buf));
- prtlen = snprintf(buf, sizeof(buf), "%s::date ", buf);
+ F_ExtractOldTo(qp, buf_small, '}', sizeof(buf_small));
+ prtlen = snprintf(buf, sizeof(buf), "%s::date ", buf_small);
CVT_APPEND_DATA(qb, buf, prtlen);
}
else if (strcmp(key, "t") == 0)
{
/* Literal; return the escape part adding type cast */
- F_ExtractOldTo(qp, buf, '}', sizeof(buf));
- prtlen = snprintf(buf, sizeof(buf), "%s::time", buf);
+ F_ExtractOldTo(qp, buf_small, '}', sizeof(buf_small));
+ prtlen = snprintf(buf, sizeof(buf), "%s::time", buf_small);
CVT_APPEND_DATA(qb, buf, prtlen);
}
else if (strcmp(key, "ts") == 0)
{
/* Literal; return the escape part adding type cast */
- F_ExtractOldTo(qp, buf, '}', sizeof(buf));
+ F_ExtractOldTo(qp, buf_small, '}', sizeof(buf_small));
if (PG_VERSION_LT(qb->conn, 7.1))
- prtlen = snprintf(buf, sizeof(buf), "%s::datetime", buf);
+ prtlen = snprintf(buf, sizeof(buf), "%s::datetime", buf_small);
else
- prtlen = snprintf(buf, sizeof(buf), "%s::timestamp", buf);
+ prtlen = snprintf(buf, sizeof(buf), "%s::timestamp", buf_small);
CVT_APPEND_DATA(qb, buf, prtlen);
}
else if (strcmp(key, "oj") == 0) /* {oj syntax support for 7.1 * servers */
}
/*
- * According to the ODBC specs it is valid to call SQLPrepare mulitple
+ * According to the ODBC specs it is valid to call SQLPrepare multiple
* times. In that case, the bound SQL statement is replaced by the new
* one
*/
{
if (ipdopts->param_processed_ptr)
*ipdopts->param_processed_ptr = 0;
+#if (ODBCVER >= 0x0300)
+ /*
+ * Initialize the param_status_ptr
+ */
+ if (ipdopts->param_status_ptr)
+ {
+ for (i = 0; i <= end_row; i++)
+ ipdopts->param_status_ptr[i] = SQL_PARAM_UNUSED;
+ }
+#endif /* ODBCVER */
SC_recycle_statement(stmt);
}
{
while (opts->param_operation_ptr[stmt->exec_current_row] == SQL_PARAM_IGNORE)
{
- if (ipdopts->param_status_ptr)
- ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_UNUSED;
if (stmt->exec_current_row >= end_row)
{
stmt->exec_current_row = -1;
++stmt->exec_current_row;
}
}
+ /*
+ * Initialize the current row status
+ */
+ if (ipdopts->param_status_ptr)
+ ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_ERROR;
#endif /* ODBCVER */
/*
* Check if statement has any data-at-execute parameters when it is
Int4 bind_size = opts->param_bind_type;
Int4 current_row = stmt->exec_current_row < 0 ? 0 : stmt->exec_current_row;
+ /*
+ * Increment the number of currently processed rows
+ */
+ if (ipdopts->param_processed_ptr)
+ (*ipdopts->param_processed_ptr)++;
stmt->data_at_exec = -1;
for (i = 0; i < opts->allocated; i++)
{
retval = SC_execute(stmt);
if (retval != SQL_ERROR)
{
- if (ipdopts->param_processed_ptr)
- (*ipdopts->param_processed_ptr)++;
/* special handling of result for keyset driven cursors */
if (SQL_CURSOR_KEYSET_DRIVEN == stmt->options.cursor_type &&
SQL_CONCUR_READ_ONLY != stmt->options.scroll_concurrency)
stmt->current_exec_param = -1;
retval = SC_execute(stmt);
- if (retval != SQL_ERROR)
- {
- if (ipdopts->param_processed_ptr)
- (*ipdopts->param_processed_ptr)++;
- }
#if (ODBCVER >= 0x0300)
if (ipdopts->param_status_ptr)
{