Skip to content

Commit

Permalink
more compatible SQL, error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
NattyNarwhal committed Nov 25, 2024
1 parent 29ca273 commit cbcc729
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_gh_62.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,17 @@ $table = "EMPTY_NVARCHAR";
$drop = "DROP TABLE $table";
$res = @db2_exec($conn, $drop);
/* ensure that SQL_NTS is used so empty strings work for not just VARCHAR */
$create = "CREATE OR REPLACE TABLE $table (TEXTME NVARCHAR(1024))"; /* CCSID 1200? */
$create = "CREATE TABLE $table (TEXTME NVARCHAR(1024))"; /* CCSID 1200? */
$res = db2_exec($conn, $create);
if ($res == false) {
die("Failed to create table: " . db2_stmt_error($create) . " - " . db2_stmt_errormsg($create) . "\n");
}
$insert = "INSERT INTO $table (TEXTME) VALUES (?)";
$sth = db2_prepare($conn, $insert);
$res = db2_execute($sth, array($input));
if ($res == false) {
die("Failed to insert: " . db2_stmt_error($insert) . " - " . db2_stmt_errormsg($insert) . "\n");
}
$look = "select TEXTME from $table";
$res = db2_exec($conn, $look);
$row = db2_fetch_array($res);
Expand Down

0 comments on commit cbcc729

Please sign in to comment.