Главная страница | назад





Article #19779: Character fields from Access ODBC connection are reported as being double their true size

 Question and Answer Database
FAQ: FAQ4779B — Character fields from Access ODBC connection are reported as being double their true size
Category: Database (ODBC)
Platform: All-32Bit
Product: All-CBuilder, C++Builder1.0, C++Builder3.x, C++Builder4.x, Delphi2.x, Delphi3.x, Delphi4.x, VdBase7.x,
Question:
How come when I use Microsoft's latest ODBC driver for Access the BDE
returns the field size for character fields as being double their actual size?
Answer:
This problem occurs because the BDE calls SQLCOLUMNS and the looks at BUFFER_LENGTH
to determine the size of a column. With this driver BUFFER_LENGTH is returned as
double what the COLUMN_SIZE is.
Here is what Microsoft used to document what BUFFER_LENGTH should return:
The length in bytes of data transferred on an SQLGetData, SQLFetch, or
SQLFetchScroll operation if SQL_C_DEFAULT is specified. For numeric data, this
size may be different than the size of the data stored on the data source.
This value is the same as the COLUMN_SIZE column for character or binary data.
Here is what Microsoft nows documents what BUFFER_LENGTH should return:
The length in bytes of data transferred on an SQLGetData, SQLFetch, or
SQLFetchScroll operation if SQL_C_DEFAULT is specified. For numeric data, this
size may be different than the size of the data stored on the data source.
This value might be different than COLUMN_SIZE column for character data.
Inprise has verified this problem to exist in versions 4.00.3711.08 and
4.00.4202.00 of the Access ODBC driver. Inprise has contacted Microsoft
and they have confirmed this new change in the ODBC specification. Inprise
is currently evaluting how to resolve this issue in a future release that
does not effect other ODBC drivers adversely.
Errors that may be causes by problem are "Record/Key Deleted" and "Size Mismatch".
The workarounds to this problem are:
1. Use an older version of the ODBC driver.
2. Use the BDE Access Native driver.
3. Use ADO with Delphi 5.
7/28/99 10:46:47 AM

Last Modified: 01-OCT-99