ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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|\MDB2_Result_Common
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 11 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 23 of file class.ilPDOStatement.php.

24 {
25 $this->pdo_statement = $pdo_statement;
26 }

References $pdo_statement.

Member Function Documentation

◆ closeCursor()

ilPDOStatement::closeCursor ( )

Pdo allows for a manual closing of the cursor.

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

60 {
61 $this->pdo_statement->closeCursor();
62 }

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

+ Here is the caller graph for this function:

◆ errorCode()

ilPDOStatement::errorCode ( )
Returns
string

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

115 {
116 return $this->pdo_statement->errorCode();
117 }

◆ errorInfo()

ilPDOStatement::errorInfo ( )
Returns
array

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

123 {
124 return $this->pdo_statement->errorInfo();
125 }

◆ execute()

ilPDOStatement::execute (   $a_data = null)

Parameters
array$a_data
Returns
\ilPDOStatement|\MDB2_Result_Common

Implements ilDBStatement.

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

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

◆ fetch()

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

Implements ilDBStatement.

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

51 {
52 return $this->fetchRow($fetch_mode);
53 }
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 86 of file class.ilPDOStatement.php.

87 {
89 }
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 77 of file class.ilPDOStatement.php.

78 {
80 }

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 34 of file class.ilPDOStatement.php.

35 {
36 if ($fetch_mode == ilDBConstants::FETCHMODE_ASSOC) {
37 return $this->pdo_statement->fetch(PDO::FETCH_ASSOC);
38 } elseif ($fetch_mode == ilDBConstants::FETCHMODE_OBJECT) {
39 return $this->pdo_statement->fetch(PDO::FETCH_OBJ);
40 } else {
41 throw new ilDatabaseException("No valid fetch mode given, choose ilDBConstants::FETCHMODE_ASSOC or ilDBConstants::FETCHMODE_OBJECT");
42 }
43 }
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 95 of file class.ilPDOStatement.php.

96 {
97 return $this->pdo_statement->rowCount();
98 }

◆ rowCount()

ilPDOStatement::rowCount ( )
Returns
int

Implements ilDBStatement.

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

69 {
70 return $this->pdo_statement->rowCount();
71 }

Field Documentation

◆ $pdo_statement

ilPDOStatement::$pdo_statement
protected

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

Referenced by __construct().


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