mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Most oci8 tests fail out-of-the-box because a typical host won't have an Oracle database instance available. Other database drivers like mysqli and pgsql address this problem with an include file, inserted into SKIPIF, that skips the test if no connection at all can be made. This commits adds such a file (skipifconnectfailure.inc) for oci8, and adds the corresponding SKIPIF to any tests that connect to a database. Closes GH-11804 * ext/oci8/tests/lob_aliases.phpt: drop unnecessary SKIPIF.
51 lines
1.0 KiB
PHP
51 lines
1.0 KiB
PHP
--TEST--
|
|
Bug #68298 (OCI int overflow)
|
|
--EXTENSIONS--
|
|
oci8
|
|
--SKIPIF--
|
|
<?php
|
|
if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only");
|
|
require_once('skipifconnectfailure.inc');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require(__DIR__.'/connect.inc');
|
|
|
|
$stmtarray = array(
|
|
"DROP TABLE BUG68298",
|
|
"CREATE TABLE BUG68298 (COL1 NUMBER(20))"
|
|
);
|
|
|
|
oci8_test_sql_execute($c, $stmtarray);
|
|
|
|
$s = oci_parse($c, "INSERT INTO BUG68298 VALUES (:INTVALUE)");
|
|
$intvalue = 1152921504606846975;
|
|
oci_bind_by_name($s, ":INTVALUE", $intvalue, -1, SQLT_INT);
|
|
oci_execute($s);
|
|
|
|
$s = oci_parse($c, "INSERT INTO BUG68298 VALUES (:INTVALUE)");
|
|
$intvalue = -1152921504606846975;
|
|
oci_bind_by_name($s, ":INTVALUE", $intvalue, -1, SQLT_INT);
|
|
oci_execute($s);
|
|
|
|
|
|
$s = oci_parse($c, "SELECT COL1 FROM BUG68298");
|
|
oci_execute($s);
|
|
oci_fetch_all($s, $r);
|
|
var_dump($r);
|
|
|
|
$stmtarray = array("DROP TABLE BUG68298");
|
|
oci8_test_sql_execute($c, $stmtarray);
|
|
?>
|
|
--EXPECT--
|
|
array(1) {
|
|
["COL1"]=>
|
|
array(2) {
|
|
[0]=>
|
|
string(19) "1152921504606846975"
|
|
[1]=>
|
|
string(20) "-1152921504606846975"
|
|
}
|
|
}
|