1--TEST--
2PDO_sqlite: Testing sqliteCreateAggregate()
3--SKIPIF--
4<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
5--FILE--
6<?php
7
8$db = new PDO('sqlite::memory:');
9
10$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)');
11
12$db->query('INSERT INTO foobar VALUES (NULL, "PHP")');
13$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")');
14
15$db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }, function(&$v) { return $v; });
16
17
18foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
19    var_dump($row);
20}
21
22$db->query('DROP TABLE foobar');
23
24?>
25--EXPECT--
26array(2) {
27  ["testing(name)"]=>
28  string(2) "12"
29  [0]=>
30  string(2) "12"
31}
32