Re: Fwd: [unixODBC-support] PHP PDO unixODBC FreeTDS SQL Server text column size

Jochen Daum <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <CAPeqxCcwJiBtXXnmJwXCHR_Y4o8NzoUEz0Z05J4S-zvyQT0yRA@mail.gmail.com>
Ok,

>> I am investigating an issue whereby an empty column is returned for a
>> text field when using PHP PDO unixODBC FreeTDS SQL Server.
>
> To determine if the FreeTDS ODBC driver is able to process your query
> results, I recommend testing it with bsqlodbc.  If that works, you can
> have some confidence that the driver works as expected.  That is, as
> the authors intended.

When I run this query through bsqlodbc

select [Attachment].[attaContent] from [Attachment] where
([Attachment].[attaId] = 10239)

I get bsqlodbc: error -2: SQLAllocHandle: invalid handle: failed

> To get better information in situ, TDSDUMP is your friend.
>
>> I also seem to have no FreeTDS logging.
>
> I assume you've read the UG on the question.  Make sure TDSDUMP is set
> before you start the process that uses ODBC.  FreeTDS will honor
> TDSDUMP, definitely.
>
TDSDUMP shows this at the end of the log for the query above

token.c:555:processing result tokens.  marker is  81(TDS7_RESULT)
token.c:1515:processing TDS7 result metadata.
mem.c:615:tds_free_all_results()
token.c:1540:set current_results (1 column) to tds->res_info
token.c:1547:setting up 1 columns
token.c:1486:tds7_get_data_info:
        colname = attaContent (11 bytes)
        type = 35 (text)
        server's type = 35 (text)
        column_varint_size = 4
        column_size = 2147483647 (2147483647 on server)
token.c:1556: name                 size/wsize      type/wtype      utype
token.c:1557: -------------------- --------------- --------------- -------
token.c:1567: attaContent          2147483647/2147483647      35/35            0
util.c:156:Changed query state from READING to PENDING
odbc.c:3534:odbc_process_tokens: tds_process_tokens returned 1
odbc.c:3535:    result_type=4049, TDS_DONE_COUNT=0, TDS_DONE_ERROR=2
odbc.c:3605:odbc_process_tokens: returning result_type 4049
odbc.c:3374:_SQLExecute: odbc_process_tokens returned result_type 4049
token.c:540:tds_process_tokens(0x8027e0, 0x7fff9589f4e8, 0x7fff9589f4ec, 0x6914)
util.c:156:Changed query state from PENDING to READING
token.c:555:processing result tokens.  marker is  d1(ROW)
token.c:666:tds_process_tokens::SET_RETURN stopping on current token
util.c:156:Changed query state from READING to PENDING
odbc.c:3534:odbc_process_tokens: tds_process_tokens returned 1
odbc.c:3535:    result_type=4040, TDS_DONE_COUNT=0, TDS_DONE_ERROR=2
odbc.c:3605:odbc_process_tokens: returning result_type 4040


Any idea where to take it from here?

Kind Regards,

Jochen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.