ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
MDB2_BufferedResult_oci8 Class Reference
+ Inheritance diagram for MDB2_BufferedResult_oci8:
+ Collaboration diagram for MDB2_BufferedResult_oci8:

Public Member Functions

 _fillBuffer ($rownum=null)
 Fill the row buffer. More...
 
fetchRow ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rownum=null)
 Fetch a row and insert the data into an existing array. More...
 
 seek ($rownum=0)
 Seek to a specific row in a result set. More...
 
 valid ()
 Check if the end of the result set has been reached. More...
 
 numRows ()
 Returns the number of rows in a result object. More...
 
 free ()
 Free the internal resources associated with $result. More...
 
- Public Member Functions inherited from MDB2_Result_oci8
fetchRow ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rownum=null)
 Fetch a row and insert the data into an existing array. More...
 
 _getColumnNames ()
 Retrieve the names of columns returned by the DBMS in a query result. More...
 
 numCols ()
 Count the number of columns returned by the DBMS in a query result. More...
 
 free ()
 Free the internal resources associated with $result. More...
 
- Public Member Functions inherited from MDB2_Result_Common
 __construct (&$db, &$result, $limit=0, $offset=0)
 Constructor. More...
 
 MDB2_Result_Common (&$db, &$result, $limit=0, $offset=0)
 PHP 4 Constructor. More...
 
 setResultTypes ($types)
 Define the list of types to be associated with the columns of a given result set. More...
 
 seek ($rownum=0)
 Seek to a specific row in a result set. More...
 
fetchRow ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rownum=null)
 Fetch and return a row of data. More...
 
 fetchOne ($colnum=0, $rownum=null)
 fetch single column from the next row from a result set More...
 
 fetchCol ($colnum=0)
 Fetch and return a column from the current row pointer position. More...
 
 fetchAll ($fetchmode=MDB2_FETCHMODE_DEFAULT, $rekey=false, $force_array=false, $group=false)
 Fetch and return all rows from the current row pointer position. More...
 
 rowCount ()
 Returns the actual row number that was last fetched (count from 0) More...
 
 numRows ()
 Returns the number of rows in a result object. More...
 
 nextResult ()
 Move the internal result pointer to the next available result. More...
 
 getColumnNames ($flip=false)
 Retrieve the names of columns returned by the DBMS in a query result or from the cache. More...
 
 _getColumnNames ()
 Retrieve the names of columns returned by the DBMS in a query result. More...
 
 numCols ()
 Count the number of columns returned by the DBMS in a query result. More...
 
 getResource ()
 return the resource associated with the result object More...
 
 bindColumn ($column, &$value, $type=null)
 Set bind variable to a column. More...
 
 _assignBindColumns ($row)
 Bind a variable to a value in the result row. More...
 
 free ()
 Free the internal resources associated with result. More...
 

Data Fields

 $buffer
 
 $buffer_rownum = - 1
 
- Data Fields inherited from MDB2_Result_Common
 $db
 
 $result
 
 $rownum = -1
 
 $types = array()
 
 $values = array()
 
 $offset
 
 $offset_count = 0
 
 $limit
 
 $column_names
 

Detailed Description

Definition at line 1134 of file oci8.php.

Member Function Documentation

◆ _fillBuffer()

MDB2_BufferedResult_oci8::_fillBuffer (   $rownum = null)

Fill the row buffer.

Parameters
int$rownumrow number upto which the buffer should be filled if the row number is null all rows are ready into the buffer
Returns
boolean true on success, false on failure @access protected

Definition at line 1149 of file oci8.php.

1150 {
1151 if (isset($this->buffer) && is_array($this->buffer)) {
1152 if (is_null($rownum)) {
1153 if (!end($this->buffer)) {
1154 return false;
1155 }
1156 } elseif (isset($this->buffer[$rownum])) {
1157 return (bool)$this->buffer[$rownum];
1158 }
1159 }
1160
1161 $row = true;
1162 while ((is_null($rownum) || $this->buffer_rownum < $rownum)
1163 && ($row = @OCIFetchInto($this->result, $buffer, OCI_RETURN_NULLS))
1164 ) {
1166 // remove additional column at the end
1167 if ($this->offset > 0) {
1168 array_pop($buffer);
1169 }
1170 if (empty($this->types)) {
1171 foreach (array_keys($buffer) as $key) {
1172 if (is_a($buffer[$key], 'oci-lob')) {
1173 $buffer[$key] = $buffer[$key]->load();
1174 }
1175 }
1176 }
1177 $this->buffer[$this->buffer_rownum] = $buffer;
1178 }
1179
1180 if (!$row) {
1182 $this->buffer[$this->buffer_rownum] = false;
1183 return false;
1184 }
1185 return true;
1186 }

References $buffer, $buffer_rownum, $row, and MDB2_Result_Common\$rownum.

Referenced by fetchRow(), numRows(), and valid().

+ Here is the caller graph for this function:

◆ fetchRow()

& MDB2_BufferedResult_oci8::fetchRow (   $fetchmode = MDB2_FETCHMODE_DEFAULT,
  $rownum = null 
)

Fetch a row and insert the data into an existing array.

Parameters
int$fetchmodehow the array data should be indexed
int$rownumnumber of the row where the data can be found
Returns
int data array on success, a MDB2 error on failure @access public

Reimplemented from MDB2_Result_oci8.

Definition at line 1199 of file oci8.php.

1200 {
1201 if ($this->result === false) {
1202 $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1203 'resultset has already been freed', __FUNCTION__);
1204 return $err;
1205 } elseif (is_null($this->result)) {
1206 return null;
1207 }
1208 if (!is_null($rownum)) {
1209 $seek = $this->seek($rownum);
1210 if (PEAR::isError($seek)) {
1211 return $seek;
1212 }
1213 }
1214 $target_rownum = $this->rownum + 1;
1215 if ($fetchmode == MDB2_FETCHMODE_DEFAULT) {
1216 $fetchmode = $this->db->fetchmode;
1217 }
1218 if (!$this->_fillBuffer($target_rownum)) {
1219 $null = null;
1220 return $null;
1221 }
1222 $row = $this->buffer[$target_rownum];
1223 if ($fetchmode & MDB2_FETCHMODE_ASSOC) {
1224 $column_names = $this->getColumnNames();
1225 foreach ($column_names as $name => $i) {
1226 $column_names[$name] = $row[$i];
1227 }
1229 }
1230 $mode = 0;
1231 $rtrim = false;
1232 if ($this->db->options['portability'] & MDB2_PORTABILITY_RTRIM) {
1233 if (empty($this->types)) {
1234 $mode += MDB2_PORTABILITY_RTRIM;
1235 } else {
1236 $rtrim = true;
1237 }
1238 }
1239 if ($mode) {
1240 $this->db->_fixResultArrayValues($row, $mode);
1241 }
1242 if (!empty($this->types)) {
1243 $row = $this->db->datatype->convertResultRow($this->types, $row, $rtrim);
1244 }
1245 if (!empty($this->values)) {
1246 $this->_assignBindColumns($row);
1247 }
1248 if ($fetchmode === MDB2_FETCHMODE_OBJECT) {
1249 $object_class = $this->db->options['fetch_class'];
1250 if ($object_class == 'stdClass') {
1251 $row = (object) $row;
1252 } else {
1253 $row = &new $object_class($row);
1254 }
1255 }
1256 ++$this->rownum;
1257 return $row;
1258 }
const MDB2_PORTABILITY_RTRIM
Portability: right trim the data output by query*() and fetch*().
Definition: MDB2.php:164
const MDB2_FETCHMODE_DEFAULT
This is a special constant that tells MDB2 the user hasn't specified any particular get mode,...
Definition: MDB2.php:119
const MDB2_FETCHMODE_OBJECT
Column data as object properties.
Definition: MDB2.php:134
const MDB2_ERROR_NEED_MORE_DATA
Definition: MDB2.php:87
const MDB2_FETCHMODE_ASSOC
Column data indexed by column names.
Definition: MDB2.php:129
_fillBuffer($rownum=null)
Fill the row buffer.
Definition: oci8.php:1149
seek($rownum=0)
Seek to a specific row in a result set.
Definition: oci8.php:1270
getColumnNames($flip=false)
Retrieve the names of columns returned by the DBMS in a query result or from the cache.
Definition: MDB2.php:3674
_assignBindColumns($row)
Bind a variable to a value in the result row.
Definition: MDB2.php:3786
isError($data, $code=null)
Tell whether a value is a PEAR error.
Definition: PEAR.php:279

References MDB2_Result_Common\$column_names, $row, MDB2_Result_Common\$rownum, MDB2_Result_Common\_assignBindColumns(), _fillBuffer(), MDB2_Result_Common\getColumnNames(), PEAR\isError(), MDB2_ERROR_NEED_MORE_DATA, MDB2_FETCHMODE_ASSOC, MDB2_FETCHMODE_DEFAULT, MDB2_FETCHMODE_OBJECT, MDB2_PORTABILITY_RTRIM, and seek().

+ Here is the call graph for this function:

◆ free()

MDB2_BufferedResult_oci8::free ( )

Free the internal resources associated with $result.

Returns
boolean true on success, false if $result is invalid @access public

Reimplemented from MDB2_Result_oci8.

Definition at line 1333 of file oci8.php.

1334 {
1335 $this->buffer = null;
1336 $this->buffer_rownum = null;
1337 return parent::free();
1338 }

◆ numRows()

MDB2_BufferedResult_oci8::numRows ( )

Returns the number of rows in a result object.

Returns
mixed MDB2 Error Object or the number of rows @access public

Reimplemented from MDB2_Result_Common.

Definition at line 1312 of file oci8.php.

1313 {
1314 if ($this->result === false) {
1315 return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1316 'resultset has already been freed', __FUNCTION__);
1317 } elseif (is_null($this->result)) {
1318 return 0;
1319 }
1320 $this->_fillBuffer();
1321 return $this->buffer_rownum;
1322 }

References $buffer_rownum, _fillBuffer(), and MDB2_ERROR_NEED_MORE_DATA.

+ Here is the call graph for this function:

◆ seek()

MDB2_BufferedResult_oci8::seek (   $rownum = 0)

Seek to a specific row in a result set.

Parameters
int$rownumnumber of the row where the data can be found
Returns
mixed MDB2_OK on success, a MDB2 error on failure @access public

Reimplemented from MDB2_Result_Common.

Definition at line 1270 of file oci8.php.

1271 {
1272 if ($this->result === false) {
1273 return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1274 'resultset has already been freed', __FUNCTION__);
1275 }
1276 $this->rownum = $rownum - 1;
1277 return MDB2_OK;
1278 }
const MDB2_OK
The method mapErrorCode in each MDB2_dbtype implementation maps native error codes to one of these.
Definition: MDB2.php:67

References MDB2_Result_Common\$rownum, MDB2_ERROR_NEED_MORE_DATA, and MDB2_OK.

Referenced by fetchRow().

+ Here is the caller graph for this function:

◆ valid()

MDB2_BufferedResult_oci8::valid ( )

Check if the end of the result set has been reached.

Returns
mixed true or false on sucess, a MDB2 error on failure @access public

Definition at line 1289 of file oci8.php.

1290 {
1291 if ($this->result === false) {
1292 return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null,
1293 'resultset has already been freed', __FUNCTION__);
1294 } elseif (is_null($this->result)) {
1295 return true;
1296 }
1297 if ($this->_fillBuffer($this->rownum + 1)) {
1298 return true;
1299 }
1300 return false;
1301 }

References _fillBuffer(), and MDB2_ERROR_NEED_MORE_DATA.

+ Here is the call graph for this function:

Field Documentation

◆ $buffer

MDB2_BufferedResult_oci8::$buffer

Definition at line 1136 of file oci8.php.

Referenced by _fillBuffer().

◆ $buffer_rownum

MDB2_BufferedResult_oci8::$buffer_rownum = - 1

Definition at line 1137 of file oci8.php.

Referenced by _fillBuffer(), and numRows().


The documentation for this class was generated from the following file: