|
| 1 | +--TEST-- |
| 2 | +PDO PgSQL: integer columns at their boundaries |
| 3 | +--EXTENSIONS-- |
| 4 | +pdo_pgsql |
| 5 | +--SKIPIF-- |
| 6 | +<?php |
| 7 | +if (PHP_INT_SIZE < 8) die('skip 64-bit only'); |
| 8 | +require __DIR__ . '/config.inc'; |
| 9 | +require dirname(__DIR__, 2) . '/pdo/tests/pdo_test.inc'; |
| 10 | +PDOTest::skip(); |
| 11 | +?> |
| 12 | +--FILE-- |
| 13 | +<?php |
| 14 | +require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc'; |
| 15 | +$db = PDOTest::test_factory(__DIR__ . '/common.phpt'); |
| 16 | +$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 17 | +$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false); |
| 18 | + |
| 19 | +$stmt = $db->query(<<<'SQL' |
| 20 | +SELECT 0::int2, (-1)::int2, (-32768)::int2, 32767::int2, |
| 21 | + (-2147483648)::int4, 2147483647::int4, 7::int4, |
| 22 | + 999999999999999999::int8, (-999999999999999999)::int8, |
| 23 | + 1000000000000000000::int8, (-1000000000000000000)::int8, |
| 24 | + 9223372036854775807::int8, '-9223372036854775808'::int8 |
| 25 | +SQL); |
| 26 | +var_dump($stmt->fetch(PDO::FETCH_NUM)); |
| 27 | +?> |
| 28 | +--EXPECT-- |
| 29 | +array(13) { |
| 30 | + [0]=> |
| 31 | + int(0) |
| 32 | + [1]=> |
| 33 | + int(-1) |
| 34 | + [2]=> |
| 35 | + int(-32768) |
| 36 | + [3]=> |
| 37 | + int(32767) |
| 38 | + [4]=> |
| 39 | + int(-2147483648) |
| 40 | + [5]=> |
| 41 | + int(2147483647) |
| 42 | + [6]=> |
| 43 | + int(7) |
| 44 | + [7]=> |
| 45 | + int(999999999999999999) |
| 46 | + [8]=> |
| 47 | + int(-999999999999999999) |
| 48 | + [9]=> |
| 49 | + int(1000000000000000000) |
| 50 | + [10]=> |
| 51 | + int(-1000000000000000000) |
| 52 | + [11]=> |
| 53 | + int(9223372036854775807) |
| 54 | + [12]=> |
| 55 | + int(-9223372036854775808) |
| 56 | +} |
0 commit comments