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
034744ca
Commit
034744ca
authored
Aug 21, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
f10d1fca
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
99 additions
and
99 deletions
+99
-99
Collection.php
Doctrine/Collection.php
+7
-7
Configurable.php
Doctrine/Configurable.php
+6
-6
EventListener.php
Doctrine/EventListener.php
+9
-9
Hydrate.php
Doctrine/Hydrate.php
+9
-9
Lib.php
Doctrine/Lib.php
+19
-19
Manager.php
Doctrine/Manager.php
+26
-26
Module.php
Doctrine/Module.php
+2
-2
Query.php
Doctrine/Query.php
+5
-5
RawSql.php
Doctrine/RawSql.php
+1
-1
Record.php
Doctrine/Record.php
+14
-14
View.php
Doctrine/View.php
+1
-1
No files found.
Doctrine/Collection.php
View file @
034744ca
...
...
@@ -75,7 +75,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$table
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnection
()
->
getTable
(
$table
);
$this
->
table
=
$table
;
$name
=
$table
->
getAttribute
(
Doctrine
::
ATTR_COLL_KEY
);
...
...
@@ -122,7 +122,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
*/
public
function
unserialize
(
$serialized
)
{
$manager
=
Doctrine_Manager
::
getInstance
();
$
session
=
$manager
->
getCurrentSess
ion
();
$
connection
=
$manager
->
getCurrentConnect
ion
();
$array
=
unserialize
(
$serialized
);
...
...
@@ -130,7 +130,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$this
->
$name
=
$values
;
}
$this
->
table
=
$
sess
ion
->
getTable
(
$this
->
table
);
$this
->
table
=
$
connect
ion
->
getTable
(
$this
->
table
);
$this
->
expanded
=
array
();
$this
->
expandable
=
true
;
...
...
@@ -287,7 +287,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
$query
=
"SELECT "
.
$foreign
.
" FROM "
.
$asf
->
getTableName
()
.
" WHERE "
.
$local
.
"="
.
$this
->
getIncremented
();
$table
=
$fk
->
getTable
();
$graph
=
new
Doctrine_Query
(
$table
->
get
Sess
ion
());
$graph
=
new
Doctrine_Query
(
$table
->
get
Connect
ion
());
$q
=
"FROM "
.
$table
->
getComponentName
()
.
" WHERE "
.
$table
->
getComponentName
()
.
"."
.
$table
->
getIdentifier
()
.
" IN (
$query
)"
;
...
...
@@ -526,7 +526,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
* @param mixed $name
*/
public
function
loadRelated
(
$name
=
null
)
{
$query
=
new
Doctrine_Query
(
$this
->
table
->
get
Sess
ion
());
$query
=
new
Doctrine_Query
(
$this
->
table
->
get
Connect
ion
());
if
(
!
isset
(
$name
))
{
foreach
(
$this
->
data
as
$record
)
:
...
...
@@ -639,7 +639,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
* @return void
*/
public
function
save
()
{
$this
->
table
->
get
Sess
ion
()
->
saveCollection
(
$this
);
$this
->
table
->
get
Connect
ion
()
->
saveCollection
(
$this
);
}
/**
* single shot delete
...
...
@@ -648,7 +648,7 @@ class Doctrine_Collection extends Doctrine_Access implements Countable, Iterator
* @return boolean
*/
public
function
delete
()
{
$ids
=
$this
->
table
->
get
Sess
ion
()
->
deleteCollection
(
$this
);
$ids
=
$this
->
table
->
get
Connect
ion
()
->
deleteCollection
(
$this
);
$this
->
data
=
array
();
}
/**
...
...
Doctrine/Configurable.php
View file @
034744ca
...
...
@@ -20,7 +20,7 @@
*/
/**
* Doctrine_Configurable
* the base for Doctrine_Table, Doctrine_Manager and Doctrine_
Sess
ion
* the base for Doctrine_Table, Doctrine_Manager and Doctrine_
Connect
ion
*
*
* @package Doctrine ORM
...
...
@@ -89,17 +89,17 @@ abstract class Doctrine_Configurable {
break
;
case
Doctrine
::
ATTR_LOCKMODE
:
if
(
$this
instanceof
Doctrine_
Sess
ion
)
{
if
(
$this
->
getState
()
!=
Doctrine_
Sess
ion
::
STATE_OPEN
)
if
(
$this
instanceof
Doctrine_
Connect
ion
)
{
if
(
$this
->
getState
()
!=
Doctrine_
Connect
ion
::
STATE_OPEN
)
throw
new
Doctrine_Exception
(
"Couldn't set lockmode. There are transactions open."
);
}
elseif
(
$this
instanceof
Doctrine_Manager
)
{
foreach
(
$this
as
$
sess
ion
)
{
if
(
$
session
->
getState
()
!=
Doctrine_Sess
ion
::
STATE_OPEN
)
foreach
(
$this
as
$
connect
ion
)
{
if
(
$
connection
->
getState
()
!=
Doctrine_Connect
ion
::
STATE_OPEN
)
throw
new
Doctrine_Exception
(
"Couldn't set lockmode. There are transactions open."
);
}
}
else
{
throw
new
Doctrine_Exception
(
"Lockmode attribute can only be set at the global or
sess
ion level."
);
throw
new
Doctrine_Exception
(
"Lockmode attribute can only be set at the global or
connect
ion level."
);
}
break
;
case
Doctrine
::
ATTR_CREATE_TABLES
:
...
...
Doctrine/EventListener.php
View file @
034744ca
...
...
@@ -45,19 +45,19 @@ abstract class Doctrine_EventListener implements Doctrine_EventListener_Interfac
public
function
onDeleteCascade
(
Doctrine_Record
$record
)
{
}
public
function
onPreDeleteCascade
(
Doctrine_Record
$record
)
{
}
public
function
onClose
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onPreClose
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onClose
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onPreClose
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onOpen
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onOpen
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onTransactionCommit
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onPreTransactionCommit
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onTransactionCommit
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onPreTransactionCommit
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onTransactionRollback
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onPreTransactionRollback
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onTransactionRollback
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onPreTransactionRollback
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onTransactionBegin
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onPreTransactionBegin
(
Doctrine_
Session
$sess
ion
)
{
}
public
function
onTransactionBegin
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onPreTransactionBegin
(
Doctrine_
Connection
$connect
ion
)
{
}
public
function
onCollectionDelete
(
Doctrine_Collection
$collection
)
{
}
public
function
onPreCollectionDelete
(
Doctrine_Collection
$collection
)
{
}
...
...
Doctrine/Hydrate.php
View file @
034744ca
...
...
@@ -50,9 +50,9 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
*/
protected
$data
=
array
();
/**
* @var Doctrine_
Session $session Doctrine_Sess
ion object
* @var Doctrine_
Connection $connection Doctrine_Connect
ion object
*/
protected
$
sess
ion
;
protected
$
connect
ion
;
/**
* @var Doctrine_View $view Doctrine_View object
*/
...
...
@@ -90,10 +90,10 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
* @param Doctrine_Connection|null $connection
*/
public
function
__construct
(
$connection
=
null
)
{
if
(
!
(
$connection
instanceof
Doctrine_
Sess
ion
))
if
(
!
(
$connection
instanceof
Doctrine_
Connect
ion
))
$connection
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnection
();
$this
->
sess
ion
=
$connection
;
$this
->
connect
ion
=
$connection
;
}
/**
* getQuery
...
...
@@ -151,10 +151,10 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
$this
->
tableAliases
=
array
();
}
/**
* @return Doctrine_
Sess
ion
* @return Doctrine_
Connect
ion
*/
public
function
get
Sess
ion
()
{
return
$this
->
sess
ion
;
public
function
get
Connect
ion
()
{
return
$this
->
connect
ion
;
}
/**
* setView
...
...
@@ -255,7 +255,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
$keys
=
array_keys
(
$this
->
tables
);
$name
=
$this
->
tables
[
$keys
[
0
]]
->
getComponentName
();
$stmt
=
$this
->
sess
ion
->
execute
(
$query
,
$params
);
$stmt
=
$this
->
connect
ion
->
execute
(
$query
,
$params
);
while
(
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
))
:
foreach
(
$data
as
$key
=>
$value
)
:
...
...
@@ -279,7 +279,7 @@ abstract class Doctrine_Hydrate extends Doctrine_Access {
if
(
$this
->
isLimitSubqueryUsed
())
$params
=
array_merge
(
$params
,
$params
);
$stmt
=
$this
->
sess
ion
->
execute
(
$query
,
$params
);
$stmt
=
$this
->
connect
ion
->
execute
(
$query
,
$params
);
$previd
=
array
();
...
...
Doctrine/Lib.php
View file @
034744ca
...
...
@@ -68,40 +68,40 @@ class Doctrine_Lib {
}
/**
* getStateAsString
* returns a given
sess
ion state as string
* @param integer $state
sess
ion state
* returns a given
connect
ion state as string
* @param integer $state
connect
ion state
*/
public
static
function
get
Sess
ionStateAsString
(
$state
)
{
public
static
function
get
Connect
ionStateAsString
(
$state
)
{
switch
(
$state
)
:
case
Doctrine_
Sess
ion
::
STATE_OPEN
:
case
Doctrine_
Connect
ion
::
STATE_OPEN
:
return
"open"
;
break
;
case
Doctrine_
Sess
ion
::
STATE_CLOSED
:
case
Doctrine_
Connect
ion
::
STATE_CLOSED
:
return
"closed"
;
break
;
case
Doctrine_
Sess
ion
::
STATE_BUSY
:
case
Doctrine_
Connect
ion
::
STATE_BUSY
:
return
"busy"
;
break
;
case
Doctrine_
Sess
ion
::
STATE_ACTIVE
:
case
Doctrine_
Connect
ion
::
STATE_ACTIVE
:
return
"active"
;
break
;
endswitch
;
}
/**
* returns a string representation of Doctrine_
Sess
ion object
* @param Doctrine_
Session $sess
ion
* returns a string representation of Doctrine_
Connect
ion object
* @param Doctrine_
Connection $connect
ion
* @return string
*/
public
static
function
get
SessionAsString
(
Doctrine_Session
$sess
ion
)
{
public
static
function
get
ConnectionAsString
(
Doctrine_Connection
$connect
ion
)
{
$r
[]
=
"<pre>"
;
$r
[]
=
"Doctrine_
Sess
ion object"
;
$r
[]
=
"State : "
.
Doctrine_Lib
::
get
SessionStateAsString
(
$sess
ion
->
getState
());
$r
[]
=
"Open Transactions : "
.
$
sess
ion
->
getTransactionLevel
();
$r
[]
=
"Open Factories : "
.
$
sess
ion
->
count
();
$r
[]
=
"Doctrine_
Connect
ion object"
;
$r
[]
=
"State : "
.
Doctrine_Lib
::
get
ConnectionStateAsString
(
$connect
ion
->
getState
());
$r
[]
=
"Open Transactions : "
.
$
connect
ion
->
getTransactionLevel
();
$r
[]
=
"Open Factories : "
.
$
connect
ion
->
count
();
$sum
=
0
;
$rsum
=
0
;
$csum
=
0
;
foreach
(
$
sess
ion
->
getTables
()
as
$objTable
)
{
foreach
(
$
connect
ion
->
getTables
()
as
$objTable
)
{
if
(
$objTable
->
getCache
()
instanceof
Doctrine_Cache_File
)
{
$sum
+=
array_sum
(
$objTable
->
getCache
()
->
getStats
());
$rsum
+=
$objTable
->
getRepository
()
->
count
();
...
...
@@ -113,11 +113,11 @@ class Doctrine_Lib {
$r
[]
=
"Repositories : "
.
$rsum
.
" objects "
;
$queries
=
false
;
if
(
$
sess
ion
->
getDBH
()
instanceof
Doctrine_DB
)
{
if
(
$
connect
ion
->
getDBH
()
instanceof
Doctrine_DB
)
{
$handler
=
"Doctrine Database Handler"
;
$queries
=
count
(
$
sess
ion
->
getDBH
()
->
getQueries
());
$sum
=
array_sum
(
$
sess
ion
->
getDBH
()
->
getExecTimes
());
}
elseif
(
$
sess
ion
->
getDBH
()
instanceof
PDO
)
{
$queries
=
count
(
$
connect
ion
->
getDBH
()
->
getQueries
());
$sum
=
array_sum
(
$
connect
ion
->
getDBH
()
->
getExecTimes
());
}
elseif
(
$
connect
ion
->
getDBH
()
instanceof
PDO
)
{
$handler
=
"PHP Native PDO Driver"
;
}
else
$handler
=
"Unknown Database Handler"
;
...
...
Doctrine/Manager.php
View file @
034744ca
...
...
@@ -26,7 +26,7 @@ require_once("EventListener.php");
* @license LGPL
*
* Doctrine_Manager is the base component of all doctrine based projects.
* It opens and keeps track of all
sess
ions (database connections).
* It opens and keeps track of all
connect
ions (database connections).
*/
class
Doctrine_Manager
extends
Doctrine_Configurable
implements
Countable
,
IteratorAggregate
{
/**
...
...
@@ -38,7 +38,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
*/
private
$index
=
0
;
/**
* @var integer $currIndex the current
sess
ion index
* @var integer $currIndex the current
connect
ion index
*/
private
$currIndex
=
0
;
/**
...
...
@@ -144,11 +144,11 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
/**
* openConnection
* opens a new connection and saves it to Doctrine_Manager->
sess
ions
* opens a new connection and saves it to Doctrine_Manager->
connect
ions
*
* @param PDO $pdo PDO database driver
* @param string $name name of the connection, if empty numeric key is used
* @return Doctrine_
Sess
ion
* @return Doctrine_
Connect
ion
*/
public
function
openConnection
(
PDO
$pdo
,
$name
=
null
)
{
// initialize the default attributes
...
...
@@ -157,7 +157,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
if
(
$name
!==
null
)
{
$name
=
(
string
)
$name
;
if
(
isset
(
$this
->
connections
[
$name
]))
throw
new
InvalidKeyException
(
);
throw
new
Doctrine_Exception
(
"Connection with
$name
already exists!"
);
}
else
{
$name
=
$this
->
index
;
...
...
@@ -165,25 +165,25 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
switch
(
$pdo
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
))
:
case
"mysql"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Mysql
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Mysql
(
$this
,
$pdo
);
break
;
case
"sqlite"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Sqlite
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Sqlite
(
$this
,
$pdo
);
break
;
case
"pgsql"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Pgsql
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Pgsql
(
$this
,
$pdo
);
break
;
case
"oci"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Oracle
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Oracle
(
$this
,
$pdo
);
break
;
case
"mssql"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Mssql
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Mssql
(
$this
,
$pdo
);
break
;
case
"firebird"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Firebird
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Firebird
(
$this
,
$pdo
);
break
;
case
"informix"
:
$this
->
connections
[
$name
]
=
new
Doctrine_
Sess
ion_Informix
(
$this
,
$pdo
);
$this
->
connections
[
$name
]
=
new
Doctrine_
Connect
ion_Informix
(
$this
,
$pdo
);
break
;
endswitch
;
...
...
@@ -195,9 +195,9 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
return
$this
->
openConnection
(
$pdo
,
$name
);
}
/**
* get
Sess
ion
* get
Connect
ion
* @param integer $index
* @return object Doctrine_
Sess
ion
* @return object Doctrine_
Connect
ion
* @throws InvalidKeyException
*/
public
function
getConnection
(
$index
)
{
...
...
@@ -210,16 +210,16 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
public
function
getSession
(
$index
)
{
return
$this
->
getConnection
(
$index
);
}
/**
* closes the
sess
ion
* closes the
connect
ion
*
* @param Doctrine_
Session $sess
ion
* @param Doctrine_
Connection $connect
ion
* @return void
*/
public
function
closeConnection
(
Doctrine_
Session
$sess
ion
)
{
$
sess
ion
->
close
();
unset
(
$
sess
ion
);
public
function
closeConnection
(
Doctrine_
Connection
$connect
ion
)
{
$
connect
ion
->
close
();
unset
(
$
connect
ion
);
}
public
function
closeSession
(
Doctrine_
Session
$session
)
{
$this
->
closeConnection
(
$sess
ion
);
}
public
function
closeSession
(
Doctrine_
Connection
$connection
)
{
$this
->
closeConnection
(
$connect
ion
);
}
/**
* getConnections
* returns all opened connections
...
...
@@ -252,7 +252,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
/**
* count
* returns the number of opened
sess
ions
* returns the number of opened
connect
ions
*
* @return integer
*/
...
...
@@ -261,7 +261,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
/**
* getIterator
* returns an ArrayIterator that iterates through all
sess
ions
* returns an ArrayIterator that iterates through all
connect
ions
*
* @return ArrayIterator
*/
...
...
@@ -272,13 +272,13 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* getCurrentConnection
* returns the current connection
*
* @throws Doctrine_
Session_Exception if there are no open sess
ions
* @return Doctrine_
Sess
ion
* @throws Doctrine_
Connection_Exception if there are no open connect
ions
* @return Doctrine_
Connect
ion
*/
public
function
getCurrentConnection
()
{
$i
=
$this
->
currIndex
;
if
(
!
isset
(
$this
->
connections
[
$i
]))
throw
new
Doctrine_
Sess
ion_Exception
();
throw
new
Doctrine_
Connect
ion_Exception
();
return
$this
->
connections
[
$i
];
}
...
...
@@ -292,7 +292,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
public
function
__toString
()
{
$r
[]
=
"<pre>"
;
$r
[]
=
"Doctrine_Manager"
;
$r
[]
=
"
Sess
ions : "
.
count
(
$this
->
connections
);
$r
[]
=
"
Connect
ions : "
.
count
(
$this
->
connections
);
$r
[]
=
"</pre>"
;
return
implode
(
"
\n
"
,
$r
);
}
...
...
Doctrine/Module.php
View file @
034744ca
...
...
@@ -31,9 +31,9 @@ class Doctrine_Module implements IteratorAggregate, Countable {
* @return void
*/
public
function
flush
()
{
$
session
=
Doctrine_Manager
::
getInstance
()
->
getCurrentSess
ion
();
$
connection
=
Doctrine_Manager
::
getInstance
()
->
getCurrentConnect
ion
();
$tree
=
$
sess
ion
->
buildFlushTree
(
$this
->
components
);
$tree
=
$
connect
ion
->
buildFlushTree
(
$this
->
components
);
}
/**
* getIterator
...
...
Doctrine/Query.php
View file @
034744ca
...
...
@@ -68,7 +68,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
if
(
!
empty
(
$having
))
$q
.=
" HAVING "
.
implode
(
' AND '
,
$having
);
$a
=
$this
->
get
Sess
ion
()
->
execute
(
$q
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
$a
=
$this
->
get
Connect
ion
()
->
execute
(
$q
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
return
$a
[
0
];
}
/**
...
...
@@ -320,7 +320,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
$modifyLimit
=
false
;
if
(
!
empty
(
$this
->
parts
[
"limit"
])
||
!
empty
(
$this
->
parts
[
"offset"
]))
{
if
(
$needsSubQuery
)
{
$subquery
=
$this
->
sess
ion
->
modifyLimitQuery
(
$subquery
,
$this
->
parts
[
"limit"
],
$this
->
parts
[
"offset"
]);
$subquery
=
$this
->
connect
ion
->
modifyLimitQuery
(
$subquery
,
$this
->
parts
[
"limit"
],
$this
->
parts
[
"offset"
]);
$field
=
$table
->
getTableName
()
.
'.'
.
$table
->
getIdentifier
();
array_unshift
(
$this
->
parts
[
'where'
],
$field
.
' IN ('
.
$subquery
.
')'
);
...
...
@@ -333,7 +333,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
$q
.=
(
!
empty
(
$this
->
parts
[
'having'
]))
?
" HAVING "
.
implode
(
" "
,
$this
->
parts
[
"having"
])
:
''
;
$q
.=
(
!
empty
(
$this
->
parts
[
'orderby'
]))
?
" ORDER BY "
.
implode
(
" "
,
$this
->
parts
[
"orderby"
])
:
''
;
if
(
$modifyLimit
)
$q
=
$this
->
sess
ion
->
modifyLimitQuery
(
$q
,
$this
->
parts
[
"limit"
],
$this
->
parts
[
"offset"
]);
$q
=
$this
->
connect
ion
->
modifyLimitQuery
(
$q
,
$this
->
parts
[
"limit"
],
$this
->
parts
[
"offset"
]);
// return to the previous state
if
(
!
empty
(
$string
))
...
...
@@ -358,7 +358,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
if
(
$this
->
aggregate
)
{
$keys
=
array_keys
(
$this
->
tables
);
$query
=
$this
->
getQuery
();
$stmt
=
$this
->
tables
[
$keys
[
0
]]
->
get
Sess
ion
()
->
select
(
$query
,
$this
->
parts
[
"limit"
],
$this
->
parts
[
"offset"
]);
$stmt
=
$this
->
tables
[
$keys
[
0
]]
->
get
Connect
ion
()
->
select
(
$query
,
$this
->
parts
[
"limit"
],
$this
->
parts
[
"offset"
]);
$data
=
$stmt
->
fetch
(
PDO
::
FETCH_ASSOC
);
if
(
count
(
$data
)
==
1
)
{
return
current
(
$data
);
...
...
@@ -573,7 +573,7 @@ class Doctrine_Query extends Doctrine_Hydrate {
if
(
$key
==
0
)
{
$currPath
=
substr
(
$currPath
,
1
);
$table
=
$this
->
sess
ion
->
getTable
(
$name
);
$table
=
$this
->
connect
ion
->
getTable
(
$name
);
$tname
=
$table
->
getTableName
();
...
...
Doctrine/RawSql.php
View file @
034744ca
...
...
@@ -203,7 +203,7 @@ class Doctrine_RawSql extends Doctrine_Hydrate {
else
$alias
=
$tableAlias
;
$table
=
$this
->
sess
ion
->
getTable
(
$component
);
$table
=
$this
->
connect
ion
->
getTable
(
$component
);
$this
->
tables
[
$alias
]
=
$table
;
$this
->
fetchModes
[
$alias
]
=
Doctrine
::
FETCH_IMMEDIATE
;
$this
->
tableAliases
[
$currPath
]
=
$alias
;
...
...
Doctrine/Record.php
View file @
034744ca
...
...
@@ -141,23 +141,23 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
/**
* constructor
* @param Doctrine_Table $table a Doctrine_Table object
* @throws Doctrine_
Sess
ion_Exception if object is created using the new operator and there are no
* open
sess
ions
* @throws Doctrine_
Connect
ion_Exception if object is created using the new operator and there are no
* open
connect
ions
*/
public
function
__construct
(
$table
=
null
)
{
if
(
isset
(
$table
)
&&
$table
instanceof
Doctrine_Table
)
{
$this
->
table
=
$table
;
$exists
=
(
!
$this
->
table
->
isNewEntry
());
}
else
{
$this
->
table
=
Doctrine_Manager
::
getInstance
()
->
getCurrent
Sess
ion
()
->
getTable
(
get_class
(
$this
));
$this
->
table
=
Doctrine_Manager
::
getInstance
()
->
getCurrent
Connect
ion
()
->
getTable
(
get_class
(
$this
));
$exists
=
false
;
}
// Check if the current
sess
ion has the records table in its registry
// Check if the current
connect
ion has the records table in its registry
// If not this is record is only used for creating table definition and setting up
// relations.
if
(
$this
->
table
->
get
Sess
ion
()
->
hasTable
(
$this
->
table
->
getComponentName
()))
{
if
(
$this
->
table
->
get
Connect
ion
()
->
hasTable
(
$this
->
table
->
getComponentName
()))
{
$this
->
oid
=
self
::
$index
;
...
...
@@ -373,12 +373,12 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
*/
public
function
unserialize
(
$serialized
)
{
$manager
=
Doctrine_Manager
::
getInstance
();
$
session
=
$manager
->
getCurrentSess
ion
();
$
connection
=
$manager
->
getCurrentConnect
ion
();
$this
->
oid
=
self
::
$index
;
self
::
$index
++
;
$this
->
table
=
$
sess
ion
->
getTable
(
get_class
(
$this
));
$this
->
table
=
$
connect
ion
->
getTable
(
get_class
(
$this
));
$array
=
unserialize
(
$serialized
);
...
...
@@ -462,7 +462,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$id
=
array_values
(
$id
);
$query
=
$this
->
table
->
getQuery
()
.
" WHERE "
.
implode
(
" = ? AND "
,
$this
->
table
->
getPrimaryKeys
())
.
" = ?"
;
$this
->
data
=
$this
->
table
->
get
Sess
ion
()
->
execute
(
$query
,
$id
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
$this
->
data
=
$this
->
table
->
get
Connect
ion
()
->
execute
(
$query
,
$id
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
$this
->
modified
=
array
();
$this
->
cleanData
();
...
...
@@ -741,11 +741,11 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* @return void
*/
final
public
function
save
()
{
$this
->
table
->
get
Sess
ion
()
->
beginTransaction
();
$this
->
table
->
get
Connect
ion
()
->
beginTransaction
();
$saveLater
=
$this
->
table
->
get
Sess
ion
()
->
saveRelated
(
$this
);
$saveLater
=
$this
->
table
->
get
Connect
ion
()
->
saveRelated
(
$this
);
$this
->
table
->
get
Sess
ion
()
->
save
(
$this
);
$this
->
table
->
get
Connect
ion
()
->
save
(
$this
);
foreach
(
$saveLater
as
$fk
)
{
$table
=
$fk
->
getTable
();
...
...
@@ -761,7 +761,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
$this
->
saveAssociations
();
$this
->
table
->
get
Sess
ion
()
->
commit
();
$this
->
table
->
get
Connect
ion
()
->
commit
();
}
/**
* returns an array of modified fields and associated values
...
...
@@ -866,7 +866,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
foreach
(
$r
as
$record
)
{
$query
=
"DELETE FROM "
.
$asf
->
getTableName
()
.
" WHERE "
.
$fk
->
getForeign
()
.
" = ?"
.
" AND "
.
$fk
->
getLocal
()
.
" = ?"
;
$this
->
table
->
get
Sess
ion
()
->
execute
(
$query
,
array
(
$record
->
getIncremented
(),
$this
->
getIncremented
()));
$this
->
table
->
get
Connect
ion
()
->
execute
(
$query
,
array
(
$record
->
getIncremented
(),
$this
->
getIncremented
()));
}
$r
=
Doctrine_Relation
::
getInsertOperations
(
$this
->
originals
[
$alias
],
$new
);
...
...
@@ -928,7 +928,7 @@ abstract class Doctrine_Record extends Doctrine_Access implements Countable, Ite
* @return boolean true on success, false on failure
*/
public
function
delete
()
{
return
$this
->
table
->
get
Sess
ion
()
->
delete
(
$this
);
return
$this
->
table
->
get
Connect
ion
()
->
delete
(
$this
);
}
/**
* returns a copy of this object
...
...
Doctrine/View.php
View file @
034744ca
...
...
@@ -41,7 +41,7 @@ class Doctrine_View {
$this
->
name
=
$viewName
;
$this
->
query
=
$query
;
$this
->
query
->
setView
(
$this
);
$this
->
dbh
=
$query
->
get
Sess
ion
()
->
getDBH
();
$this
->
dbh
=
$query
->
get
Connect
ion
()
->
getDBH
();
}
/**
* simple get method for getting
...
...
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