php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64957 PDO_DBLIB returns unknown for native_type
Submitted: 2013-06-01 21:04 UTC Modified: 2016-09-14 15:32 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: ssufficool@php.net Assigned: adambaratz (profile)
Status: Closed Package: PDO DBlib
PHP Version: master-Git-2013-06-01 (Git) OS: Any
Private report: No CVE-ID: None
 [2013-06-01 21:04 UTC] ssufficool@php.net
Description:
------------
When testing against Sybase AS 12, varchar columns are described as unknown.

Test script:
---------------
#!~/src/php-src/sapi/cli/php
<?php

putenv("TDSDUMP=/home/stanley/src/freetds.log");

include("login.php");

$pdo=new PDO('dblib:host=localhost:2638;dbname=test;charset=UTF-8',$user,$pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$stmt = $pdo->query("SELECT cast('foo' as varchar(32)) as foo");
print_r($stmt->getColumnMeta(0));


?>


Expected result:
----------------
Array
(
    [max_length] => 32
    [precision] => 0
    [scale] => 0
    [column_source] => foo
    [native_type] => varchar
    [name] => foo
    [len] => 32
    [pdo_type] => 2
)


Actual result:
--------------
Array
(
    [max_length] => 0
    [precision] => 0
    [scale] => 0
    [column_source] => foo
    [native_type] => unknown
    [name] => foo
    [len] => 0
    [pdo_type] => 2
)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-01 12:31 UTC] felipe@php.net
-Package: PDO related +Package: PDO DBlib
 [2014-10-25 04:33 UTC] ssufficool@php.net
-Assigned To: +Assigned To: ssufficool
 [2015-06-10 19:56 UTC] php_bugs at mts7 dot com
The problem seems to be within ext/pdo_dblib/dblib_stmt.c. 

pdo_dblib_get_field_name(dbcoltype(H->link, colno+1)) is returning 'unknown' for VARCHAR and BIT (and possibly more) types. Please consider updating the functions to handle the correct dbcoltype(H->link, colno+1) values for these unknown types.
 [2016-06-26 18:15 UTC] ssufficool@php.net
-Assigned To: ssufficool +Assigned To:
 [2016-09-14 15:32 UTC] adambaratz@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: adambaratz
 [2016-09-14 15:32 UTC] adambaratz@php.net
This is no longer an issue in the latest version of the extension. bug_45876.phpt covers this issue, so we should be safe from regressions.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 05:01:29 2024 UTC