#47588 [Opn]: PDO_DBLIB: barfs on quoted field names

From: Date: Fri, 15 May 2009 19:43:18 +0000
Subject: #47588 [Opn]: PDO_DBLIB: barfs on quoted field names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-137376@lists.php.net to get a copy of this message
 ID:               47588
 User updated by:  ssufficool at roadrunner dot com
 Reported By:      ssufficool at roadrunner dot com
 Status:           Open
 Bug Type:         PDO related
 Operating System: Linux Gentoo 2.6.x
 PHP Version:      5.2.9
 New Comment:

Solution:

tsql from freetds package set the following where PDO does not:
set quoted_identifier on
set ansi_warnings on
set ansi_padding on
set ansi_nulls on
set concat_null_yields_null on

Since this is default behavior of FreeTDS (tsql) and NT DBLIB (isql), I
assume it should be for PDO dblib as well.


Previous Comments:
------------------------------------------------------------------------

[2009-03-06 16:13:33] ssufficool at roadrunner dot com

Description:
------------
When passing a query containing double quoted field names, the query
fails. 

Reproduce code:
---------------
$pdo_ms = new PDO('dblib:host=db01;dbname=database',
$_SESSION['user'], $_SESSION['pass'], array(PDO::ATTR_ERRMODE =>
PDO::ERRMODE_EXCEPTION ) );

$rs = $pdo_ms->prepare('SELECT "myView"."FieldName" from
"myView" order
by "Some Field"')


Expected result:
----------------
A valid handle to a stmt in $rs


Actual result:
--------------
SQLSTATE[HY000]: General error: 20018 Incorrect syntax near
'FieldName'. [20018] (severity 5) [(null)]



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


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



Thread (6 messages)

« previous php.bugs (#137376) next »