1--TEST--
2PDO_Firebird: attr date, time, and timestamp formats
3--EXTENSIONS--
4pdo_firebird
5--SKIPIF--
6<?php require('skipif.inc'); ?>
7--XLEAK--
8A bug in firebird causes a memory leak when calling `isc_attach_database()`.
9See https://github.com/FirebirdSQL/firebird/issues/7849
10--FILE--
11<?php
12require("testdb.inc");
13$dbh = getDbConnection();
14
15echo "== Default state with nothing set. ==\n";
16echo 'ATTR_DATE_FORMAT: ', $dbh->getAttribute(Pdo\firebird::ATTR_DATE_FORMAT), "\n";
17echo 'ATTR_TIME_FORMAT: ', $dbh->getAttribute(Pdo\firebird::ATTR_TIME_FORMAT), "\n";
18echo 'ATTR_TIMESTAMP_FORMAT: ', $dbh->getAttribute(Pdo\firebird::ATTR_TIMESTAMP_FORMAT), "\n";
19
20$dbh->setAttribute(Pdo\firebird::ATTR_DATE_FORMAT, 'Y----m----d');
21$dbh->setAttribute(Pdo\firebird::ATTR_TIME_FORMAT, 'H::::i::::s');
22$dbh->setAttribute(Pdo\firebird::ATTR_TIMESTAMP_FORMAT, 'Y----m----d....H::::i::::s');
23
24echo "\n";
25
26echo "== State after setting value. ==\n";
27echo 'ATTR_DATE_FORMAT: ', $dbh->getAttribute(Pdo\firebird::ATTR_DATE_FORMAT), "\n";
28echo 'ATTR_TIME_FORMAT: ', $dbh->getAttribute(Pdo\firebird::ATTR_TIME_FORMAT), "\n";
29echo 'ATTR_TIMESTAMP_FORMAT: ', $dbh->getAttribute(Pdo\firebird::ATTR_TIMESTAMP_FORMAT), "\n";
30?>
31--EXPECT--
32== Default state with nothing set. ==
33ATTR_DATE_FORMAT: %Y-%m-%d
34ATTR_TIME_FORMAT: %H:%M:%S
35ATTR_TIMESTAMP_FORMAT: %Y-%m-%d %H:%M:%S
36
37== State after setting value. ==
38ATTR_DATE_FORMAT: Y----m----d
39ATTR_TIME_FORMAT: H::::i::::s
40ATTR_TIMESTAMP_FORMAT: Y----m----d....H::::i::::s
41