summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--it_dbi.class5
-rwxr-xr-xtest/it_dbi.t8
2 files changed, 10 insertions, 3 deletions
diff --git a/it_dbi.class b/it_dbi.class
index 4efe082..6a2b369 100644
--- a/it_dbi.class
+++ b/it_dbi.class
@@ -20,7 +20,7 @@
*/
#[AllowDynamicProperties]
-class it_dbi
+class it_dbi implements Iterator
{
static $_global_key = 'it_dbi'; # $GLOBAL key to use for singleton
@@ -175,9 +175,8 @@ static function createclass($p)
if (substr($classname, 0, 4) != 'PMA_') # It is designed behaviour that an error is generated if this class already exists!
{
- $interface = function_exists("interface_exists") && interface_exists("Iterator", false) ? "implements Iterator" : "";
$parentname = static::$_global_key;
- $code = "class $classname extends $parentname $interface
+ $code = "class $classname extends $parentname
{
function __construct(\$query = null, ...\$args)
{
diff --git a/test/it_dbi.t b/test/it_dbi.t
index eef2632..2a601b6 100755
--- a/test/it_dbi.t
+++ b/test/it_dbi.t
@@ -270,6 +270,14 @@ foreach (new it_dbi_test as $id => $record)
is($count, 3, "Iterator without select");
$count = 0;
+foreach (new it_dbi($db + ['table' => 'it_dbi_test']) as $id => $record)
+{
+ $count++;
+ is($record->_key, $id, "Iterator id $id (it_dbi object)");
+}
+is($count, 3, "Iterator without select (it_dbi_object)");
+
+$count = 0;
foreach (new it_dbi_test(['foo <>' => ""]) as $id => $record)
{
$count++;