[freetds] Feature request

Laurent Papier papier at sdv.fr
Tue May 27 12:37:38 EDT 2003


On 22 May 2003 21:44:39 +0200
Frediano Ziglio <freddyz77 at tin.it> wrote:

> What library are you using ?
> Can you describe when different behavior occur ?
> You can issue a "SET ANSI_PADDING ON/OFF" command...

We are using Apache/PHP 4.2.3 (compiled with --with-sybase-ct) and SQLServer
2000.

We use the following code:
<?php
// FreeTDS
$link = mssql_connect('db','user','pass');
//mssql_query("set ANSI_PADDING OFF");

mssql_query("CREATE TABLE tab ( col CHAR(16) not null )");
mssql_query("INSERT INTO tab VALUES ('hello')");
$r = mssql_query("SELECT col FROM tab");
$line = mssql_fetch_row($r);
print "'$line[0]', size =". strlen($line[0]) . "\n";
mssql_query("DROP TABLE tab");

mssql_close($link);
?>


'ANSI_PADDING' not defined produce this output:

- with sybase 11.9.2: 'hello', size =5
- with FreeTDS 0.60:  'hello           ', size =16

'SET ANSI_PADDING ON' produce this output:

- with sybase 11.9.2: 'hello', size =5
- with FreeTDS 0.60:  'hello           ', size =16

'SET ANSI_PADDING OFF' produce this output:

- with sybase 11.9.2: 'hello', size =5
- with FreeTDS 0.60:  'hello           ', size =16


After digging in docs, we found that FreeTDS behave the right way and that
sybase always trim CHAR column. Our request is to make FreeTDS behave like the
buggy sybase driver, with a runtime or compile time option, and always trim a
CHAR column result.

We can also do it in PHP, but we have several hundred of web sites writen with
the sybase driver ...

Thanks for your help.
-- 
Laurent Papier
Admin. systeme - Sdv Plurimedia - <http://www.sdv.fr/>




More information about the FreeTDS mailing list