ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilPDOStatement.php
Go to the documentation of this file.
1 <?php
2 
3 require_once 'Services/Database/interfaces/interface.ilDBStatement.php';
4 
11 class ilPDOStatement implements ilDBStatement {
12 
16  protected $pdo_statement;
17 
18 
22  public function __construct(PDOStatement $pdo_statement) {
23  $this->pdo_statement = $pdo_statement;
24  }
25 
26 
32  public function fetchRow($fetch_mode = ilDBConstants::FETCHMODE_ASSOC) {
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  }
41 
42 
47  public function fetch($fetch_mode = ilDBConstants::FETCHMODE_ASSOC) {
48  return $this->fetchRow($fetch_mode);
49  }
50 
51 
55  public function closeCursor() {
56  $this->pdo_statement->closeCursor();
57  }
58 
59 
63  public function rowCount() {
64  return $this->pdo_statement->rowCount();
65  }
66 
67 
71  public function fetchObject() {
73  }
74 
75 
79  public function fetchAssoc() {
81  }
82 
83 
87  public function numRows() {
88  return $this->pdo_statement->rowCount();
89  }
90 
91 
95  public function execute($a_data = null) {
96  $this->pdo_statement->execute($a_data);
97 
98  return $this;
99  }
100 
104  public function errorCode() {
105  return $this->pdo_statement->errorCode();
106  }
107 
111  public function errorInfo() {
112  return $this->pdo_statement->errorInfo();
113  }
114 }
execute($a_data=null)
|
__construct(PDOStatement $pdo_statement)
Class ilPDOStatement is a Wrapper Class for PDOStatement.
fetch($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
Class ilDatabaseException.
closeCursor()
Pdo allows for a manual closing of the cursor.
fetchRow($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
Interface ilDBStatement.