File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / pdo_sqlite / tests / bug_63916-2.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:31:59 2013 UTC (11 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

--TEST--
Bug #63916 PDO::PARAM_INT casts to 32bit int internally even on 64bit builds in pdo_sqlite
--SKIPIF--
<?php
if (!extension_loaded('pdo_sqlite')) die('skip');
if (PHP_INT_SIZE > 4) die('skip');
?>
--FILE--
<?php
$num = PHP_INT_MAX; // 32 bits
$conn = new PDO('sqlite::memory:');
$conn->query('CREATE TABLE users (id INTEGER NOT NULL, num INTEGER NOT NULL, PRIMARY KEY(id))');

$stmt = $conn->prepare('insert into users (id, num) values (:id, :num)');
$stmt->bindValue(':id', 1, PDO::PARAM_INT);
$stmt->bindValue(':num', $num, PDO::PARAM_INT);
$stmt->execute();

$stmt = $conn->query('SELECT num FROM users');
$result = $stmt->fetchAll(PDO::FETCH_COLUMN);

var_dump($num,$result[0]);

?>
--EXPECT--
int(2147483647)
string(10) "2147483647"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>