ILIAS  release_8 Revision v8.24
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 (int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 fetch (int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 closeCursor ()
 Pdo allows for a manual closing of the cursor. More...
 
 rowCount ()
 
 fetchObject ()
 
 fetchAssoc ()
 
 numRows ()
 
 execute (array $a_data=null)
 
 errorCode ()
 
 errorInfo ()
 
 fetchRow (int $fetch_mode)
 
 fetch (int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
 
 rowCount ()
 
 numRows ()
 
 fetchObject ()
 
 fetchAssoc ()
 
 execute (array $a_data=null)
 

Protected Attributes

PDOStatement $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 27 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 35 of file class.ilPDOStatement.php.

36 {
37 $this->pdo_statement = $pdo_statement;
38 }
PDOStatement $pdo_statement

References $pdo_statement.

Member Function Documentation

◆ closeCursor()

ilPDOStatement::closeCursor ( )

Pdo allows for a manual closing of the cursor.

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

71 : void
72 {
73 $this->pdo_statement->closeCursor();
74 }

Referenced by ilMySQLQueryUtils\free().

+ Here is the caller graph for this function:

◆ errorCode()

ilPDOStatement::errorCode ( )

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

108 : string
109 {
110 return $this->pdo_statement->errorCode();
111 }

◆ errorInfo()

ilPDOStatement::errorInfo ( )

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

113 : array
114 {
115 return $this->pdo_statement->errorInfo();
116 }

◆ execute()

ilPDOStatement::execute ( array  $a_data = null)

Implements ilDBStatement.

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

102 {
103 $this->pdo_statement->execute($a_data);
104
105 return $this;
106 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
execute(array $a_data=null)

References ilDBStatement\execute().

+ Here is the call graph for this function:

◆ fetch()

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

Implements ilDBStatement.

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

63 {
64 return $this->fetchRow($fetch_mode);
65 }
fetchRow(int $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 ( )

Implements ilDBStatement.

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

89 : ?array
90 {
91 return $this->fetch(ilDBConstants::FETCHMODE_ASSOC) ?: null;
92 }
fetch(int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)

References fetch(), and ilDBConstants\FETCHMODE_ASSOC.

+ Here is the call graph for this function:

◆ fetchObject()

ilPDOStatement::fetchObject ( )

Implements ilDBStatement.

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

83 : ?stdClass
84 {
85 return $this->fetch(ilDBConstants::FETCHMODE_OBJECT) ?: null;
86 }

References fetch(), and ilDBConstants\FETCHMODE_OBJECT.

+ Here is the call graph for this function:

◆ fetchRow()

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

Implements ilDBStatement.

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

46 {
47 if ($fetch_mode === ilDBConstants::FETCHMODE_ASSOC) {
48 return $this->pdo_statement->fetch(PDO::FETCH_ASSOC);
49 }
50
51 if ($fetch_mode === ilDBConstants::FETCHMODE_OBJECT) {
52 return $this->pdo_statement->fetch(PDO::FETCH_OBJ);
53 }
54
55 throw new ilDatabaseException("No valid fetch mode given, choose ilDBConstants::FETCHMODE_ASSOC or ilDBConstants::FETCHMODE_OBJECT");
56 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilDBConstants\FETCHMODE_ASSOC, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by fetch().

+ Here is the caller graph for this function:

◆ numRows()

ilPDOStatement::numRows ( )

Implements ilDBStatement.

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

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

◆ rowCount()

ilPDOStatement::rowCount ( )

Implements ilDBStatement.

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

77 : int
78 {
79 return $this->pdo_statement->rowCount();
80 }

Field Documentation

◆ $pdo_statement

PDOStatement ilPDOStatement::$pdo_statement
protected

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

Referenced by __construct().


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