queryExecute() does not throw error when there are missing params
Lucee does not throw an exception when there are missing params in an sql statement. For example, consider the following update query where :utcNow is not set in the params:
In my opinion, Lucee should throw an exception here. Instead, it passes NULL, which is obviously not what the programmer intended to do.
I've added a test case for this ticket & confirmed the issue happened on lucee. If we pass param as struct it updates the table with the default date time with empty value & that column also supports the null value.
If we pass the param as array of struct, It updates the table but doesn't returns the value. The data for the corresponding column shown as empty.
If we set a column to doesn't accept the null value, lucee throws error when pass a param as struct. If pass the param as arrayOfStruct means it updates & returns the default date time value. It aslo need to throw an error.
Pull request: https://github.com/lucee/Lucee/pull/700
It shows an empty string, and NULL in the DB.
What does the debugging output show, null or the timestamp?
OK, what was happening is that a param was defined, but was not a valid timestamp, and was therefore updating a row with a null value when it shouldn't have. This example is using MSSQL.
Consider the following code:
utcNow is not a valid timestamp, and I am not specifying null=true in the param value. The result of the update is to set a null value for the timestamp field. I'm not sure if this is a MSSQL thing, or a timestamp thing, or what... but my thinking is that since I am not specifying null=true, Lucee should throw an error.
I will run a test and post back.