Annotation of embedaddon/php/ext/pdo_sqlite/tests/pdo_sqlite_createfunction.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: PDO_sqlite: Testing sqliteCreateFunction()
        !             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: 
        !            16: $db->sqliteCreateFunction('testing', function($v) { return strtolower($v); });
        !            17: 
        !            18: 
        !            19: foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
        !            20:        var_dump($row);
        !            21: }
        !            22: 
        !            23: $db->query('DROP TABLE foobar');
        !            24: 
        !            25: ?>
        !            26: --EXPECTF--
        !            27: array(2) {
        !            28:   ["testing(name)"]=>
        !            29:   %string|unicode%(3) "php"
        !            30:   [0]=>
        !            31:   %string|unicode%(3) "php"
        !            32: }
        !            33: array(2) {
        !            34:   ["testing(name)"]=>
        !            35:   %string|unicode%(4) "php6"
        !            36:   [0]=>
        !            37:   %string|unicode%(4) "php6"
        !            38: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>