summaryrefslogtreecommitdiff
path: root/ext/spl/examples/dba_reader.inc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/examples/dba_reader.inc')
-rwxr-xr-xext/spl/examples/dba_reader.inc83
1 files changed, 0 insertions, 83 deletions
diff --git a/ext/spl/examples/dba_reader.inc b/ext/spl/examples/dba_reader.inc
deleted file mode 100755
index d21db45613..0000000000
--- a/ext/spl/examples/dba_reader.inc
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-/**
- * @brief This implements a Dba Iterator.
- * @author Marcus Boerger
- * @version 1.0
- */
-class DbaReader implements Iterator
-{
-
- private $db = NULL;
- private $key = false;
- private $val = false;
-
- /**
- * Open database $file with $handler in read only mode.
- *
- * @param file Database file to open.
- * @param handler Handler to use for database access.
- */
- function __construct($file, $handler) {
- $this->db = dba_open($file, 'r', $handler);
- }
-
- /**
- * Close database.
- */
- function __destruct() {
- if ($this->db) {
- dba_close($this->db);
- }
- }
-
- /**
- * Rewind to first element.
- */
- function rewind() {
- if ($this->db) {
- $this->key = dba_firstkey($this->db);
- }
- }
-
- /**
- * @return Current data.
- */
- function current() {
- return $this->val;
- }
-
- /**
- * Move to next element.
- *
- * @return void
- */
- function next() {
- if ($this->db) {
- $this->key = dba_nextkey($this->db);
- if ($this->key !== false) {
- $this->val = dba_fetch($this->key, $this->db);
- }
- }
- }
-
- /**
- * @return Whether more elements are available.
- */
- function hasMore() {
- if ($this->db && $this->key !== false) {
- return true;
- } else {
- return false;
- }
- }
-
- /**
- * @return Current key.
- */
- function key() {
- return $this->key;
- }
-}
-
-?> \ No newline at end of file