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
edddb0c8
Commit
edddb0c8
authored
Dec 02, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
97604279
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
48 additions
and
33 deletions
+48
-33
Compiler.php
lib/Doctrine/Compiler.php
+0
-2
Pessimistic.php
lib/Doctrine/Locking/Manager/Pessimistic.php
+47
-30
Table.php
lib/Doctrine/Table.php
+1
-1
No files found.
lib/Doctrine/Compiler.php
View file @
edddb0c8
...
...
@@ -36,7 +36,6 @@ class Doctrine_Compiler {
*/
private
static
$classes
=
array
(
'Access'
,
'Adapter_Exception'
,
'Adapter_Interface'
,
'Doctrine'
,
'Configurable'
,
...
...
@@ -45,7 +44,6 @@ class Doctrine_Compiler {
'Connection'
,
'Connection_Exception'
,
'Connection_UnitOfWork'
,
'Connection_Transaction'
,
'DB'
,
'DB_Exception'
,
'DB_EventListener'
,
...
...
lib/Doctrine/Locking/Manager/Pessimistic.php
View file @
edddb0c8
...
...
@@ -35,11 +35,11 @@
*/
class
Doctrine_Locking_Manager_Pessimistic
{
/**
* The
datasource
that is used by the locking manager
* The
conn
that is used by the locking manager
*
* @var Doctrine_Connection object
*/
private
$
_dataSource
;
private
$
conn
;
/**
* The database table name for the lock tracking
*/
...
...
@@ -51,20 +51,37 @@ class Doctrine_Locking_Manager_Pessimistic {
* When the CREATE_TABLES attribute of the connection on which the manager
* is supposed to work on is set to true, the locking table is created.
*
* @param Doctrine_Connection $
dataSource
The database connection to use
* @param Doctrine_Connection $
conn
The database connection to use
*/
public
function
__construct
(
Doctrine_Connection
$
dataSource
)
{
$this
->
_dataSource
=
$dataSource
;
public
function
__construct
(
Doctrine_Connection
$
conn
)
{
$this
->
conn
=
$conn
;
if
(
$this
->
_dataSource
->
getAttribute
(
Doctrine
::
ATTR_CREATE_TABLES
)
===
true
)
{
if
(
$this
->
conn
->
getAttribute
(
Doctrine
::
ATTR_CREATE_TABLES
)
===
true
)
{
$columns
=
array
();
$columns
[
'object_type'
]
=
array
(
'
string'
,
50
,
array
(
'notnull'
=>
true
,
'primary'
=>
true
));
$columns
[
'object_key'
]
=
array
(
'string'
,
250
,
array
(
'notnull'
=>
true
,
'primary'
=>
true
));
$columns
[
'user_ident'
]
=
array
(
'string'
,
50
,
array
(
'notnull'
=>
true
));
$columns
[
'timestamp_obtained'
]
=
array
(
'integer'
,
10
,
array
(
'notnull'
=>
true
)
);
$columns
[
'object_type'
]
=
array
(
'
type'
=>
'string'
,
'length'
=>
50
,
'notnull'
=>
true
,
'primary'
=>
true
);
$dataDict
=
new
Doctrine_DataDict
(
$this
->
_dataSource
->
getDBH
());
$dataDict
->
createTable
(
$this
->
_lockTable
,
$columns
);
$columns
[
'object_key'
]
=
array
(
'type'
=>
'string'
,
'length'
=>
250
,
'notnull'
=>
true
,
'primary'
=>
true
);
$columns
[
'user_ident'
]
=
array
(
'type'
=>
'string'
,
'length'
=>
50
,
'notnull'
=>
true
);
$columns
[
'timestamp_obtained'
]
=
array
(
'type'
=>
'integer'
,
'length'
=>
10
,
'notnull'
=>
true
);
$options
=
array
(
'primary'
=>
array
(
'object_type'
,
'object_key'
));
try
{
$this
->
conn
->
export
->
createTable
(
$this
->
_lockTable
,
$columns
,
$options
);
}
catch
(
Exception
$e
)
{
}
}
}
...
...
@@ -89,7 +106,7 @@ class Doctrine_Locking_Manager_Pessimistic {
}
try
{
$dbh
=
$this
->
_dataSource
->
getDBH
();
$dbh
=
$this
->
conn
->
getDBH
();
$dbh
->
beginTransaction
();
$stmt
=
$dbh
->
prepare
(
"INSERT INTO
$this->_lockTable
...
...
@@ -152,7 +169,7 @@ class Doctrine_Locking_Manager_Pessimistic {
}
try
{
$dbh
=
$this
->
_dataSource
->
getDBH
();
$dbh
=
$this
->
conn
->
getDbh
();
$stmt
=
$dbh
->
prepare
(
"DELETE FROM
$this->_lockTable
WHERE
object_type = :object_type AND
object_key = :object_key AND
...
...
@@ -185,7 +202,7 @@ class Doctrine_Locking_Manager_Pessimistic {
}
try
{
$dbh
=
$this
->
_dataSource
->
getDBH
();
$dbh
=
$this
->
conn
->
getDbh
();
$stmt
=
$dbh
->
prepare
(
"SELECT user_ident
FROM
$this->_lockTable
WHERE object_type = :object_type AND object_key = :object_key"
);
...
...
@@ -233,15 +250,15 @@ class Doctrine_Locking_Manager_Pessimistic {
$age
=
time
()
-
$age
;
try
{
$dbh
=
$this
->
_dataSource
->
getDBH
();
$stmt
=
$dbh
->
prepare
(
"DELETE FROM
$this->_lockTable
WHERE timestamp_obtained < :age"
);
$dbh
=
$this
->
conn
->
getDbh
();
$stmt
=
$dbh
->
prepare
(
'DELETE FROM '
.
$this
->
_lockTable
.
' WHERE timestamp_obtained < :age'
);
$stmt
->
bindParam
(
':age'
,
$age
);
$query
=
"DELETE FROM
$this->_lockTable
WHERE timestamp_obtained < :age"
;
$query
=
'DELETE FROM '
.
$this
->
_lockTable
.
' WHERE timestamp_obtained < :age'
;
if
(
$objectType
)
{
$query
.=
" AND object_type = :object_type"
;
$query
.=
' AND object_type = :object_type'
;
}
if
(
$userIdent
)
{
$query
.=
" AND user_ident = :user_ident"
;
$query
.=
' AND user_ident = :user_ident'
;
}
$stmt
=
$dbh
->
prepare
(
$query
);
$stmt
->
bindParam
(
':age'
,
$age
);
...
...
lib/Doctrine/Table.php
View file @
edddb0c8
...
...
@@ -775,7 +775,7 @@ class Doctrine_Table extends Doctrine_Configurable implements Countable {
* @return string
*/
final
public
function
getTableName
()
{
return
$this
->
options
[
'tableName'
]
;
return
$this
->
conn
->
quoteIdentifier
(
$this
->
options
[
'tableName'
])
;
}
/**
* create
...
...
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