Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
e107b015
Commit
e107b015
authored
Jan 13, 2014
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix table lock hints on SQL Anywhere
parent
2790ee79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
29 deletions
+24
-29
SQLAnywherePlatform.php
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
+7
-11
SQLAnywherePlatformTest.php
...Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
+17
-18
No files found.
lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
View file @
e107b015
...
@@ -60,26 +60,22 @@ class SQLAnywherePlatform extends AbstractPlatform
...
@@ -60,26 +60,22 @@ class SQLAnywherePlatform extends AbstractPlatform
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*
* @throws \InvalidArgumentException
*/
*/
public
function
appendLockHint
(
$fromClause
,
$lockMode
)
public
function
appendLockHint
(
$fromClause
,
$lockMode
)
{
{
switch
(
true
)
{
switch
(
true
)
{
case
$lockMode
===
LockMode
::
NONE
:
case
$lockMode
===
LockMode
::
NONE
:
$lockClause
=
' WITH (NOLOCK)'
;
return
$fromClause
.
' WITH (NOLOCK)'
;
break
;
case
$lockMode
===
LockMode
::
PESSIMISTIC_READ
:
case
$lockMode
===
LockMode
::
PESSIMISTIC_READ
:
$lockClause
=
' WITH (UPDLOCK)'
;
return
$fromClause
.
' WITH (UPDLOCK)'
;
break
;
case
$lockMode
===
LockMode
::
PESSIMISTIC_WRITE
:
case
$lockMode
===
LockMode
::
PESSIMISTIC_WRITE
:
$lockClause
=
' WITH (XLOCK)'
;
return
$fromClause
.
' WITH (XLOCK)'
;
break
;
default
:
default
:
throw
new
\InvalidArgumentException
(
'Invalid lock mode: '
.
$lockMode
)
;
return
$fromClause
;
}
}
return
$fromClause
.
$lockClause
;
}
}
/**
/**
...
...
tests/Doctrine/Tests/DBAL/Platforms/SQLAnywherePlatformTest.php
View file @
e107b015
...
@@ -220,29 +220,28 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
...
@@ -220,29 +220,28 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
);
);
}
}
public
function
testAppendsLockHints
()
/**
* @dataProvider getLockHints
*/
public
function
testAppendsLockHint
(
$lockMode
,
$lockHint
)
{
{
$fromClause
=
'SELECT * FROM lock_hints'
;
$fromClause
=
'FROM users'
;
$expectedResult
=
$fromClause
.
$lockHint
;
$this
->
assertEquals
(
$this
->
assertSame
(
$expectedResult
,
$this
->
_platform
->
appendLockHint
(
$fromClause
,
$lockMode
));
$fromClause
.
' WITH (NOLOCK)'
,
$this
->
_platform
->
appendLockHint
(
$fromClause
,
LockMode
::
NONE
)
);
$this
->
assertEquals
(
$fromClause
.
' WITH (UPDLOCK)'
,
$this
->
_platform
->
appendLockHint
(
$fromClause
,
LockMode
::
PESSIMISTIC_READ
)
);
$this
->
assertEquals
(
$fromClause
.
' WITH (XLOCK)'
,
$this
->
_platform
->
appendLockHint
(
$fromClause
,
LockMode
::
PESSIMISTIC_WRITE
)
);
}
}
public
function
testCannotAppendInvalidLockHint
()
public
function
getLockHints
()
{
{
$this
->
setExpectedException
(
'\InvalidArgumentException'
);
return
array
(
array
(
null
,
''
),
$this
->
_platform
->
appendLockHint
(
'SELECT * FROM lock_hints'
,
'invalid_lock_mode'
);
array
(
false
,
''
),
array
(
true
,
''
),
array
(
LockMode
::
NONE
,
' WITH (NOLOCK)'
),
array
(
LockMode
::
OPTIMISTIC
,
''
),
array
(
LockMode
::
PESSIMISTIC_READ
,
' WITH (UPDLOCK)'
),
array
(
LockMode
::
PESSIMISTIC_WRITE
,
' WITH (XLOCK)'
),
);
}
}
public
function
testHasCorrectMaxIdentifierLength
()
public
function
testHasCorrectMaxIdentifierLength
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment