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
33d8f27e
Commit
33d8f27e
authored
Aug 17, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Started seamless changing of the name Session to Connection
parent
c9b90179
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
82 additions
and
36 deletions
+82
-36
Manager.php
Doctrine/Manager.php
+49
-36
Getting started - Setting table definition - Enum emulation.php
...g started - Setting table definition - Enum emulation.php
+21
-0
Basic components - Session - Availible drivers.php
...l/docs/Basic components - Session - Availible drivers.php
+9
-0
Getting started - Setting table definition - Enum emulation.php
...g started - Setting table definition - Enum emulation.php
+3
-0
No files found.
Doctrine/Manager.php
View file @
33d8f27e
...
...
@@ -30,9 +30,9 @@ require_once("EventListener.php");
*/
class
Doctrine_Manager
extends
Doctrine_Configurable
implements
Countable
,
IteratorAggregate
{
/**
* @var array $
session an array containing all the opened sess
ions
* @var array $
connections an array containing all the opened connect
ions
*/
private
$
sess
ions
=
array
();
private
$
connect
ions
=
array
();
/**
* @var integer $index the incremented index
*/
...
...
@@ -143,20 +143,20 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
$this
->
attributes
[
Doctrine
::
ATTR_CREATE_TABLES
]
=
$old
;
}
/**
* open
Session
* opens a new
sess
ion and saves it to Doctrine_Manager->sessions
* open
Connection
* opens a new
connect
ion and saves it to Doctrine_Manager->sessions
*
* @param PDO $pdo PDO database driver
* @param string $name name of the
sess
ion, if empty numeric key is used
* @param string $name name of the
connect
ion, if empty numeric key is used
* @return Doctrine_Session
*/
final
public
function
openSess
ion
(
PDO
$pdo
,
$name
=
null
)
{
public
function
openConnect
ion
(
PDO
$pdo
,
$name
=
null
)
{
// initialize the default attributes
$this
->
setDefaultAttributes
();
if
(
$name
!==
null
)
{
$name
=
(
string
)
$name
;
if
(
isset
(
$this
->
sess
ions
[
$name
]))
if
(
isset
(
$this
->
connect
ions
[
$name
]))
throw
new
InvalidKeyException
();
}
else
{
...
...
@@ -165,31 +165,34 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
}
switch
(
$pdo
->
getAttribute
(
PDO
::
ATTR_DRIVER_NAME
))
:
case
"mysql"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Mysql
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Mysql
(
$this
,
$pdo
);
break
;
case
"sqlite"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Sqlite
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Sqlite
(
$this
,
$pdo
);
break
;
case
"pgsql"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Pgsql
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Pgsql
(
$this
,
$pdo
);
break
;
case
"oci"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Oracle
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Oracle
(
$this
,
$pdo
);
break
;
case
"mssql"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Mssql
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Mssql
(
$this
,
$pdo
);
break
;
case
"firebird"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Firebird
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Firebird
(
$this
,
$pdo
);
break
;
case
"informix"
:
$this
->
sess
ions
[
$name
]
=
new
Doctrine_Session_Informix
(
$this
,
$pdo
);
$this
->
connect
ions
[
$name
]
=
new
Doctrine_Session_Informix
(
$this
,
$pdo
);
break
;
endswitch
;
$this
->
currIndex
=
$name
;
return
$this
->
sessions
[
$name
];
return
$this
->
connections
[
$name
];
}
public
function
openSession
(
PDO
$pdo
,
$name
=
null
)
{
return
$this
->
openConnection
(
$pdo
,
$name
);
}
/**
* getSession
...
...
@@ -197,47 +200,56 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @return object Doctrine_Session
* @throws InvalidKeyException
*/
final
public
function
getSess
ion
(
$index
)
{
if
(
!
isset
(
$this
->
sess
ions
[
$index
]))
public
function
getConnect
ion
(
$index
)
{
if
(
!
isset
(
$this
->
connect
ions
[
$index
]))
throw
new
InvalidKeyException
();
$this
->
currIndex
=
$index
;
return
$this
->
sess
ions
[
$index
];
return
$this
->
connect
ions
[
$index
];
}
public
function
getSession
(
$index
)
{
return
$this
->
getConnection
(
$index
);
}
/**
* closes the session
*
* @param Doctrine_Session $session
* @return void
*/
final
public
function
closeSess
ion
(
Doctrine_Session
$session
)
{
public
function
closeConnect
ion
(
Doctrine_Session
$session
)
{
$session
->
close
();
unset
(
$session
);
}
public
function
closeSession
(
Doctrine_Session
$session
)
{
$this
->
closeConnection
(
$session
);
}
/**
* get
Sess
ions
* returns all opened
sess
ions
* get
Connect
ions
* returns all opened
connect
ions
*
* @return array
*/
final
public
function
getSessions
()
{
return
$this
->
sessions
;
public
function
getConnections
()
{
return
$this
->
connections
;
}
public
function
getSessions
()
{
return
$this
->
connections
;
}
/**
* setCurrent
Sess
ion
* sets the current
sess
ion to $key
* setCurrent
Connect
ion
* sets the current
connect
ion to $key
*
* @param mixed $key the
sess
ion key
* @param mixed $key the
connect
ion key
* @throws InvalidKeyException
* @return void
*/
final
public
function
setCurrentSess
ion
(
$key
)
{
public
function
setCurrentConnect
ion
(
$key
)
{
$key
=
(
string
)
$key
;
if
(
!
isset
(
$this
->
sess
ions
[
$key
]))
if
(
!
isset
(
$this
->
connect
ions
[
$key
]))
throw
new
InvalidKeyException
();
$this
->
currIndex
=
$key
;
}
public
function
setCurrentSession
(
$key
)
{
$this
->
setCurrentConnection
(
$key
);
}
/**
* count
* returns the number of opened sessions
...
...
@@ -245,7 +257,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @return integer
*/
public
function
count
()
{
return
count
(
$this
->
sess
ions
);
return
count
(
$this
->
connect
ions
);
}
/**
* getIterator
...
...
@@ -254,22 +266,23 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
* @return ArrayIterator
*/
public
function
getIterator
()
{
return
new
ArrayIterator
(
$this
->
sess
ions
);
return
new
ArrayIterator
(
$this
->
connect
ions
);
}
/**
* getCurrent
Sess
ion
* returns the current
sess
ion
* getCurrent
Connect
ion
* returns the current
connect
ion
*
* @throws Doctrine_Session_Exception if there are no open sessions
* @return Doctrine_Session
*/
final
public
function
getCurrentSess
ion
()
{
public
function
getCurrentConnect
ion
()
{
$i
=
$this
->
currIndex
;
if
(
!
isset
(
$this
->
sess
ions
[
$i
]))
if
(
!
isset
(
$this
->
connect
ions
[
$i
]))
throw
new
Doctrine_Session_Exception
();
return
$this
->
sess
ions
[
$i
];
return
$this
->
connect
ions
[
$i
];
}
public
function
getCurrentSession
()
{
return
$this
->
getCurrentConnection
();
}
/**
* __toString
* returns a string representation of this object
...
...
@@ -279,7 +292,7 @@ class Doctrine_Manager extends Doctrine_Configurable implements Countable, Itera
public
function
__toString
()
{
$r
[]
=
"<pre>"
;
$r
[]
=
"Doctrine_Manager"
;
$r
[]
=
"Sessions : "
.
count
(
$this
->
sess
ions
);
$r
[]
=
"Sessions : "
.
count
(
$this
->
connect
ions
);
$r
[]
=
"</pre>"
;
return
implode
(
"
\n
"
,
$r
);
}
...
...
manual/codes/Getting started - Setting table definition - Enum emulation.php
0 → 100644
View file @
33d8f27e
<?php
class
Article
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
"title"
,
"string"
,
200
);
// maps to TINYINT on mysql
$this
->
hasColumn
(
"section"
,
"enum"
,
2
);
$this
->
setEnumValues
(
"section"
,
array
(
"PHP"
,
"Python"
,
"Java"
,
"Ruby"
));
}
}
$article
=
new
Article
;
$article
->
title
=
'My first php article'
;
// doctrine auto-converts the section to integer when the
// record is being saved
$article
->
section
=
'PHP'
;
$article
->
save
();
// on insert query with values 'My first php article' and 0
// would be issued
?>
manual/docs/Basic components - Session - Availible drivers.php
0 → 100644
View file @
33d8f27e
Doctrine
has
drivers
for
every
PDO
-
supported
database
.
The
supported
databases
are
:
<
li
>
FreeTDS
/
Microsoft
SQL
Server
/
Sybase
<
li
>
Firebird
/
Interbase
6
<
li
>
Informix
<
li
>
Mysql
<
li
>
Oracle
<
li
>
Odbc
<
li
>
PostgreSQL
<
li
>
Sqlite
manual/docs/Getting started - Setting table definition - Enum emulation.php
0 → 100644
View file @
33d8f27e
Doctrine
offers
enum
data
type
emulation
for
all
databases
.
The
enum
data
type
of
Doctrine
maps
to
integer
on
database
.
Doctrine
takes
care
of
converting
the
enumerated
value
automatically
to
its
valuelist
equivalent
when
a
record
is
being
fetched
and
the
valuelist
value
back
to
its
enumerated
equivalent
when
record
is
being
saved
.
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