1: <?php
2: /**
3: * This file contains the record set and database interaction class.
4: *
5: * @package Core
6: * @subpackage Database
7: * @version SVN Revision $Rev:$
8: *
9: * @author Dominik Ziegler
10: * @copyright four for business AG <www.4fb.de>
11: * @license http://www.contenido.org/license/LIZENZ.txt
12: * @link http://www.4fb.de
13: * @link http://www.contenido.org
14: */
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: /**
19: * This class contains functions for handling record sets and interaction with
20: * database in CONTENIDO.
21: *
22: * @package Core
23: * @subpackage Database
24: */
25: class cDb extends cDbDriverHandler {
26:
27: /**
28: * Link ID resource
29: *
30: * @var resource
31: */
32: protected $_linkId = NULL;
33:
34: /**
35: * Query ID resource
36: *
37: * @var resource
38: */
39: protected $_queryId = NULL;
40:
41: /**
42: * Active record set data.
43: *
44: * @var array
45: */
46: protected $_record = array();
47:
48: /**
49: * Active row count.
50: *
51: * @var int
52: */
53: protected $_row = 0;
54:
55: /**
56: * Database error number, if available.
57: *
58: * @var int
59: */
60: protected $_errorNumber = 0;
61:
62: /**
63: * Database error message, if available.
64: *
65: * @var string
66: */
67: protected $_errorMessage = '';
68:
69: /**
70: * Returns the query ID resource.
71: *
72: * @return NULL resource
73: */
74: public function getQueryId() {
75: return $this->_queryId;
76: }
77:
78: /**
79: * Sets the query ID resource.
80: * Do not set it manually unless you know what you are doing.
81: *
82: * @param resource $queryId query ID resource
83: */
84: public function setQueryId($queryId) {
85: $this->_queryId = $queryId;
86: }
87:
88: /**
89: * Returns the link ID resource.
90: *
91: * @return NULL resource
92: */
93: public function getLinkId() {
94: return $this->_linkId;
95: }
96:
97: /**
98: * Sets the link ID resource.
99: * Do not set it manually unless you know what you are doing.
100: *
101: * @param resource $linkId link ID resource
102: */
103: public function setLinkId($linkId) {
104: $this->_linkId = $linkId;
105: }
106:
107: /**
108: * Returns the current record data.
109: *
110: * @return array
111: */
112: public function getRecord() {
113: return $this->_record;
114: }
115:
116: /**
117: * Sets the current record data set.
118: * Do not set it manually unless you know what you are doing.
119: *
120: * @param array $record current record set data
121: */
122: public function setRecord($record) {
123: $this->_record = $record;
124: }
125:
126: /**
127: * Return the current row count.
128: *
129: * @return int
130: */
131: public function getRow() {
132: return $this->_row;
133: }
134:
135: /**
136: * Sets the current row count.
137: * Do not set it manually unless you know what you are doing.
138: *
139: * @param int $row current row count
140: */
141: public function setRow($row) {
142: $this->_row = (int) $row;
143: }
144:
145: /**
146: * Increments current row count by 1.
147: * Do not set it manually unless you know what you are doing.
148: */
149: public function incrementRow() {
150: $this->_row += 1;
151: }
152:
153: /**
154: * Returns error message of last occurred error from database.
155: *
156: * @return string database error message
157: */
158: public function getErrorMessage() {
159: return $this->_errorMessage;
160: }
161:
162: /**
163: * Sets the current error message from database.
164: *
165: * @param string $errorMessage current error message
166: */
167: public function setErrorMessage($errorMessage) {
168: $this->_errorMessage = $errorMessage;
169: }
170:
171: /**
172: * Returns error code of last occurred error from database.
173: *
174: * @return int database error code
175: */
176: public function getErrorNumber() {
177: return $this->_errorNumber;
178: }
179:
180: /**
181: * Sets the current error number from database.
182: *
183: * @param int $errorNumber current error number
184: */
185: public function setErrorNumber($errorNumber) {
186: $this->_errorNumber = (int) $errorNumber;
187: }
188: }