Subject: | DBD::OBCD prepare fails for a select if a column name contains a quote char. |
Date: | Wed, 19 Sep 2018 13:22:02 +0000 |
To: | "bug-DBD-ODBC [...] rt.cpan.org" <bug-DBD-ODBC [...] rt.cpan.org> |
From: | Steve Rogerson <steve [...] yewtc.demon.co.uk> |
The quote char is a valid character for column names in MSSQL (why, why, why...) anyway it is. It seems to screw up prepare.
Without prepare all is well.
SELECT [edets key], [edets no PR's] FROM [EVENT DETAILS] WHERE ( [edets key] =433)
Works ok, but
$sth = $db->prepare("SELECT [edets key], [edets no PR's] FROM [EVENT DETAILS] WHERE ( [edets key] = ?")
$sth->execute(433) fails with
BD::ODBC::st execute failed: called with 1 bind variables when 0 are needed.
Also
$sth = $db->prepare("SELECT [edets key] FROM [EVENT DETAILS] WHERE ( [edets key] = ?")
$sth->execute(433)
works fine.
At first glance this seems to be down to dbd_preparse in dbdimp.c.