Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mikko Koppanen
committed
Aug 29, 2011
1 parent
859225a
commit f523591
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--TEST-- | ||
Test very large integers | ||
--SKIPIF-- | ||
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
if (!extension_loaded ('gmp')) | ||
die ('skip The test requires gmp extension'); | ||
|
||
require_once(dirname(__FILE__) . '/config.inc'); | ||
|
||
$db = new PDO($dsn); | ||
|
||
pdo_cassandra_init($db, $keyspace); | ||
|
||
$db->exec ("CREATE COLUMNFAMILY verylargeint_test (my_key text PRIMARY KEY, testval varint)"); | ||
|
||
$db->exec ("UPDATE verylargeint_test SET testval = 1002003004005006007008009001000 WHERE my_key = 'aa'"); | ||
$db->setAttribute(PDO::CASSANDRA_ATTR_PRESERVE_VALUES, true); | ||
|
||
$stmt = $db->query ("SELECT testval FROM verylargeint_test WHERE my_key = 'aa'"); | ||
$row = $stmt->fetch (PDO::FETCH_ASSOC); | ||
|
||
$g = gmp_init(bin2hex($row['testval']), 16); | ||
echo gmp_strval ($g) . PHP_EOL; | ||
|
||
pdo_cassandra_done ($db, $keyspace); | ||
|
||
echo "OK"; | ||
--EXPECT-- | ||
1002003004005006007008009001000 | ||
OK |