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 database in CONTENIDO.
20: *
21: * @package Core
22: * @subpackage Database
23: */
24: class cDb extends cDbDriverHandler {
25:
26: /**
27: * Link ID resource
28: * @var resource
29: */
30: protected $_linkId = NULL;
31:
32: /**
33: * Query ID resource
34: * @var resource
35: */
36: protected $_queryId = NULL;
37:
38: /**
39: * Active record set data.
40: * @var array
41: */
42: protected $_record = array();
43:
44: /**
45: * Active row count.
46: * @var int
47: */
48: protected $_row = 0;
49:
50: /**
51: * Database error number, if available.
52: * @var int
53: */
54: protected $_errorNumber = 0;
55:
56: /**
57: * Database error message, if available.
58: * @var string
59: */
60: protected $_errorMessage = '';
61:
62: /**
63: * Returns the query ID resource.
64: * @return null|resource
65: */
66: public function getQueryId() {
67: return $this->_queryId;
68: }
69:
70: /**
71: * Sets the query ID resource. Do not set it manually unless you know what you are doing.
72: *
73: * @param $queryId resource query ID resource
74: */
75: public function setQueryId($queryId) {
76: $this->_queryId = $queryId;
77: }
78:
79: /**
80: * Returns the link ID resource.
81: * @return null|resource
82: */
83: public function getLinkId() {
84: return $this->_linkId;
85: }
86:
87: /**
88: * Sets the link ID resource. Do not set it manually unless you know what you are doing.
89: *
90: * @param resource $linkId link ID resource
91: */
92: public function setLinkId($linkId) {
93: $this->_linkId = $linkId;
94: }
95:
96: /**
97: * Returns the current record data.
98: * @return array
99: */
100: public function getRecord() {
101: return $this->_record;
102: }
103:
104: /**
105: * Sets the current record data set. Do not set it manually unless you know what you are doing.
106: *
107: * @param array $record current record set data
108: */
109: public function setRecord($record) {
110: $this->_record = $record;
111: }
112:
113: /**
114: * Return the current row count.
115: * @return int
116: */
117: public function getRow() {
118: return $this->_row;
119: }
120:
121: /**
122: * Sets the current row count. Do not set it manually unless you know what you are doing.
123: *
124: * @param int $row current row count
125: */
126: public function setRow($row) {
127: $this->_row = (int)$row;
128: }
129:
130: /**
131: * Increments current row count by 1. Do not set it manually unless you know what you are doing.
132: */
133: public function incrementRow() {
134: $this->_row += 1;
135: }
136:
137: /**
138: * Returns error message of last occurred error from database.
139: * @return string database error message
140: */
141: public function getErrorMessage() {
142: return $this->_errorMessage;
143: }
144:
145: /**
146: * Sets the current error message from database.
147: *
148: * @param string $errorMessage current error message
149: */
150: public function setErrorMessage($errorMessage) {
151: $this->_errorMessage = $errorMessage;
152: }
153:
154: /**
155: * Returns error code of last occurred error from database.
156: * @return int database error code
157: */
158: public function getErrorNumber() {
159: return $this->_errorNumber;
160: }
161:
162: /**
163: * Sets the current error number from database.
164: *
165: * @param int $errorNumber current error number
166: */
167: public function setErrorNumber($errorNumber) {
168: $this->_errorNumber = (int)$errorNumber;
169: }
170:
171: }