*** ./bind.c.orig Fri Mar 23 12:23:48 2001 --- ./bind.c Fri Mar 23 15:37:01 2001 *************** *** 143,150 **** stmt->parameters[ipar].EXEC_buffer = NULL; } ! /* Data at exec macro only valid for C char/binary data */ ! if ((fSqlType == SQL_LONGVARBINARY || fSqlType == SQL_LONGVARCHAR) && pcbValue && *pcbValue <= SQL_LEN_DATA_AT_EXEC_OFFSET) stmt->parameters[ipar].data_at_exec = TRUE; else stmt->parameters[ipar].data_at_exec = FALSE; --- 143,150 ---- stmt->parameters[ipar].EXEC_buffer = NULL; } ! /* Data at exec macro */ ! if (((fSqlType == SQL_LONGVARBINARY || fSqlType == SQL_LONGVARCHAR) && pcbValue && *pcbValue <= SQL_LEN_DATA_AT_EXEC_OFFSET) || *pcbValue == SQL_DATA_AT_EXEC) stmt->parameters[ipar].data_at_exec = TRUE; else stmt->parameters[ipar].data_at_exec = FALSE; *** ./execute.c.orig Fri Mar 23 12:23:48 2001 --- ./execute.c Fri Mar 23 15:38:31 2001 *************** *** 778,809 **** } else ! { /* for handling text fields and small ! * binaries */ if (cbValue == SQL_NTS) { current_param->EXEC_buffer = strdup(rgbValue); if (!current_param->EXEC_buffer) { stmt->errornumber = STMT_NO_MEMORY_ERROR; ! stmt->errormsg = "Out of memory in SQLPutData (2)"; SC_log_error(func, "", stmt); return SQL_ERROR; } } ! else { current_param->EXEC_buffer = malloc(cbValue + 1); if (!current_param->EXEC_buffer) { stmt->errornumber = STMT_NO_MEMORY_ERROR; ! stmt->errormsg = "Out of memory in SQLPutData (2)"; SC_log_error(func, "", stmt); return SQL_ERROR; } memcpy(current_param->EXEC_buffer, rgbValue, cbValue); current_param->EXEC_buffer[cbValue] = '\0'; } } } --- 778,823 ---- } else ! { /* for handling fields */ if (cbValue == SQL_NTS) { + mylog("DataPut NTS cbValue = %d, rgbValue = %l d\n",current_param->buflen,*((SDWORD *) rgbValue)); current_param->EXEC_buffer = strdup(rgbValue); if (!current_param->EXEC_buffer) { stmt->errornumber = STMT_NO_MEMORY_ERROR; ! stmt->errormsg = "Out of memory in SQLPutData (2-1)"; SC_log_error(func, "", stmt); return SQL_ERROR; } } ! else if (current_param->SQLType == SQL_CHAR || current_param->SQLType == SQL_VARCHAR) { + mylog("DataPut CHAR cbValue = %d, rgbValue = %l d\n",current_param->buflen,*((SDWORD *) rgbValue)); current_param->EXEC_buffer = malloc(cbValue + 1); if (!current_param->EXEC_buffer) { stmt->errornumber = STMT_NO_MEMORY_ERROR; ! stmt->errormsg = "Out of memory in SQLPutData (2-2)"; SC_log_error(func, "", stmt); return SQL_ERROR; } memcpy(current_param->EXEC_buffer, rgbValue, cbValue); current_param->EXEC_buffer[cbValue] = '\0'; + } + else + { + mylog("DataPut other cbValue = %d, rgbValue = %l d\n",current_param->buflen,*((SDWORD *) rgbValue)); + current_param->EXEC_buffer = malloc(current_param->buflen); + if (!current_param->EXEC_buffer) + { + stmt->errornumber = STMT_NO_MEMORY_ERROR; + stmt->errormsg = "Out of memory in SQLPutData (2-3)"; + SC_log_error(func, "", stmt); + return SQL_ERROR; + } + memcpy(current_param->EXEC_buffer, rgbValue, cbValue); } } } *** ./results.c.orig Fri Mar 23 12:23:48 2001 --- ./results.c Fri Mar 23 15:37:06 2001 *************** *** 154,173 **** if (!parse_ok) { SC_pre_execute(stmt); result = SC_get_Result(stmt); mylog("SQLNumResultCols: result = %u, status = %d, numcols = %d\n", result, stmt->status, result != NULL ? QR_NumResultCols(result) : -1); if ((!result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE))) { ! /* no query has been executed on this statement */ ! stmt->errornumber = STMT_SEQUENCE_ERROR; ! stmt->errormsg = "No query has been executed with that handle"; ! SC_log_error(func, "", stmt); ! return SQL_ERROR; } - - *pccol = QR_NumResultCols(result); } return SQL_SUCCESS; --- 154,174 ---- if (!parse_ok) { + /* SC_pre_execute(stmt); + */ result = SC_get_Result(stmt); mylog("SQLNumResultCols: result = %u, status = %d, numcols = %d\n", result, stmt->status, result != NULL ? QR_NumResultCols(result) : -1); if ((!result) || ((stmt->status != STMT_FINISHED) && (stmt->status != STMT_PREMATURE))) { ! stmt->nfld = 0; ! *pccol = stmt->nfld; ! } ! else ! { ! *pccol = QR_NumResultCols(result); } } return SQL_SUCCESS;