Fixed a braindead bug in odbc-sql-bindcol() buffer bookkeeping that

would raise an buffer-exceeded-error even if buffer_needed <
buffer_len after the buffer has been rebound
This commit is contained in:
eknauel 2002-09-24 13:48:20 +00:00
parent eb4b60db6f
commit 4651284138
1 changed files with 3 additions and 3 deletions

View File

@ -2389,6 +2389,7 @@ s48_value odbc_sql_bindcol(s48_value stmt_handle, s48_value column_no,
/* free the old buffer, allocate a new one */
free(col->col_buffer);
col->col_buffer = (void *) malloc(sizeof_sql_c_type_identifier(tt)*bl);
col->buffer_len = sizeof_sql_c_type_identifier(tt)*bl;
ODBC_DEBUG_PRINTF_3("odbc_sql_bindcol() reallocate %x %d\n", col->col_buffer,
sizeof_sql_c_type_identifier(tt)*bl);
if (col->col_buffer == NULL)
@ -2396,9 +2397,8 @@ s48_value odbc_sql_bindcol(s48_value stmt_handle, s48_value column_no,
}
/* at this point ColumRecPtr col has been created or updated, call SQLBindCol() */
retval = SQLBindCol(sh, cn, tt,
col->col_buffer, sizeof_sql_c_type_identifier(tt)*bl,
&col->buffer_needed);
retval = SQLBindCol(sh, cn, tt, col->col_buffer, col->buffer_len, &col->buffer_needed);
switch (retval)
{
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO: