Edit report at https://bugs.php.net/bug.php?id=61777&edit=1

 ID:                 61777
 Comment by:         burnhamrobertp at gmail dot com
 Reported by:        frozen at frozen-solid dot net
 Summary:            Cannot bind parameters with pdo_odbc and SQL Server
                     Native Client 11.0
 Status:             Open
 Type:               Bug
 Package:            PDO related
 Operating System:   Ubuntu 12.04
 PHP Version:        5.3.10
 Block user comment: N
 Private report:     N

 New Comment:

Debian Squeeze 2.6.32-5-amd64
PHP 5.3.3 (also reproducible under PHP 5.4.0-3)

The test case and error information are exactly the same.


Previous Comments:
------------------------------------------------------------------------
[2012-04-19 18:45:03] frozen at frozen-solid dot net

Description:
------------
When trying to bind parameters to a prepared statement, bindValue() and 
bindParam() both return false with the error code HY004, [SQL Server Native 
Client 
11.0]Invalid SQL data type (SQLBindParameter[0] at /build/buildd/php5-
5.3.10/ext/pdo_odbc/odbc_stmt.c:379)

It does not matter whether you pass in PDO::PARAM_STR or PARAM_INT or no data 
type 
specification, the error is the same every time.

Using parameters with odbc_connect() and odbc_prepare() work as expected, so 
the 
issue is directly related to PDO, not to ODBC or Microsoft's driver.

Test script:
---------------
$db = new PDO('odbc:sqltest', 'wwwuser', 'btsb');

$strSql = 'select top 10 * from oltmaster where titleno = :no';

$q = $db->prepare($strSql);

var_dump($q->bindValue(':no', '029803'));
var_dump($q->errorInfo());

Expected result:
----------------
boolean true

array
  0 => string '' (length=0)
  1 => int 0
  2 => string ' ((null)[0] at (null):0)' (length=24)
  3 => string '' (length=0)

Actual result:
--------------
boolean false

array
  0 => string 'HY004' (length=5)
  1 => int 0
  2 => string '[Microsoft][SQL Server Native Client 11.0]Invalid SQL data type 
(SQLBindParameter[0] at 
/build/buildd/php5-5.3.10/ext/pdo_odbc/odbc_stmt.c:379)' 
(length=143)
  3 => string 'HY004' (length=5)



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61777&edit=1

Reply via email to