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