File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / sqlite3 / tests / bug63921-64bit.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:04 2013 UTC (11 years 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 #63921 sqlite3::bindvalue and relative PHP functions aren't using sqlite3_*_int64 API
--SKIPIF--
<?php
if (!extension_loaded('sqlite3')) die('skip');
if (PHP_INT_SIZE < 8) die('skip'); // skip for 32bit builds - there is another test for that
?>
--FILE--
<?php
$num = 100004313234244; // notice this exceeds 32 bits
$conn = new sqlite3(':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, SQLITE3_INTEGER);
$stmt->bindValue(':num', $num, SQLITE3_INTEGER);
$stmt->execute();

$stmt = $conn->query('SELECT num FROM users');
$result = $stmt->fetchArray();

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

?>
--EXPECT--
int(100004313234244)
string(15) "100004313234244"

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