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
9b46ca54
Commit
9b46ca54
authored
Nov 13, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enhance Doctrine_Db doc blocks
parent
22d91d9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
68 additions
and
15 deletions
+68
-15
Db.php
lib/Doctrine/Db.php
+68
-15
No files found.
lib/Doctrine/Db.php
View file @
9b46ca54
...
...
@@ -22,20 +22,32 @@
* Doctrine_Db
* A thin wrapper layer on top of PDO / Doctrine_Adapter
*
* The purpose of this class is to provide an easy to use, pluggable eventlistener
* architecture to database handler object
* Doctrine_Db provides the following things to underlying database hanlder
*
* Aspects such as logging, query profiling and caching can be easily implemented through
* the use of these listeners
* 1. Event listeners
* An easy to use, pluggable eventlistener architecture. Aspects such as
* logging, query profiling and caching can be easily implemented through
* the use of these listeners
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @package Doctrine
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
* 2. Lazy-connecting
* Creating an instance of Doctrine_Db does not connect
* to database. Connecting to database is only invoked when actually needed
* (for example when query() is being called)
*
* 3. Portable error codes
* Doctrine_Db_Exception drivers provide portable error code handling.
*
* 4. Easy-to-use fetching methods
* For convience Doctrine_Db provides methods such as fetchOne(), fetchAssoc() etc.
*
* @author Konsta Vesterinen <kvesteri@cc.hut.fi>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @package Doctrine
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class
Doctrine_Db
implements
Countable
,
IteratorAggregate
,
Doctrine_Adapter_Interface
{
/**
* error constants
...
...
@@ -401,29 +413,70 @@ class Doctrine_Db implements Countable, IteratorAggregate, Doctrine_Adapter_Inte
/**
* fetchAll
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchAll
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
}
/**
* fetchOne
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return mixed
*/
public
function
fetchOne
(
$statement
,
array
$params
=
array
())
{
return
current
(
$this
->
query
(
$statement
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
));
}
/**
* fetchRow
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchRow
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetch
(
PDO
::
FETCH_ASSOC
);
}
/**
* fetchArray
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchArray
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetch
(
PDO
::
FETCH_NUM
);
}
/**
* fetchColumn
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchColumn
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_COLUMN
);
}
/**
* fetchAssoc
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchAssoc
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_ASSOC
);
}
/**
* fetchBoth
*
* @param string $statement sql query to be executed
* @param array $params prepared statement params
* @return array
*/
public
function
fetchBoth
(
$statement
,
array
$params
=
array
())
{
return
$this
->
query
(
$statement
,
$params
)
->
fetchAll
(
PDO
::
FETCH_BOTH
);
}
...
...
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