|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesBind_Remember_Null (last revision 2012-10-25 08:33 UTC by james at kenjim dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-05-27 10:59 UTC] mr dot efrem at gmail dot com
[2013-03-21 19:05 UTC] matheus at gigatron dot com dot br
[2013-05-31 14:33 UTC] mbeccati@php.net
[2013-05-31 14:33 UTC] mbeccati@php.net
-Status: Open
+Status: Closed
[2014-10-07 23:19 UTC] stas@php.net
[2014-10-07 23:30 UTC] stas@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 20:00:01 2025 UTC |
Description: ------------ Using the firebird PDO driver and a parametrized insert query, you cannot use a null value for a column after issuing a query with a filled value for that same column. On the snipped below, it should be possible to insert both rows, but the second one fails with an exception. If you invert the order of the inserts (insert $args_err before $args_ok) then the script runs. Test script: --------------- /**Reference table: CREATE TABLE TEST_INSERT ( ID INTEGER NOT NULL, COL1 VARCHAR(40) ); */ $sql = "insert into test_insert (id, col1) values (?, ?);" $args_ok = [1, "test1"]; $args_err = [2, null]; $res = $stmt->execute($args_ok); var_dump($res); $res = $stmt->execute($args_err); var_dump($res); Expected result: ---------------- bool(true) bool(true) Actual result: -------------- bool(true) PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY105 ]: Invalid parameter type: -999 Parameter requires non-null value' in F:\demos\p hp\erro_insert_prep_null\test.php:42 Stack trace: #0 F:\demos\php\erro_insert_prep_null\test.php(42): PDOStatement->execute(Array) #1 {main} thrown in F:\demos\php\erro_insert_prep_null\test.php on line 42