ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPDOStatement.php
Go to the documentation of this file.
1<?php
2
10{
11
15 protected $pdo_statement;
16
17
21 public function __construct(PDOStatement $pdo_statement)
22 {
23 $this->pdo_statement = $pdo_statement;
24 }
25
26
32 public function fetchRow($fetch_mode = ilDBConstants::FETCHMODE_ASSOC)
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 }
42
43
48 public function fetch($fetch_mode = ilDBConstants::FETCHMODE_ASSOC)
49 {
50 return $this->fetchRow($fetch_mode);
51 }
52
53
57 public function closeCursor()
58 {
59 $this->pdo_statement->closeCursor();
60 }
61
62
66 public function rowCount()
67 {
68 return $this->pdo_statement->rowCount();
69 }
70
71
75 public function fetchObject()
76 {
78 }
79
80
84 public function fetchAssoc()
85 {
87 }
88
89
93 public function numRows()
94 {
95 return $this->pdo_statement->rowCount();
96 }
97
98
102 public function execute($a_data = null)
103 {
104 $this->pdo_statement->execute($a_data);
105
106 return $this;
107 }
108
112 public function errorCode()
113 {
114 return $this->pdo_statement->errorCode();
115 }
116
120 public function errorInfo()
121 {
122 return $this->pdo_statement->errorInfo();
123 }
124}
An exception for terminatinating execution or to throw for unit testing.
Class ilDatabaseException.
Class ilPDOStatement is a Wrapper Class for PDOStatement.
fetchRow($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
__construct(PDOStatement $pdo_statement)
fetch($fetch_mode=ilDBConstants::FETCHMODE_ASSOC)
execute($a_data=null)
\ilPDOStatement
closeCursor()
Pdo allows for a manual closing of the cursor.
Interface ilDBStatement.