1--TEST--
2PDO_Firebird: Bug #76488 Memory leak when fetching a BLOB field
3--SKIPIF--
4<?php if (!extension_loaded('interbase') || !extension_loaded('pdo_firebird')) die('skip'); ?>
5--FILE--
6<?php
7require 'testdb.inc';
8$dbh = new PDO('firebird:dbname='.$test_base, $user, $password) or die;
9
10$sql = '
11with recursive r(n) as (
12  select 1 from rdb$database
13  union all
14  select n+1 from r where n < 1000
15)
16select n,
17       cast(lpad(\'A\', 8000, \'A\') as BLOB sub_type TEXT) as SRC
18from r
19';
20
21    for ($i = 0; $i < 10; $i++) {
22        $sth = $dbh->prepare($sql);
23        $sth->execute();
24        $rows = $sth->fetchAll();
25	    unset($rows);
26	    unset($sth);
27    }
28    unset($dbh);
29    echo "OK";
30?>
31--EXPECT--
32OK
33