1--TEST-- 2Bug #38334: Proper data-type support for PDO_SQLITE 3--EXTENSIONS-- 4pdo_sqlite 5--FILE-- 6<?php 7 8$db = new PDO('sqlite::memory:'); 9$db->exec('CREATE TABLE test (i INTEGER , f DOUBLE, s VARCHAR(255))'); 10$db->exec('INSERT INTO test VALUES (42, 46.7, "test")'); 11var_dump($db->query('SELECT * FROM test')->fetch(PDO::FETCH_ASSOC)); 12 13// Check handling of integers larger than 32-bit. 14$db->exec('INSERT INTO test VALUES (10000000000, 0.0, "")'); 15$i = $db->query('SELECT i FROM test WHERE f = 0.0')->fetchColumn(0); 16if (PHP_INT_SIZE >= 8) { 17 var_dump($i === 10000000000); 18} else { 19 var_dump($i === '10000000000'); 20} 21 22// Check storing of strings into integer/float columns. 23$db->exec('INSERT INTO test VALUES ("test", "test", "x")'); 24var_dump($db->query('SELECT * FROM test WHERE s = "x"')->fetch(PDO::FETCH_ASSOC)); 25 26?> 27--EXPECT-- 28array(3) { 29 ["i"]=> 30 int(42) 31 ["f"]=> 32 float(46.7) 33 ["s"]=> 34 string(4) "test" 35} 36bool(true) 37array(3) { 38 ["i"]=> 39 string(4) "test" 40 ["f"]=> 41 string(4) "test" 42 ["s"]=> 43 string(1) "x" 44} 45