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
4b7a4a0e
Commit
4b7a4a0e
authored
May 24, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
525e7d74
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
Pessimistic.php
lib/Doctrine/Locking/Manager/Pessimistic.php
+12
-11
No files found.
lib/Doctrine/Locking/Manager/Pessimistic.php
View file @
4b7a4a0e
...
...
@@ -113,9 +113,10 @@ class Doctrine_Locking_Manager_Pessimistic
$dbh
=
$this
->
conn
->
getDbh
();
$dbh
->
beginTransaction
();
$stmt
=
$dbh
->
prepare
(
"INSERT INTO
$this->_lockTable
(object_type, object_key, user_ident, timestamp_obtained)
VALUES (:object_type, :object_key, :user_ident, :ts_obtained)"
);
$stmt
=
$dbh
->
prepare
(
'INSERT INTO '
.
$this
->
_lockTable
.
' (object_type, object_key, user_ident, timestamp_obtained)'
.
' VALUES (:object_type, :object_key, :user_ident, :ts_obtained)'
);
$stmt
->
bindParam
(
':object_type'
,
$objectType
);
$stmt
->
bindParam
(
':object_key'
,
$key
);
$stmt
->
bindParam
(
':user_ident'
,
$userIdent
);
...
...
@@ -130,15 +131,16 @@ class Doctrine_Locking_Manager_Pessimistic
// PK violation occured => existing lock!
}
if
(
!
$gotLock
)
{
if
(
!
$gotLock
)
{
$lockingUserIdent
=
$this
->
_getLockingUserIdent
(
$objectType
,
$key
);
if
(
$lockingUserIdent
!==
null
&&
$lockingUserIdent
==
$userIdent
)
{
$gotLock
=
true
;
// The requesting user already has a lock
// Update timestamp
$stmt
=
$dbh
->
prepare
(
"UPDATE
$this->_lockTable
SET timestamp_obtained = :ts
WHERE object_type = :object_type AND
object_key = :object_key AND
user_ident = :user_ident"
);
$stmt
=
$dbh
->
prepare
(
'UPDATE '
.
$this
->
_lockTable
.
' SET timestamp_obtained = :ts'
.
' WHERE object_type = :object_type AND'
.
' object_key = :object_key AND'
.
' user_ident = :user_ident'
);
$stmt
->
bindParam
(
':ts'
,
$time
);
$stmt
->
bindParam
(
':object_type'
,
$objectType
);
$stmt
->
bindParam
(
':object_key'
,
$key
);
...
...
@@ -209,9 +211,8 @@ class Doctrine_Locking_Manager_Pessimistic
try
{
$dbh
=
$this
->
conn
->
getDbh
();
$stmt
=
$dbh
->
prepare
(
"SELECT user_ident
FROM
$this->_lockTable
WHERE object_type = :object_type AND object_key = :object_key"
);
$stmt
=
$dbh
->
prepare
(
'SELECT user_ident FROM '
.
$this
->
_lockTable
.
' WHERE object_type = :object_type AND object_key = :object_key'
);
$stmt
->
bindParam
(
':object_type'
,
$objectType
);
$stmt
->
bindParam
(
':object_key'
,
$key
);
$success
=
$stmt
->
execute
();
...
...
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