Annotation of embedaddon/php/ext/pdo_sqlite/tests/pdo_sqlite_createaggregate.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: PDO_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:
18: foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
19: var_dump($row);
20: }
21:
22: $db->query('DROP TABLE foobar');
23:
24: ?>
25: --EXPECTF--
26: array(2) {
27: ["testing(name)"]=>
28: %string|unicode%(2) "12"
29: [0]=>
30: %string|unicode%(2) "12"
31: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>