Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix FOR UPDATE SQL on SQL Anywhere #561

Merged
merged 1 commit into from

3 participants

Steve Müller doctrinebot Marco Pivetta
Steve Müller
Collaborator

It looks like there was a misunderstanding on SQL Anywhere with the FOR UPDATE SQL as this is actually a statement used in prepared statements and does not work the ANSI way in ORM. So I removed it in favour of the table lock hint implementation which works out quite well and makes the getForUpdateSQL() rather useless anyways. SQL Server does it like this, too btw and both dialects are pretty similar because SQL Anywhere once derived from it.

doctrinebot
Collaborator

Hello,

thank you for creating this pull request. I have automatically opened an issue
on our Jira Bug Tracker for you. See the issue link:

http://www.doctrine-project.org/jira/browse/DBAL-856

We use Jira to track the state of pull requests and the versions they got
included in.

Steve Müller
Collaborator

See the documentation for reference on that.

lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
@@ -697,7 +697,7 @@ public function getForeignKeyReferentialActionSQL($action)
*/
public function getForUpdateSQL()
{
- return 'FOR UPDATE BY LOCK';
+ return ' ';
Marco Pivetta Owner

@deeky666 any reason for it to be ' ' and not ''? I don't really get it

Steve Müller Collaborator

@Ocramius yeah you are right. Adopted it from SQLServerPlatform. Seems ORM is always prepending a space anyways. I'll change that, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Marco Pivetta Ocramius self-assigned this
Marco Pivetta Ocramius merged commit 6a120fb into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 31, 2014
  1. Steve Müller
This page is out of date. Refresh to see the latest.
2  lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View
@@ -697,7 +697,7 @@ public function getForeignKeyReferentialActionSQL($action)
*/
public function getForUpdateSQL()
{
- return 'FOR UPDATE BY LOCK';
+ return '';
}
/**
2  tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View
@@ -542,7 +542,7 @@ public function testGeneratesSQLSnippets()
$this->assertEquals("DATEADD(month, -1 * 102, '1987/05/02')", $this->_platform->getDateSubMonthExpression("'1987/05/02'", 102));
$this->assertEquals("Y-m-d H:i:s.u", $this->_platform->getDateTimeFormatString());
$this->assertEquals("H:i:s.u", $this->_platform->getTimeFormatString());
- $this->assertEquals('FOR UPDATE BY LOCK', $this->_platform->getForUpdateSQL());
+ $this->assertEquals('', $this->_platform->getForUpdateSQL());
$this->assertEquals('NEWID()', $this->_platform->getGuidExpression());
$this->assertEquals('CHARINDEX(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column'));
$this->assertEquals('CHARINDEX(substring_column, string_column)', $this->_platform->getLocateExpression('string_column', 'substring_column'));
Something went wrong with that request. Please try again.