ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPDOStatement Class Reference

Class ilPDOStatement is a Wrapper Class for PDOStatement. More...

+ Inheritance diagram for ilPDOStatement:
+ Collaboration diagram for ilPDOStatement:

Public Member Functions

 __construct (PDOStatement $pdo_statement)
 
 fetchRow ($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 fetch ($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 closeCursor ()
 Pdo allows for a manual closing of the cursor. More...
 
 rowCount ()
 
 fetchObject ()
 
 fetchAssoc ()
 
 numRows ()
 
 execute ($a_data=null)
 
Parameters
array$a_data
Returns
\ilPDOStatement
More...
 
 errorCode ()
 
 errorInfo ()
 
 fetchRow ($fetch_mode)
 
 fetch ($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 rowCount ()
 
 numRows ()
 
 fetchObject ()
 
 fetchAssoc ()
 
 execute ($a_data=null)
 

Protected Attributes

 $pdo_statement
 

Detailed Description

Class ilPDOStatement is a Wrapper Class for PDOStatement.

Author
Oskar Truffer ot@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch
Fabian Schmid fs@st.nosp@m.uder.nosp@m.-raim.nosp@m.ann..nosp@m.ch

Definition at line 9 of file class.ilPDOStatement.php.

Constructor & Destructor Documentation

◆ __construct()

ilPDOStatement::__construct ( PDOStatement  $pdo_statement)
Parameters
$pdo_statementPDOStatement The PDO Statement to be wrapped.

Definition at line 21 of file class.ilPDOStatement.php.

22 {
23 $this->pdo_statement = $pdo_statement;
24 }

References $pdo_statement.

Member Function Documentation

◆ closeCursor()

ilPDOStatement::closeCursor ( )

Pdo allows for a manual closing of the cursor.

Definition at line 57 of file class.ilPDOStatement.php.

58 {
59 $this->pdo_statement->closeCursor();
60 }

Referenced by ilMySQLQueryUtils\free(), and ilPostgresQueryUtils\free().

+ Here is the caller graph for this function:

◆ errorCode()

ilPDOStatement::errorCode ( )
Returns
string

Definition at line 112 of file class.ilPDOStatement.php.

113 {
114 return $this->pdo_statement->errorCode();
115 }

◆ errorInfo()

ilPDOStatement::errorInfo ( )
Returns
array

Definition at line 120 of file class.ilPDOStatement.php.

121 {
122 return $this->pdo_statement->errorInfo();
123 }

◆ execute()

ilPDOStatement::execute (   $a_data = null)

Parameters
array$a_data
Returns
\ilPDOStatement

Implements ilDBStatement.

Definition at line 102 of file class.ilPDOStatement.php.

103 {
104 $this->pdo_statement->execute($a_data);
105
106 return $this;
107 }

◆ fetch()

ilPDOStatement::fetch (   $fetch_mode = ilDBConstants::FETCHMODE_ASSOC)
Parameters
int$fetch_mode
Returns
mixed|void

Implements ilDBStatement.

Definition at line 48 of file class.ilPDOStatement.php.

49 {
50 return $this->fetchRow($fetch_mode);
51 }
fetchRow($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)

References fetchRow().

Referenced by fetchAssoc(), and fetchObject().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchAssoc()

ilPDOStatement::fetchAssoc ( )
Returns
array

Implements ilDBStatement.

Definition at line 84 of file class.ilPDOStatement.php.

85 {
87 }
fetch($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)

References fetch(), and ilDBConstants\FETCHMODE_ASSOC.

+ Here is the call graph for this function:

◆ fetchObject()

ilPDOStatement::fetchObject ( )
Returns
stdClass

Implements ilDBStatement.

Definition at line 75 of file class.ilPDOStatement.php.

76 {
78 }

References fetch(), and ilDBConstants\FETCHMODE_OBJECT.

+ Here is the call graph for this function:

◆ fetchRow()

ilPDOStatement::fetchRow (   $fetch_mode = ilDBConstants::FETCHMODE_ASSOC)
Parameters
int$fetch_mode
Returns
mixed
Exceptions
ilDatabaseException

Implements ilDBStatement.

Definition at line 32 of file class.ilPDOStatement.php.

33 {
34 if ($fetch_mode == ilDBConstants::FETCHMODE_ASSOC) {
35 return $this->pdo_statement->fetch(PDO::FETCH_ASSOC);
36 } elseif ($fetch_mode == ilDBConstants::FETCHMODE_OBJECT) {
37 return $this->pdo_statement->fetch(PDO::FETCH_OBJ);
38 } else {
39 throw new ilDatabaseException("No valid fetch mode given, choose ilDBConstants::FETCHMODE_ASSOC or ilDBConstants::FETCHMODE_OBJECT");
40 }
41 }
Class ilDatabaseException.

References ilDBConstants\FETCHMODE_ASSOC, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by fetch().

+ Here is the caller graph for this function:

◆ numRows()

ilPDOStatement::numRows ( )
Returns
int

Implements ilDBStatement.

Definition at line 93 of file class.ilPDOStatement.php.

94 {
95 return $this->pdo_statement->rowCount();
96 }

◆ rowCount()

ilPDOStatement::rowCount ( )
Returns
int

Implements ilDBStatement.

Definition at line 66 of file class.ilPDOStatement.php.

67 {
68 return $this->pdo_statement->rowCount();
69 }

Field Documentation

◆ $pdo_statement

ilPDOStatement::$pdo_statement
protected

Definition at line 15 of file class.ilPDOStatement.php.

Referenced by __construct().


The documentation for this class was generated from the following file: