fix: delete to force rename on next step
This commit is contained in:
@@ -1,122 +0,0 @@
|
||||
<?php
|
||||
namespace Bsr\Db;
|
||||
|
||||
class OdbcResultSet implements \Iterator, \ArrayAccess, \Countable
|
||||
{
|
||||
public $length;
|
||||
|
||||
private $results;
|
||||
private $error = false;
|
||||
private $num_fields;
|
||||
private $num_rows;
|
||||
private $cursor_index;
|
||||
|
||||
public function __construct($resultset)
|
||||
{
|
||||
$this->results = $resultset;
|
||||
$this->num_fields = is_array(current($resultset)) ? count(current($resultset)) : count($resultset);
|
||||
$this->num_rows = count($this->results);
|
||||
$this->length = $this->num_rows;
|
||||
$this->cursor_index = 0;
|
||||
}
|
||||
|
||||
public function get_num_rows()
|
||||
{
|
||||
return $this->num_rows;
|
||||
}
|
||||
|
||||
public function count() {
|
||||
return $this->get_num_rows();
|
||||
}
|
||||
|
||||
public function is_error()
|
||||
{
|
||||
return ($this->error ? true : false);
|
||||
}
|
||||
|
||||
public function get_error()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
public function get_row()
|
||||
{
|
||||
return $this->current();
|
||||
}
|
||||
|
||||
public function to_array()
|
||||
{
|
||||
return $this->results;
|
||||
}
|
||||
|
||||
// ArrayAccess
|
||||
/**
|
||||
* @param int $offset
|
||||
* @return bool
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return !$this->error && $this->cursor_index < $this->length && $this->cursor_index >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $offset
|
||||
* @return bool|array
|
||||
*/
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->offsetExists($offset) ? $this->results[$offset] : false;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
if($this->offsetExists($offset)) {
|
||||
$this->results[$offset] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
throw new \RuntimeException("This makes no sense at all.");
|
||||
}
|
||||
|
||||
// Iterator
|
||||
/**
|
||||
* @return bool|array
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->offsetGet($this->cursor_index);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->cursor_index;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array|bool
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
$current = $this->current();
|
||||
++$this->cursor_index;
|
||||
return $current;
|
||||
}
|
||||
|
||||
public function rewind()
|
||||
{
|
||||
$this->cursor_index = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return $this->offsetExists($this->cursor_index);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user