Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,8 @@ const char *GetSvpName(const ConnectionClass *conn, char *wrk, int wrksize)
* The execution after all parameters were resolved.
*/

#define INVALID_EXPBUFFER PQExpBufferDataBroken(stmt->stmt_deffered)
#define VALID_EXPBUFFER (!PQExpBufferDataBroken(stmt->stmt_deffered))
#define INVALID_EXPBUFFER PQExpBufferDataBroken(stmt->stmt_deferred)
#define VALID_EXPBUFFER (!PQExpBufferDataBroken(stmt->stmt_deferred))

static
void param_status_batch_update(IPDFields *ipdopts, RETCODE retval, SQLLEN target_row, int count_of_deffered)
Expand Down Expand Up @@ -465,7 +465,7 @@ MYLOG(DETAIL_LOG_LEVEL, "prepare_before_exec=%d srv=%d\n", prepare_before_exec,
stmt_with_params = stmt->stmt_with_params = NULL;
}
if (INVALID_EXPBUFFER ||
!stmt->stmt_deffered.data[0])
!stmt->stmt_deferred.data[0])
RETURN(SQL_SUCCESS);
}
else
Expand Down Expand Up @@ -523,7 +523,7 @@ MYLOG(0, "about to begin SC_execute exec_type=%d\n", exec_type);
stmt->count_of_deffered + 1 < stmt->batch_size)
{
if (INVALID_EXPBUFFER)
initPQExpBuffer(&stmt->stmt_deffered);
initPQExpBuffer(&stmt->stmt_deferred);
if (INVALID_EXPBUFFER)
{
retval = SQL_ERROR;
Expand All @@ -533,10 +533,10 @@ MYLOG(0, "about to begin SC_execute exec_type=%d\n", exec_type);
{
if (NULL != stmt_with_params)
{
if (stmt->stmt_deffered.data[0])
appendPQExpBuffer(&stmt->stmt_deffered, ";%s", stmt_with_params);
if (stmt->stmt_deferred.data[0])
appendPQExpBuffer(&stmt->stmt_deferred, ";%s", stmt_with_params);
else
printfPQExpBuffer(&stmt->stmt_deffered, "%s", stmt_with_params);
printfPQExpBuffer(&stmt->stmt_deferred, "%s", stmt_with_params);
}
if (NULL != ipdopts->param_status_ptr)
ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS; // set without exec
Expand All @@ -550,14 +550,14 @@ MYLOG(0, "about to begin SC_execute exec_type=%d\n", exec_type);
if (VALID_EXPBUFFER)
{
if (NULL != stmt_with_params)
appendPQExpBuffer(&stmt->stmt_deffered, ";%s", stmt_with_params);
stmt->stmt_with_params = stmt->stmt_deffered.data;
appendPQExpBuffer(&stmt->stmt_deferred, ";%s", stmt_with_params);
stmt->stmt_with_params = stmt->stmt_deferred.data;
}
retval = SC_execute(stmt);
stmt->stmt_with_params = stmt_with_params;
stmt->count_of_deffered = 0;
if (VALID_EXPBUFFER)
resetPQExpBuffer(&stmt->stmt_deffered);
resetPQExpBuffer(&stmt->stmt_deferred);
}
if (retval == SQL_ERROR)
{
Expand Down
6 changes: 3 additions & 3 deletions statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ SC_Constructor(ConnectionClass *conn)
rv->use_server_side_prepare = conn->connInfo.use_server_side_prepare;
rv->lock_CC_for_rb = FALSE;
// for batch execution
memset(&rv->stmt_deffered, 0, sizeof(rv->stmt_deffered));
memset(&rv->stmt_deferred, 0, sizeof(rv->stmt_deferred));
if ((rv->batch_size = conn->connInfo.batch_size) < 1)
rv->batch_size = 1;
rv->exec_type = DIRECT_EXEC;
Expand Down Expand Up @@ -536,8 +536,8 @@ SC_Destructor(StatementClass *self)
cancelNeedDataState(self);
if (self->callbacks)
free(self->callbacks);
if (!PQExpBufferDataBroken(self->stmt_deffered))
termPQExpBuffer(&self->stmt_deffered);
if (!PQExpBufferDataBroken(self->stmt_deferred))
termPQExpBuffer(&self->stmt_deferred);

DELETE_STMT_CS(self);
free(self);
Expand Down
2 changes: 1 addition & 1 deletion statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ struct StatementClass_
int batch_size;
EXEC_TYPE exec_type;
int count_of_deffered;
PQExpBufferData stmt_deffered;
PQExpBufferData stmt_deferred;
/* SQL_NEED_DATA Callback list */
StatementClass *execute_delegate;
StatementClass *execute_parent;
Expand Down