Skip to Content.
Sympa Menu

freetds - Re: [freetds] select returns a " " character instead of ""

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Martin Rode <martin.rode AT programmfabrik.de>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] select returns a " " character instead of ""
  • Date: Thu, 06 Apr 2006 10:33:02 +0200

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





Archive powered by MHonArc 2.6.24.

Top of Page