Annotation of embedaddon/php/ext/pdo/tests/pdo_028.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: PDO Common: bindValue
        !             3: --SKIPIF--
        !             4: <?php # vim:ft=php
        !             5: if (!extension_loaded('pdo')) die('skip');
        !             6: $dir = getenv('REDIR_TEST_DIR');
        !             7: if (false == $dir) die('skip no driver');
        !             8: require_once $dir . 'pdo_test.inc';
        !             9: PDOTest::skip();
        !            10: ?>
        !            11: --FILE--
        !            12: <?php
        !            13: if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
        !            14: require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
        !            15: $db = PDOTest::factory();
        !            16: 
        !            17: $db->exec('CREATE TABLE test(id int NOT NULL PRIMARY KEY, val1 VARCHAR(10), val2 VARCHAR(10), val3 VARCHAR(10))');
        !            18: $stmt = $db->prepare('INSERT INTO test values (1, ?, ?, ?)');
        !            19: 
        !            20: $data = array("one", "two", "three");
        !            21: 
        !            22: foreach ($data as $i => $v) {
        !            23:        $stmt->bindValue($i+1, $v);
        !            24: }
        !            25: $stmt->execute();
        !            26: 
        !            27: $stmt = $db->prepare('SELECT * from test');
        !            28: $stmt->execute();
        !            29: 
        !            30: var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
        !            31: ?>
        !            32: --EXPECT--
        !            33: array(1) {
        !            34:   [0]=>
        !            35:   array(4) {
        !            36:     ["id"]=>
        !            37:     string(1) "1"
        !            38:     ["val1"]=>
        !            39:     string(3) "one"
        !            40:     ["val2"]=>
        !            41:     string(3) "two"
        !            42:     ["val3"]=>
        !            43:     string(5) "three"
        !            44:   }
        !            45: }

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