1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-03 12:47:33 +02:00

updated for GIT

This commit is contained in:
David Grudl
2009-08-14 00:05:20 +02:00
parent 208a579d6f
commit 7c6932807d
26 changed files with 148 additions and 170 deletions

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -1,146 +1,145 @@
<?php <?php
/** /**
* dibi - tiny'n'smart database abstraction layer * dibi - tiny'n'smart database abstraction layer
* ---------------------------------------------- * ----------------------------------------------
* *
* Copyright (c) 2005, 2009 David Grudl (http://davidgrudl.com) * Copyright (c) 2005, 2009 David Grudl (http://davidgrudl.com)
* *
* This source file is subject to the "dibi license" that is bundled * This source file is subject to the "dibi license" that is bundled
* with this package in the file license.txt. * with this package in the file license.txt.
* *
* For more information please see http://dibiphp.com * For more information please see http://dibiphp.com
* *
* @copyright Copyright (c) 2005, 2009 David Grudl * @copyright Copyright (c) 2005, 2009 David Grudl
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id: DibiResult.php 175 2009-01-05 00:03:27Z david@grudl.com $ */
*/
/**
/** * External result set iterator.
* External result set iterator. *
* * This can be returned by DibiResult::getIterator() method or using foreach
* This can be returned by DibiResult::getIterator() method or using foreach * <code>
* <code> * $result = dibi::query('SELECT * FROM table');
* $result = dibi::query('SELECT * FROM table'); * foreach ($result as $row) {
* foreach ($result as $row) { * print_r($row);
* print_r($row); * }
* } * unset($result);
* unset($result); * </code>
* </code> *
* * Optionally you can specify offset and limit:
* Optionally you can specify offset and limit: * <code>
* <code> * foreach ($result->getIterator(2, 3) as $row) {
* foreach ($result->getIterator(2, 3) as $row) { * print_r($row);
* print_r($row); * }
* } * </code>
* </code> *
* * @author David Grudl
* @author David Grudl * @copyright Copyright (c) 2005, 2009 David Grudl
* @copyright Copyright (c) 2005, 2009 David Grudl * @package dibi
* @package dibi */
*/ class DibiResultIterator implements Iterator, Countable
class DibiResultIterator implements Iterator, Countable {
{ /** @var DibiResult */
/** @var DibiResult */ private $result;
private $result;
/** @var int */
/** @var int */ private $offset;
private $offset;
/** @var int */
/** @var int */ private $limit;
private $limit;
/** @var int */
/** @var int */ private $row;
private $row;
/** @var int */
/** @var int */ private $pointer;
private $pointer;
/**
/** * @param DibiResult
* @param DibiResult * @param int offset
* @param int offset * @param int limit
* @param int limit */
*/ public function __construct(DibiResult $result, $offset = NULL, $limit = NULL)
public function __construct(DibiResult $result, $offset = NULL, $limit = NULL) {
{ $this->result = $result;
$this->result = $result; $this->offset = (int) $offset;
$this->offset = (int) $offset; $this->limit = $limit === NULL ? -1 : (int) $limit;
$this->limit = $limit === NULL ? -1 : (int) $limit; }
}
/**
/** * Rewinds the iterator to the first element.
* Rewinds the iterator to the first element. * @return void
* @return void */
*/ public function rewind()
public function rewind() {
{ $this->pointer = 0;
$this->pointer = 0; $this->result->seek($this->offset);
$this->result->seek($this->offset); $this->row = $this->result->fetch();
$this->row = $this->result->fetch(); }
}
/**
/** * Returns the key of the current element.
* Returns the key of the current element. * @return mixed
* @return mixed */
*/ public function key()
public function key() {
{ return $this->pointer;
return $this->pointer; }
}
/**
/** * Returns the current element.
* Returns the current element. * @return mixed
* @return mixed */
*/ public function current()
public function current() {
{ return $this->row;
return $this->row; }
}
/**
/** * Moves forward to next element.
* Moves forward to next element. * @return void
* @return void */
*/ public function next()
public function next() {
{ //$this->result->seek($this->offset + $this->pointer + 1);
//$this->result->seek($this->offset + $this->pointer + 1); $this->row = $this->result->fetch();
$this->row = $this->result->fetch(); $this->pointer++;
$this->pointer++; }
}
/**
/** * Checks if there is a current element after calls to rewind() or next().
* Checks if there is a current element after calls to rewind() or next(). * @return bool
* @return bool */
*/ public function valid()
public function valid() {
{ return !empty($this->row) && ($this->limit < 0 || $this->pointer < $this->limit);
return !empty($this->row) && ($this->limit < 0 || $this->pointer < $this->limit); }
}
/**
/** * Required by the Countable interface.
* Required by the Countable interface. * @return int
* @return int */
*/ public function count()
public function count() {
{ return $this->result->getRowCount();
return $this->result->getRowCount(); }
}
}
}

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

View File

@@ -15,7 +15,6 @@
* @license http://dibiphp.com/license dibi license * @license http://dibiphp.com/license dibi license
* @link http://dibiphp.com * @link http://dibiphp.com
* @package dibi * @package dibi
* @version $Id$
*/ */

3
examples/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
_test.bat
ref
output

View File

@@ -14,7 +14,6 @@
* @link http://nettephp.com * @link http://nettephp.com
* @category Nette * @category Nette
* @package Nette * @package Nette
* @version $Id$
*/ */
if(version_compare(PHP_VERSION,'5.2.0','<')){throw if(version_compare(PHP_VERSION,'5.2.0','<')){throw