[freetds] select returns a " " character instead of ""
Martin Rode
martin.rode at programmfabrik.de
Thu Apr 6 04:33:02 EDT 2006
hi freddy,
so its not a limitation in the backend of sql server (as stated elsewhere) ?
a) i am using the latest version of tds (0.63)
b) i am seeing the same problem mit the sybase-api (is that also using
tds) ?
best,
martin
but my version of tds is 0.63, which should be the latest.
ZIGLIO, Frediano, VF-IT wrote:
>> hi everybody,
>>
>> i have found another problem, this time with a current version of php:
>>
>> client:
>> * debian linux
>> * php 5.1.2
>> * tds 0.63 (debian unstable)
>>
>> server:
>> * using microsoft sql server express 9.0.1399 on windows xp2
>>
>> this following script. it should return a length of 0 for the string
>> data, but it returns 1.
>>
>> i see the same problem with the php/sybase_* api.
>>
>> --------------------------------
>> test_query2();
>>
>>
>> function test_query2() {
>> $dsn ="DRIVER={FreeTDS};SERVER=thepope;DATABASE=test";
>> $link2 = odbc_connect($dsn , 'sa', 'test' ) or
>> die(odbc_errormsg() );
>> odbc_autocommit($link2, true);
>> odbc_exec($link2, "
>> IF EXISTS(SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE
>> TABLE_NAME = 'images') DROP TABLE [images];\n;
>> CREATE TABLE images (
>> name varchar(50),
>> data varchar(max)
>> );
>> ");
>> $ins = "INSERT INTO images (name,data) VALUES ('henk','')";
>> odbc_exec($link2, $ins);
>>
>> $sql = "SELECT data,datalength(data) as length FROM images";
>> $res = odbc_exec($link2, $sql);
>> $row = odbc_fetch_array($res);
>> echo "<pre>";
>> print_r($row);
>> print_r("STRLEN of 'data':".strlen($row[data]));
>> // this prints a length of 1, but it should be 0
>> }
>>
>>
>
> Probably you are using wrong TDS version. This behavior is due to 4.2
> protocol limitation.
>
> freddy77
> _______________________________________________
> FreeTDS mailing list
> FreeTDS at lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
More information about the FreeTDS
mailing list