diff -c psqlodbc.orig\convert.c psqlodbc\convert.c *** psqlodbc.orig\convert.c Mon Dec 05 20:20:53 2005 --- psqlodbc\convert.c Sat Dec 17 22:18:46 2005 *************** *** 1860,1866 **** } if (marker_count > 0) { ! if (ipdopts && (ipdopts->allocated == marker_count)) { CVT_APPEND_CHAR(qb, '('); for (i = 0; i < marker_count; i++) --- 1860,1866 ---- } if (marker_count > 0) { ! if (ipdopts->allocated >= marker_count) { CVT_APPEND_CHAR(qb, '('); for (i = 0; i < marker_count; i++) diff -c psqlodbc.orig\execute.c psqlodbc\execute.c *** psqlodbc.orig\execute.c Tue Dec 06 21:53:30 2005 --- psqlodbc\execute.c Sat Dec 17 22:40:54 2005 *************** *** 542,547 **** --- 542,548 ---- UInt4 offset = apdopts->param_offset_ptr ? *apdopts->param_offset_ptr : 0; Int4 bind_size = apdopts->param_bind_type; Int4 current_row = stmt->exec_current_row < 0 ? 0 : stmt->exec_current_row; + SWORD param_count; /* * Increment the number of currently processed rows *************** *** 549,555 **** if (ipdopts->param_processed_ptr) (*ipdopts->param_processed_ptr)++; stmt->data_at_exec = -1; ! for (i = 0; i < apdopts->allocated; i++) { Int4 *pcVal = apdopts->parameters[i].used; --- 550,565 ---- if (ipdopts->param_processed_ptr) (*ipdopts->param_processed_ptr)++; stmt->data_at_exec = -1; ! /* Check bind parameters count */ ! if (SQL_SUCCESS != PGAPI_NumParams(stmt, ¶m_count)) ! return SQL_ERROR; ! if (param_count > apdopts->allocated) ! { ! SC_set_error(stmt, STMT_COUNT_FIELD_INCORRECT, "The # of binded parameters < the # of parameter markers"); ! SC_set_sqlstate(stmt, "07002"); ! return SQL_ERROR; ! } ! for (i = 0; i < param_count; i++) { Int4 *pcVal = apdopts->parameters[i].used; *************** *** 740,750 **** } /* In the middle of SQLParamData/SQLPutData, so cancel that. */ - - /* Free all previous data-at-exec buffers */ - mylog("%s: Clearing parameters et al.\n", func); - - SC_free_params(stmt, STMT_FREE_PARAMS_ALL); stmt->data_at_exec = -1; stmt->current_exec_param = -1; stmt->put_data = FALSE; --- 750,755 ---- *************** *** 819,828 **** --- 824,836 ---- CSTR func = "PGAPI_ParamData"; StatementClass *stmt = (StatementClass *) hstmt, *estmt; APDFields *apdopts; + /* not used IPDFields *ipdopts; + */ RETCODE retval; int i; ConnInfo *ci; + SWORD param_count; mylog("%s: entering...\n", func); *************** *** 844,850 **** return SQL_ERROR; } ! if (estmt->data_at_exec > apdopts->allocated) { SC_set_error(stmt, STMT_SEQUENCE_ERROR, "Too many execution-time parameters were present"); SC_log_error(func, "", stmt); --- 852,868 ---- return SQL_ERROR; } ! /* Check bind parameters count */ ! if (SQL_SUCCESS != PGAPI_NumParams(stmt, ¶m_count)) ! return SQL_ERROR; ! if (param_count > apdopts->allocated) ! { ! SC_set_error(stmt, STMT_COUNT_FIELD_INCORRECT, "The # of binded parameters < the # of parameter markers"); ! SC_set_sqlstate(stmt, "07002"); ! return SQL_ERROR; ! } ! ! if (estmt->data_at_exec > param_count) { SC_set_error(stmt, STMT_SEQUENCE_ERROR, "Too many execution-time parameters were present"); SC_log_error(func, "", stmt); *************** *** 870,876 **** --- 888,896 ---- } /* Done, now copy the params and then execute the statement */ + /* Luf - I don't see why this is called ipdopts = SC_get_IPDF(estmt); + */ if (estmt->data_at_exec == 0) { BOOL exec_end; *************** *** 892,898 **** i = estmt->current_exec_param >= 0 ? estmt->current_exec_param + 1 : 0; /* At least 1 data at execution parameter, so Fill in the token value */ ! for (; i < apdopts->allocated; i++) { if (apdopts->parameters[i].data_at_exec) { --- 912,918 ---- i = estmt->current_exec_param >= 0 ? estmt->current_exec_param + 1 : 0; /* At least 1 data at execution parameter, so Fill in the token value */ ! for (; i < param_count; i++) { if (apdopts->parameters[i].data_at_exec) {