1--TEST-- 2PDO_Firebird: support 1 sql dialect 3--SKIPIF-- 4<?php require('skipif.inc'); 5if (strpos(getenv('PDO_FIREBIRD_TEST_DSN'), 'dialect=1')===false) { 6 die('skip: PDO_FIREBIRD_TEST_DSN must contain a string "dialect=1"'); 7} 8?> 9--ENV-- 10LSAN_OPTIONS=detect_leaks=0 11--FILE-- 12<?php 13 require("testdb.inc"); 14 15 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); 16 $dbh->setAttribute(PDO::FB_ATTR_TIMESTAMP_FORMAT, '%Y-%m-%d %H:%M:%S'); 17 18 $sql = 19 'SELECT 20 1 as N, 21 2.0 as F, 22 cast(0.76 as numeric(15, 2)) as K, 23 cast(\'2019-06-12\' as date) as DT 24 FROM RDB$DATABASE'; 25 $query = $dbh->prepare($sql); 26 $query->execute(); 27 $row = $query->fetch(\PDO::FETCH_OBJ); 28 var_dump($row->N); 29 var_dump($row->F); 30 var_dump($row->K); 31 var_dump($row->DT); 32 33 unset($query); 34 35 $dbh->exec('RECREATE TABLE test_d1(K numeric(15, 2), DT date)'); 36 $sql='INSERT INTO test_d1(K, DT) values(?, ?)'; 37 $query = $dbh->prepare($sql); 38 $query->execute([0.76, '2019-06-12']); 39 unset($query); 40 41 $sql='SELECT * FROM test_d1'; 42 $query = $dbh->prepare($sql); 43 $query->execute(); 44 $row = $query->fetch(\PDO::FETCH_OBJ); 45 var_dump($row->K); 46 var_dump($row->DT); 47 48 unset($query); 49 unset($dbh); 50 echo "done\n"; 51 52?> 53--EXPECT-- 54int(1) 55string(8) "2.000000" 56string(4) "0.76" 57string(19) "2019-06-12 00:00:00" 58string(4) "0.76" 59string(19) "2019-06-12 00:00:00" 60done 61