queryExecute() does not throw error when there are missing params

Description

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.

Environment

None

Activity

Show:
Pothys - MitrahSoft
June 21, 2019, 1:30 PM

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

JP
June 5, 2019, 10:27 PM

It shows an empty string, and NULL in the DB.

Zac Spitzer
June 5, 2019, 10:26 PM

What does the debugging output show, null or the timestamp?

JP
June 5, 2019, 8:16 PM

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.

JP
May 29, 2019, 1:49 PM

I will run a test and post back.

Assignee

Igal Sapir

Reporter

JP

Priority

New

Labels

Fix versions

None

Affects versions