[freetds] Re:Re: possible bug in 0.62rc2 with field type 'datetime' on MSSQL7 (Frediano Ziglio)

Andreas Schlögl andreas.schloegl at aon.at
Tue Jan 6 19:07:11 EST 2004


Where do these errors come? I grep FreeTDS source and php source without
finding the error... I think the error/warning came from your script...

freddy77

Try this. Basically this is your code we have used to identify the last issue. 
I have used the table sysusers, because there are 2 datetime fields on 
position 6 and 7.
Also a field of type timestamp (there is none in the sys tables, so you need 
to set up a small table on your own) is reported as binary.

<?php
$odbc = odbc_connect('DNSName','user','password') or die('opps..');
$sql = "select * from sysusers";
echo "Query: $sql<br>\n";
$result = odbc_exec($odbc, $sql) or die("<p>".odbc_errormsg());

        for($i=1;$i<=odbc_num_fields($result);$i++){
                echo "Column ".odbc_field_name($result,$i)."<br>\n";
                echo "\tlen is ".odbc_field_len($result,$i)."<br>\n";
                echo "\ttype is ".odbc_field_type($result,$i)."<br>\n";
		echo "<br>";
	}
 ?>

The result is:

Query: select * from sysusers
 Column uid
 len is 2
 type is SMALLINT
 
Column status
 len is 2
 type is SMALLINT
 
Column name
 len is 128
 type is VARCHAR
 
Column sid
 len is 85
 type is VARBINARY
 
Column roles
 len is 2048
 type is VARBINARY
 
Column createdate
 len is 8
 type is TIMESTAMP
 
Column updatedate
 len is 8
 type is TIMESTAMP
 
Column altuid
 len is 2
 type is SMALLINT
 
Column password
 len is 256
 type is VARBINARY
 
Column suid
 len is 2
 type is SMALLINT
 
Column gid
 len is 2
 type is SMALLINT
 
Column environ
 len is 255
 type is VARCHAR
 
.....

-- 
Andreas



More information about the FreeTDS mailing list