1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-12 09:04:24 +02:00

fixed some bugs

This commit is contained in:
David Grudl
2007-11-12 14:35:55 +00:00
parent 46850aa588
commit d19eb5b815
8 changed files with 47 additions and 43 deletions

View File

@@ -51,7 +51,7 @@ class DibiDatabaseException extends DibiException
public function __construct($message = NULL, $code = 0, $sql = NULL)
{
parent::__construct($message);
parent::__construct($message, (int) $code);
$this->sql = $sql;
dibi::notify(NULL, 'exception', $this);
}

View File

@@ -52,19 +52,19 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
* Describes columns types
* @var array
*/
protected $convert;
private $convert;
/**
* Describes columns types
* @var array
*/
protected $meta;
private $meta;
/**
* Already fetched? Used for allowance for first seek(0)
* @var bool
*/
protected $fetched = FALSE;
private $fetched = FALSE;
@@ -86,6 +86,18 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
}
/**
* Automatically frees the resources allocated for this result set
*
* @return void
*/
public function __destruct()
{
@$this->driver->free();
}
/**
* Returns the resultset resource
*
@@ -107,11 +119,9 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
*/
final public function seek($row)
{
if ($row === 0 && !$this->fetched) {
return TRUE;
if ($row !== 0 || $this->fetched) {
$this->driver->seek($row);
}
$this->driver->seek($row);
}
@@ -128,6 +138,18 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
/**
* Frees the resources allocated for this result set
*
* @return void
*/
final public function free()
{
$this->driver->free();
}
/**
* Fetches the row at current position, process optional type conversion
* and moves the internal cursor to the next position
@@ -334,18 +356,6 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
/**
* Automatically frees the resources allocated for this result set
*
* @return void
*/
public function __destruct()
{
@$this->driver->free();
}
final public function setType($field, $type = NULL)
{
if ($field === TRUE) {
@@ -438,7 +448,7 @@ class DibiResult extends NObject implements IteratorAggregate, Countable
*
* @return void
*/
public function dump()
final public function dump()
{
echo "\n<table class=\"dump\">\n<thead>\n\t<tr>\n\t\t<th>#row</th>\n";