The recent change to entity API/field collections that added in revision support broke entities (and field collections) for a site I had running on SQL Server 2008. Much debugging later, it turns out that SQL Server doesn't have support for the Boolean data type, which is used to check whether the current revision is the default one in EntityAPIController's buildQuery() function.
The included patch changes the
"SELECT base.{$this->revisionKey} = revision.{$this->revisionKey} AS {$this->defaultRevisionKey}"
query to
"SELECT CASE WHEN base.{$this->revisionKey} = revision.{$this->revisionKey} THEN 1 ELSE 0 END AS {$this->defaultRevisionKey}".
| Comment | File | Size | Author |
|---|---|---|---|
| entity.revisions_sql_server.patch | 744 bytes | torpy |
Comments
Comment #1
torpy commentedComment #2
askildolsen commentedRan into the same problem, and the supplied patch works for me on SQL Server 2012.
How will the patch work on other DBMSes, when it returns 0 and 1 instead of true/false?
Comment #3
torpy commentedIt should still work on MySQL/PostgreSQL :)
See - http://drupal.org/node/555540
Comment #4
rob_johnston commentedThis works for me with my bean creation problem #1917732: Incorrect syntax near '=' when creating a bean on MS SQL Server on Windows/IIS7/SQL Server 2008 and I also tested it with Linux/Apache2/MySQL without problems.
Comment #5
pabloroberto27 commentedThe patch solves the problem when using SQL Server 2008. Thanks a lot!
Comment #6
azinck commentedWorks for me on SQL Server 2012. Tentatively setting to RTBC due to the number of positive reviews.
Comment #7
fagoSounds resonable, but does this work with all support mysql, postgres versions also? Let's research/test that.
Comment #8
rymoUsing this patch in production, thank you.
Comment #9
rob_johnston commentedI've tested on PostGres 9.1.9 and, as expected, it works. Combined with comment #4 it has also been tested on mysql and sqlsrv, so RTBC now?
Comment #10
emudojo commentedI can attest that this works as expected
Comment #11
luukg commentedWorks with Oracle.
Comment #12
fagoentity.revisions_sql_server.patch queued for re-testing.
Comment #13
fagoaccording to the docs MySQL 5 shouldn't be problematic either, thus committed.