|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-03-06 16:13 UTC] 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)]
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
Set quoted identifiers to allow "FIELD NAME" quoting style. Index: ext/pdo_dblib/dblib_driver.c =================================================================== --- ext/pdo_dblib/dblib_driver.c (revision 296453) +++ ext/pdo_dblib/dblib_driver.c (working copy) @@ -236,6 +236,9 @@ /* limit text/image from network */ DBSETOPT(H->link, DBTEXTSIZE, "2147483647"); + /* Allow double quoted field and table names */ + DBSETOPT(H->link, DBQUOTEDIDENT, NULL); + if (vars[3].optval && FAIL == dbuse(H->link, vars[3].optval)) { goto cleanup; }