*/
function result($query, $field = 0) {
$result = $this->query($query);
- if (!$result || !$result->num_rows) {
- return false;
- }
- return mysql_result($result->result, 0, $field);
+ return ($result ? $result->fetch_column($field) : false);
}
}
return mysql_fetch_row($this->result);
}
+ /** Fetch a single column
+ * @param int
+ * @return string or false if there are no rows
+ */
+ function fetch_column($field) {
+ return ($this->num_rows ? mysql_result($this->result, 0, $field) : false);
+ }
+
/** Fetch next field
* @return object properties: name, type, orgtable, orgname, charsetnr
*/
function result($query, $field = 0) {
$result = $this->query($query);
- if (!is_object($result) || !oci_fetch($result->result)) {
- return false;
- }
- return oci_result($result->result, $field + 1);
+ return (is_object($result) ? $result->fetch_column($field) : false);
}
}
return $this->convert(oci_fetch_row($this->result));
}
+ function fetch_column($field) {
+ return (oci_fetch($this->result) ? oci_result($this->result, $field + 1) : false);
+ }
+
function fetch_field() {
$column = $this->offset++;
$return = new \stdClass;
function result($query, $field = 0) {
$result = $this->query($query);
- if (!$result || !$result->num_rows) {
- return false;
- }
- return pg_fetch_result($result->result, 0, $field);
+ return ($result ? $result->fetch_column($field) : false);
}
function warnings() {
return pg_fetch_row($this->result);
}
+ function fetch_column($field) {
+ return ($this->num_rows ? pg_fetch_result($this->result, 0, $field) : false);
+ }
+
function fetch_field() {
$column = $this->offset++;
$return = new \stdClass;