ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPDOStatement Class Reference

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

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

Public Member Functions

 __construct (protected \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 ()
 

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 ( protected \PDOStatement  $pdo_statement)
Parameters
$pdo_statementPDOStatement The PDO Statement to be wrapped.

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

33  {
34  }

Member Function Documentation

◆ closeCursor()

ilPDOStatement::closeCursor ( )

Pdo allows for a manual closing of the cursor.

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

Referenced by ilMySQLQueryUtils\free().

67  : void
68  {
69  $this->pdo_statement->closeCursor();
70  }
+ Here is the caller graph for this function:

◆ errorCode()

ilPDOStatement::errorCode ( )

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

104  : string
105  {
106  return $this->pdo_statement->errorCode();
107  }

◆ errorInfo()

ilPDOStatement::errorInfo ( )

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

109  : array
110  {
111  return $this->pdo_statement->errorInfo();
112  }

◆ execute()

ilPDOStatement::execute ( ?array  $a_data = null)

Implements ilDBStatement.

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

98  {
99  $this->pdo_statement->execute($a_data);
100 
101  return $this;
102  }

◆ fetch()

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

Implements ilDBStatement.

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

References fetchRow().

Referenced by fetchAssoc(), and fetchObject().

58  : mixed
59  {
60  return $this->fetchRow($fetch_mode);
61  }
fetchRow(int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchAssoc()

ilPDOStatement::fetchAssoc ( )

Implements ilDBStatement.

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

References fetch(), ilDBConstants\FETCHMODE_ASSOC, and null.

85  : ?array
86  {
87  return $this->fetch(ilDBConstants::FETCHMODE_ASSOC) ?: null;
88  }
fetch(int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:

◆ fetchObject()

ilPDOStatement::fetchObject ( )

Implements ilDBStatement.

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

References fetch(), ilDBConstants\FETCHMODE_OBJECT, and null.

79  : ?stdClass
80  {
81  return $this->fetch(ilDBConstants::FETCHMODE_OBJECT) ?: null;
82  }
fetch(int $fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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 41 of file class.ilPDOStatement.php.

References ilDBConstants\FETCHMODE_ASSOC, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by fetch().

41  : mixed
42  {
43  if ($fetch_mode === ilDBConstants::FETCHMODE_ASSOC) {
44  return $this->pdo_statement->fetch(PDO::FETCH_ASSOC);
45  }
46 
47  if ($fetch_mode === ilDBConstants::FETCHMODE_OBJECT) {
48  return $this->pdo_statement->fetch(PDO::FETCH_OBJ);
49  }
50 
51  throw new ilDatabaseException("No valid fetch mode given, choose ilDBConstants::FETCHMODE_ASSOC or ilDBConstants::FETCHMODE_OBJECT");
52  }
+ Here is the caller graph for this function:

◆ numRows()

ilPDOStatement::numRows ( )

Implements ilDBStatement.

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

91  : int
92  {
93  return $this->pdo_statement->rowCount();
94  }

◆ rowCount()

ilPDOStatement::rowCount ( )

Implements ilDBStatement.

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

73  : int
74  {
75  return $this->pdo_statement->rowCount();
76  }

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