I recently updated our current FreeTDS to FreeTDS version 8.0 but existing PHP programs that is reading data from SQL Server 2000 database suddenly stopped working. The problem I found was in the SELECT statements for queries.
For example consider this SQL:
select
a.id as first_id,
b.id as second_id
from tableA a
inner join tableB b on
b.id=a.id
When referencing to the field name using PHP code -odbc_field_name(resource result_id, int field_number)- it reads both field names as id and not what I defined them like using as (first_id, second_id). If I modify the select to concatenate an empty string like below the odbc_field_name(resource result_id, int field_number) function ouputs first_id and second_id.
select
a.id+'' as first_id,
b.id+'' as second_id
My odbcinst.ini file looks like this on a Linux machine
[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsodbc.so
UsageCount = 2
Has anyone else experienced this problem and how do I fix it without having to rollback to previous FreeTDS version or is the problem somewhere else?
Thank you
For example consider this SQL:
select
a.id as first_id,
b.id as second_id
from tableA a
inner join tableB b on
b.id=a.id
When referencing to the field name using PHP code -odbc_field_name(resource result_id, int field_number)- it reads both field names as id and not what I defined them like using as (first_id, second_id). If I modify the select to concatenate an empty string like below the odbc_field_name(resource result_id, int field_number) function ouputs first_id and second_id.
select
a.id+'' as first_id,
b.id+'' as second_id
My odbcinst.ini file looks like this on a Linux machine
[FreeTDS]
Description = FreeTDS unixODBC Driver
Driver = /usr/lib/libtdsodbc.so
Setup = /usr/lib/libtdsodbc.so
UsageCount = 2
Has anyone else experienced this problem and how do I fix it without having to rollback to previous FreeTDS version or is the problem somewhere else?
Thank you