-
Notifications
You must be signed in to change notification settings - Fork 27
Closed
Labels
Description
Found from a user report. Reproduces on IBM i:
<?php
$c = db2_connect("*LOCAL", "", "") or die("can't connect\n");
db2_exec($c, "CREATE OR REPLACE TABLE QTEMP.AH_REPRO(FLSFNUM NVARCHAR(2048))") or die("can't make table\n");
$parm = "";
$s = db2_prepare($c, "INSERT INTO QTEMP.AH_REPRO VALUES(?)");
db2_bind_param($s, 1, "parm", DB2_PARAM_IN);
db2_execute($s) or die("can't execute insert\n");
$s = db2_prepare($c, "SELECT * FROM QTEMP.AH_REPRO");
db2_execute($s) or die("can't execute select\n");
while (($r = db2_fetch_assoc($s)) != false) {
var_dump($r);
}Fails with:
Warning: db2_execute(): Statement Execute Failed in /home/CALVIN/ah.php on line 12
Warning: db2_execute(): Mixed data or UTF-8 data not properly formed. SQLCODE=-191 in /home/CALVIN/ah.php on line 12
Changing $parm to a non-empty string or the column to plain VARCHAR works correctly. Looks like the only difference when called is SQLBindParam's fSqlType type has SQL_WVARCHAR instead of SQL_VARCHAR.