ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables 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 (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
More...
 
 errorCode ()
 
 errorInfo ()
 

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.

References $pdo_statement.

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

Member Function Documentation

◆ closeCursor()

ilPDOStatement::closeCursor ( )

Pdo allows for a manual closing of the cursor.

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

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

58  {
59  $this->pdo_statement->closeCursor();
60  }
+ 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

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.

References fetchRow().

Referenced by fetchAssoc(), and fetchObject().

49  {
50  return $this->fetchRow($fetch_mode);
51  }
fetchRow($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
+ 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.

References fetch(), and ilDBConstants\FETCHMODE_ASSOC.

85  {
87  }
fetch($fetch_mode=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.

References fetch(), and ilDBConstants\FETCHMODE_OBJECT.

76  {
78  }
fetch($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
+ 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.

References ilDBConstants\FETCHMODE_ASSOC, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by fetch().

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.
+ 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: