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