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

Devline’s picture

Version: 7.x-1.x-dev » 7.x-1.1
sneyerst’s picture

I 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.

_randy’s picture

I 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.

pomgod’s picture

following

defigo’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

Finding the same problem here.

Following

D7.8 + SQL + IIS7 + 2008R2 + PHP 5.3.8

sneyerst’s picture

I 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.

sionescu’s picture

This 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.

sionescu’s picture

I'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.

sneyerst’s picture

I 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.

sionescu’s picture

Some 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

sneyerst’s picture

Status: Active » Needs review
designingsean’s picture

Curious 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.

nymo’s picture

This 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.

artusamak’s picture

Status: Needs review » Fixed

It 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.

alprz’s picture

So is the new dev version still compatible with Drupal core 7.2 ? Thanks in advance

artusamak’s picture

We 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

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

liezie_d’s picture

Version: 7.x-1.x-dev » 7.x-1.2

I had the same issue on 7.12.
The patch worked.

liezie_d’s picture

Issue summary: View changes

.