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:
parent
eb4b60db6f
commit
4651284138
|
@ -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 the old buffer, allocate a new one */
|
||||||
free(col->col_buffer);
|
free(col->col_buffer);
|
||||||
col->col_buffer = (void *) malloc(sizeof_sql_c_type_identifier(tt)*bl);
|
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,
|
ODBC_DEBUG_PRINTF_3("odbc_sql_bindcol() reallocate %x %d\n", col->col_buffer,
|
||||||
sizeof_sql_c_type_identifier(tt)*bl);
|
sizeof_sql_c_type_identifier(tt)*bl);
|
||||||
if (col->col_buffer == NULL)
|
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() */
|
/* at this point ColumRecPtr col has been created or updated, call SQLBindCol() */
|
||||||
retval = SQLBindCol(sh, cn, tt,
|
retval = SQLBindCol(sh, cn, tt, col->col_buffer, col->buffer_len, &col->buffer_needed);
|
||||||
col->col_buffer, sizeof_sql_c_type_identifier(tt)*bl,
|
|
||||||
&col->buffer_needed);
|
|
||||||
switch (retval)
|
switch (retval)
|
||||||
{
|
{
|
||||||
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
|
case SQL_SUCCESS: case SQL_SUCCESS_WITH_INFO:
|
||||||
|
|
Loading…
Reference in New Issue