/** * Returns the row number * * @return int|bool|MDB2_Error true on success, false|MDB2_Error if result is invalid * @access public */ public function key() { if ($this->result) { return $this->result->rowCount(); } return false; }
/** * Constructor */ function MDB2_Result_mysql(&$mdb, &$result) { parent::MDB2_Result_Common($mdb, $result); }
/** * Constructor */ function MDB2_Result_mssql(&$mdb, &$result, $offset, $limit) { parent::MDB2_Result_Common($mdb, $result); if ($offset || $limit) { $this->limits = array('offset' => $offset, 'limit' => $limit, 'count' => 0); } }
/** * Determine whether the value of a query result located in given row and * field is a null. * * @param int $rownum number of the row where the data can be found * @param int $colnum field number where the data can be found * @return mixed true or false on success, a MDB2 error on failure * @access public */ function resultIsNull($rownum, $colnum) { if ($this->mdb->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL) { return parent::resultIsNull($rownum, $colnum); } $value = pg_field_is_null($this->result, $rownum, $colnum); if (!$value) { if (is_null($this->result)) { return $this->mdb->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'fetch: resultset has already been freed'); } } return (bool) $value; }
/** * @param MDB2_Result_Common $result the query result to check * @param type $rownum the row in the $result to check * @param type $data the expected data * @return bool */ public function verifyFetchedValues(&$result, $rownum, $data) { $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC, $rownum); if (!is_array($row)) { $result->free(); $this->fail('Error result row is not an array'); return; } foreach ($this->fields as $field => $type) { $value = $row[$field]; if ($type == 'float') { $delta = 1.0E-10; } else { $delta = 0; } $this->assertEquals($data[$field], $value, "the value retrieved for field \"{$field}\" doesn't match what was stored into the rownum {$rownum}", $delta); } }
/** * Constructor */ function MDB2_Result_querysim(&$mdb, &$result) { parent::MDB2_Result_Common($mdb, $result); }