Creating a bean using sqlsrv as the database results in the following error:

PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]
Incorrect syntax near '='.: 
  SELECT revision.[vid] AS [vid], 
    revision.[uid] AS [uid], 
    revision.[delta] AS [delta], 
    revision.[label] AS [label], 
    revision.[title] AS [title], 
    revision.[type] AS [type], 
    revision.[view_mode] AS [view_mode], 
    revision.[data] AS [data], revision.[log] AS [log], 
    revision.[created] AS [created], 
    revision.[changed] AS [changed], 
    base.[bid] AS [bid], 
    base.vid = revision.vid AS default_revision
  FROM {bean} base 
    INNER JOIN {bean_revision} revision ON revision.vid = base.vid 
  WHERE ( ([base].[delta] IN (:db_condition_placeholder_0)) ); 
Array ( [:db_condition_placeholder_0] => TEST1 ) 
in EntityAPIController->query() 
(line 187 of C:\inetpub\wwwroot\drupal_wet\profiles\wetkit\modules\contrib\entity\includes\entity.controller.inc).

The offending SQL is the equals sign in the selected parameter right before the FROM clause, base.vid = revision.vid AS default_revision. It should be either base.vid AS default_revision or revision.vid AS default_revision.

Comments

indytechcook’s picture

Thanks for logging the issue rob. This is most likely an issue with one of the upstream driver. The entity module builds the db_select but the MSSQL driver is what actually creates the SQL sytax.

I'm assuming you are using this driver? http://drupal.org/project/sqlsrv.

I haven't seen this with the mysql driver but just to make sure I'll look into it before I pass it off.

rob_johnston’s picture

Thanks for the quick response, and yes, I am using the sqlsrv driver.

rob_johnston’s picture

Status: Active » Closed (duplicate)

Looks like it has indeed been logged as an error with the entity module:
#1940296: Maybe a wrong query base.revision_id = revision.revision_id AS default_revision

I'm going to close this and go over there