This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/application/classes/Database/Result.php

64 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2011-06-24 01:27:21 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* TSM database show result. See [Results](/database/results) for usage and examples.
*
* @package PTA
* @subpackage TSM
* @category Query/Show
* @author Deon George
* @copyright (c) 2010 phpTSMadmin Development Team
* @license http://phptsmadmin.sf.net/license.html
*/
abstract class Database_Result extends Kohana_Database_Result {
protected $_internal_row = 0;
protected $_rows;
// Required Abstract Classes
public function __destruct() {}
public function seek($offset) {
if ($this->offsetExists($offset)) {
// Set the current row to the offset
$this->_current_row = $this->_internal_row = $offset;
return TRUE;
} else {
return FALSE;
}
}
public function current() {
if ($this->_current_row !== $this->_internal_row AND ! $this->seek($this->_current_row))
return FALSE;
// Return an stdClass
if ($this->_as_object === TRUE) {
return $this;
} elseif (is_string($this->_as_object)) {
// Return an object of given class name
$o = new $this->_as_object;
return $o->load_object($this->_rows[$this->_current_row]);
// Return an array of the row
} else {
return $this->_rows[$this->_current_row];
}
}
/**
* Get a row value from the query
*
* TSM returns all columns in upper case
*/
public function get($name, $default = NULL) {
$name = strtoupper($name);
return parent::get($name,$default);
}
}
?>