Re: Problem with Set TEXT field to NULL

Min <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
Well, second thought might still be the fetch issue.

As SYBASE will create a text pointer when using UPDATE to set TEXT field,
even with a NULL. So there is a difference between initialized NULL value
and a updated NULL value with a text pointer. It seems freetds doesn't
handle the latter well and php will crash.

Any way to get around this?

Thanks,

Min

On Mon, Feb 9, 2009 at 3:16 PM, Min Admin <[email protected]> wrote:

> Hello,
>
> I use the following command to set a TEXT field to NULL in tsql or sqsh. It
> is executed without error.
>
> UPDATE table_a SET col_y = NULL WHERE col_id=1
>
> Then if I use SELECT to see the result, it shows up like it is empty value,
> not NULL. What's more, if I use php to SELECT this column, it will crash.
>
> Part of the SELECT log by using php:
>
> 14:46:53.448043 3827 (token.c:510):processing result tokens.  marker is
> d1(ROW)
> 14:46:53.448061 3827 (token.c:2166):tds_process_row(): reading column 0
> 14:46:53.448078 3827 (token.c:1915):tds_get_data: type 35, varint size 4
> 14:46:53.448097 3827 (token.c:1975):tds_get_data(): wire column size is 0
> 14:46:53.448114 3827 (util.c:162):Changed query state from READING to
> PENDING
> 14:46:53.448132 3827 (ct.c:1555):inside ct_fetch()process_row_tokens
> returned 1
> 14:46:53.448149 3827 (ct.c:1704):_ct_bind_data()
> 14:46:53.448166 3827 (ct.c:1711):_ct_bind_data(): column_type: 35
> column_len: 0
> 14:46:53.448182 3827 (ct.c:2003):_ct_get_server_type(0)
> 14:46:53.448199 3827 (ct.c:1890):_ct_get_client_type(type 35, user 19, size
> 64512)
> 14:46:53.448220 3827 (cs.c:463):cs_convert()
> 14:46:53.448237 3827 (ct.c:2003):_ct_get_server_type(4)
> 14:46:53.448254 3827 (ct.c:2003):_ct_get_server_type(0)
> 14:46:53.448271 3827 (cs.c:470):cs_convert() srctype = 35 (0) desttype = 47
> (64513)
> 14:46:53.448289 3827 (cs.c:483):cs_convert() srcdata is null
>
> Please notice that wire column size is 0. If it is NULL, it should be -1.
>
> As I have no problem to SELECT NULL or empty TEXT field, I suppose the
> UPDATE is going something wrong.
>
> Any ideas?
>
> Thanks,
>
> Min
>
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.