ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 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 22 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 55 of file class.ilPDOStatement.php.

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

55  {
56  $this->pdo_statement->closeCursor();
57  }
+ Here is the caller graph for this function:

◆ errorCode()

ilPDOStatement::errorCode ( )
Returns
string

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

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

◆ errorInfo()

ilPDOStatement::errorInfo ( )
Returns
array

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

111  {
112  return $this->pdo_statement->errorInfo();
113  }

◆ execute()

ilPDOStatement::execute (   $a_data = null)

Parameters
array$a_data
Returns
|

Implements ilDBStatement.

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

95  {
96  $this->pdo_statement->execute($a_data);
97 
98  return $this;
99  }

◆ fetch()

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

Implements ilDBStatement.

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

References fetchRow().

Referenced by fetchAssoc(), and fetchObject().

47  {
48  return $this->fetchRow($fetch_mode);
49  }
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 79 of file class.ilPDOStatement.php.

References fetch(), and ilDBConstants\FETCHMODE_ASSOC.

79  {
81  }
fetch($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
+ Here is the call graph for this function:

◆ fetchObject()

ilPDOStatement::fetchObject ( )
Returns
stdClass

Implements ilDBStatement.

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

References fetch(), and ilDBConstants\FETCHMODE_OBJECT.

71  {
73  }
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().

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

◆ numRows()

ilPDOStatement::numRows ( )
Returns
int

Implements ilDBStatement.

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

87  {
88  return $this->pdo_statement->rowCount();
89  }

◆ rowCount()

ilPDOStatement::rowCount ( )
Returns
int

Implements ilDBStatement.

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

63  {
64  return $this->pdo_statement->rowCount();
65  }

Field Documentation

◆ $pdo_statement

ilPDOStatement::$pdo_statement
protected

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

Referenced by __construct().


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