Created
June 6, 2017 23:58
-
-
Save morozov/ec49ee56aa93e942dfa547d81e770945 to your computer and use it in GitHub Desktop.
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
<?php | |
/* | |
CREATE TABLE DB2_TEST | |
( | |
ID smallint DEFAULT 0 | |
) | |
*/ | |
$dsn = 'HOSTNAME=localhost;UID=db2inst1;PWD=Passw0rd;DATABASE=test'; | |
$conn = db2_connect($dsn, null, null); | |
if (!$conn) { | |
echo db2_conn_errormsg(), PHP_EOL; | |
exit(1); | |
} | |
printf('PHP: %s' . PHP_EOL, phpversion()); | |
printf('ibm_db2: %s' . PHP_EOL, phpversion('ibm_db2')); | |
$server = db2_server_info($conn); | |
printf('DB2 NAME: %s, VERSION: %s' . PHP_EOL, $server->DBMS_NAME, $server->DBMS_VER); | |
// without executing a query before the following one, the issue is not reproducible | |
$stmt = db2_prepare($conn, 'SELECT 1 FROM SYSIBM.SYSDUMMY1'); | |
$result = db2_execute($stmt); | |
if (!$result) { | |
echo db2_stmt_errormsg(), PHP_EOL; | |
exit(1); | |
} | |
// the value of $true is the result of comparison of an array element value | |
// with the same value. if it's just literal true, the issue is not reproducible | |
$array = array('key' => 'value'); | |
$true = $array['key'] == 'value'; | |
$stmt = db2_prepare($conn, 'SELECT ID FROM DB2_TEST WHERE ID = ?'); | |
$result = db2_execute($stmt, [$true]); | |
if (!$result) { | |
echo db2_stmt_errormsg(), PHP_EOL; | |
exit(1); | |
} | |
echo 'OK', PHP_EOL; | |
// [IBM][CLI Driver] CLI0111E Numeric value out of range. SQLSTATE=22003 SQLCODE=-99999 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment