mirror of
https://github.com/php/php-src.git
synced 2026-03-24 08:12:21 +01:00
30 lines
777 B
PHP
30 lines
777 B
PHP
--TEST--
|
|
PDO_sqlite: Testing sqliteCreateAggregate()
|
|
--EXTENSIONS--
|
|
pdo_sqlite
|
|
--FILE--
|
|
<?php
|
|
|
|
$db = new PDO('sqlite::memory:');
|
|
|
|
$db->query('CREATE TABLE test_pdo_sqlite_createaggregate (id INT AUTO INCREMENT, name TEXT)');
|
|
|
|
$db->query('INSERT INTO test_pdo_sqlite_createaggregate VALUES (NULL, "PHP"), (NULL, "PHP6")');
|
|
|
|
$db->sqliteCreateAggregate('testing', function(&$a, $b) { $a .= $b; return $a; }, function(&$v) { return $v; });
|
|
|
|
|
|
foreach ($db->query('SELECT testing(name) FROM test_pdo_sqlite_createaggregate') as $row) {
|
|
var_dump($row);
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Method PDO::sqliteCreateAggregate() is deprecated since 8.5, use Pdo\Sqlite::createAggregate() instead in %s on line %d
|
|
array(2) {
|
|
["testing(name)"]=>
|
|
string(2) "12"
|
|
[0]=>
|
|
string(2) "12"
|
|
}
|