Closed (fixed)
Project:
Drupal driver for SQL Server and SQL Azure
Version:
7.x-1.2
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Sep 2011 at 20:32 UTC
Updated:
19 Apr 2012 at 16:59 UTC
Since I installed Drupal 7.8, I get an 'Exception: SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in views_plugin_query_default->execute()' when adding a filter on a taxonomy term in a view. Everything was doing fine with Drupal 7.7 with the same configuration. Any idea ?
Current setup : Sqlsrv 7.x-1.1 (I was unable to install the 08/24 dev version due to another exception #1261324: PDOException: Can not find column "dbo" function or user-defined aggregate "dbo.SUBSTRING".) , Views 7.x-3.x-dev (09/21/2011), ctools 7.x-1.x-dev (09/17/2011)
Comments
Comment #1
Devline commentedComment #2
sneyerst commentedI have been investigating a similar problem (also on SQL Server) concerning views in combination with node references (with a defined node-reference relationship). Up to this point, I still do not have a solution. But I do have some pointers about the issue I was investigating (with the same error message as a result).
By casting the SelectQuery object to a string, I see 3 parameter placeholder being generated: :views_join_condition_0, :views_join_condition_1 and :db_condition_placeholder_2.
The generated arguments for this query are generated with following id's: :views_join_condition_0, :views_join_condition_1 and :db_condition_placeholder_0, which is different from the query's placeholder id's.
I am not sure what the Drupal-way is about auto generated placeholder names, but I would say the sqlsrv module generates the names wrong in one of the __toString() functions since there are no problems with the same setup on MySQL.
I'm still investigating the issue, I'll come back with updates if I find more.
Comment #3
_randy commentedI have the exact same issue with my module: http://drupal.org/node/1291460#comment-5041032
The functionality I note in my module's bug entry is exactly as stated above -- the placeholder IDs are misaligned to the actual array parameter's keys.
Comment #4
pomgod commentedfollowing
Comment #5
defigo commentedFinding the same problem here.
Following
D7.8 + SQL + IIS7 + 2008R2 + PHP 5.3.8
Comment #6
sneyerst commentedI checked one of the error-generating views on a LAMP stack and it seems like the way-to-go concerning query placeholders (in the situation I posted earlier) is: views_join_condition_0, :views_join_condition_1 and :db_condition_placeholder_2.
This means that the arguments are generated with a wrong placeholder id.
Comment #7
sionescu commentedThis also happens with the Oracle driver, and it's not just a Views issue. It occurs with dynamic queries that have conditions on different sub-queries.
I believe it's a core 7.8 issue or generated by the way drivers are written for 7.8.
Comment #8
sionescu commentedI'm not sure about your specific implementation but someone might take a look here http://drupal.org/node/1153174#comment-5087682 and adapt that if it turns out to be valid.
Comment #9
sneyerst commentedI tested the patch file provided by sionescu at http://drupal.org/node/1153174#comment-5087682 and I can confirm that the error is gone now. After some first initial tests, it seems like all is working fine.
Comment #10
sionescu commentedSome Database conditions may not be precompiled so we check and compile only if required. So i've created another patch for that, please view the Oracle thread:
http://drupal.org/node/1153174#comment-5090136
Comment #11
sneyerst commentedA patch can be found at http://drupal.org/node/1153174#comment-5097508.
Comment #12
designingsean commentedCurious if this issue is ever going to find its way in to the SQL Server driver officially. I don't mind hand patching, but I would prefer it be integrated in to the driver by the maintainers and then an update released. Especially when the recommended patch is coming from a non-SQL Server driver.
Comment #13
nymo commentedThis problem still happens for me with the patch applied.
D7.8 + IIS 2008 R2 v6.1 + php 5.2.17.
UPDATE: nm, i didn't RTFM.
Comment #14
artusamakIt appears that the implementation of the placeholders generation has been rewritting in Drupal 7.8 release, to be consistent with that here is the commit fixing this issue:
http://drupalcode.org/project/sqlsrv.git/commitdiff/ff2d65e27fbcbcb0ca9b...
Thanks for reporting.
Comment #15
alprz commentedSo is the new dev version still compatible with Drupal core 7.2 ? Thanks in advance
Comment #16
artusamakWe are only rolling the patch against the latest version of core. I can not answer your question and you should upgrade your core to 7.10 because you missed security releases.
I invite you to follow the upgrade guides to learn how to do it if your are not familiar with the upgrade process: http://drupal.org/node/1223018
Comment #18
liezie_d commentedI had the same issue on 7.12.
The patch worked.
Comment #18.0
liezie_d commented.