Sorry I'm late on this - I did not see it first time.
On 17/05/11 17:11, [email protected] wrote:
I'm setting up to use DBD::ODBC with the FreeTDS driver to go against
a MS SQL server and am hoping to nail down the specifics of the
relationship between setting $dbh->{LongReadLen} and TEXTSIZE.
what is TEXTSIZE?
So far, LongReadLen has had exactly no impact on retrieval of long
data from my MS sql server. Regardless of to what LongReadLen is
set, the data that I retrieve is complete beyond the LongReadLeng
setting as long as TEXTSIZE is adequately large.
Normally DBD::ODBC uses a buffer of 80 bytes (or 160 for Unicode) to hold
column data. If your column is longer than that it will be truncated by the
ODBC driver and the ODBC driver should return SQL_SUCCESS_WITH_INFO indicating
the data is truncated. If it does DBD::ODBC sees this and if LongTruncOk is set
then it is fine, otherwise it errors.
Setting LongReadLen allows you to change the buffer DBD::ODBC uses to avoid
truncation. It is necessary since some database columns can report a huge size
it would be ridiculous to allocate unless the application is sure it wants it
all. However, LongReadLen does not affect all columns e.g., integer columns. It
does affect SQL_BINARY, nvarchar(MAX) in SQL Server, any column where the
driver reports its size as 0, SQL_LONGVARBINARY, SQL_WLONGVARCHAR,
SQL_LONGVARCHAR, MS_SQLS_XML_TYPE.
Setting TEXTSIZE to a value that is less than the length of the data,
however, does result in truncated data returned from the dataserver.
I don't know what TEXTSIZE is.
Additionally, truncated values end with an extended ascii
char...probably a null...I have to admit I haven't looked yet.
So, can we just ignore LongReadLen? We're migrating from Sybase, and
have been using LongReadLen as a connection parameter in Sybase for
years to set the size of long data returned by the dataserver.
Any light you can shed on this is appreciated.
All the light I have so far. I don't use freeTDS actively myself although I
have it. If you can provide a simple standalone example which creates a table
and demonstrates the issue I will look at it.
Eric
Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com