Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 498374 - =dev-db/freetds-0.91 - Column aliasing not working via php
Summary: =dev-db/freetds-0.91 - Column aliasing not working via php
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL: http://lists.ibiblio.org/pipermail/fr...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2014-01-17 16:12 UTC by Chris Frederick
Modified: 2016-07-31 13:59 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Source patch for freetds-0.91 (freetds-0.91-fix_field_aliases.patch,809 bytes, patch)
2014-01-17 16:15 UTC, Chris Frederick
Details | Diff
Patch for freetds-0.91.ebuild (freetds-0.91.ebuild.patch,613 bytes, patch)
2014-01-17 16:17 UTC, Chris Frederick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Frederick 2014-01-17 16:12:21 UTC
The latest dev-db/freetds-0.91 suffers from the bug described in the url.  Basically when using freetds with your freetds.conf file using "tds version = 7.2" causes aliased fields in your SQL string to be returned with their orignal names.  There's a workaround to change to "tds version = 4.2" to fix it, but then that one does not return varchar data larger than 255 characters, so that is not an option for most users.

Reproducible: Always

Steps to Reproduce:
user$ php -a
Interactive shell

php > $conn = odbc_connect('MYDSN', 'MYUSER', 'MYPASS');
php > $res = odbc_exec($conn, 'SELECT TABLE_NAME AS my_table FROM Information_Schema.Tables');
php > $row = odbc_fetch_array($res);
php > print_r($row);
php > odbc_free_result($res);
php > odbc_close($conn);
php > quit
Actual Results:  
Array
(
    [TABLE_NAME] => FirstTableInListing
)


Expected Results:  
Array
(
    [my_table] => FirstTableInListing
)
Comment 1 Chris Frederick 2014-01-17 16:15:19 UTC
Created attachment 368020 [details, diff]
Source patch for freetds-0.91

Altered form of the original patch updated for freetds-0.91
Comment 2 Chris Frederick 2014-01-17 16:17:56 UTC
Created attachment 368022 [details, diff]
Patch for freetds-0.91.ebuild

Changes to apply the patch durring emerge.
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2014-01-20 14:27:56 UTC
Comment on attachment 368022 [details, diff]
Patch for freetds-0.91.ebuild

Since EAPI=2 we apply patches in src_prepare() not src_unpack().
Comment 4 Michael Orlitzky gentoo-dev 2016-07-31 02:15:16 UTC
This was fixed for the 0.91 versions a while ago (the patch was applied). The patch no longer works for newer versions of freetds, though -- can you please check to see if the 1.00.x versions have the same problem?
Comment 5 Michael Orlitzky gentoo-dev 2016-07-31 13:59:39 UTC
...I forgot that I have a MSSQL server to play with. I just ran your example with freetds-1.00.13 and my TDS version set to 7.2. It worked correctly, so I think this was fixed upstream around v1.00. Please let me know if this is not the case.