cfprocparam passes null instead of empty strings with NVARCHAR cfsqltype

Description

issue seems to be related with lucee-java/lucee-core/src/lucee/runtime/tag/ProcParamBean.java function isNulls that currently supports empty strings only for VARCHAR and LONGVARCHAR string types.

public boolean isNulls() { return getValue()==null || (sqlType!=Types.VARCHAR && sqlType!=Types.LONGVARCHAR && getValue() instanceof String && StringUtil.isEmpty(getValue())); // <--- missing support for NVARCHAR and other string types }

how to reproduce:
sql structure:

CREATE TABLE [dbo].[__nvarchartest]( [nv] [nvarchar](10) NULL ) GO CREATE PROCEDURE [dbo].[__sp_nvarchartest] @nv nvarchar AS BEGIN INSERT INTO __nvarchartest VALUES (@nv) END GO

cfml code

<cfstoredproc procedure="__sp_nvarchartest" datasource="#DSOURCE#"> <cfprocparam type = "IN" CFSQLType = "NVARCHAR" value = "" null=false> </cfstoredproc>

expected result:
1 record with empty string in nv column
but getting:
1 record with null in nv column

Environment

None

Activity

Show:

Pothys - MitrahSoft 8 August 2018 at 11:16

I've Added the test case for this ticket

Pull request: https://github.com/lucee/Lucee/pull/545

Pothys - MitrahSoft 17 July 2018 at 15:12
Edited

I've analyzed this ticket & confirmed the issue happened on lucee.
Running above stored procedure, Data type both VARCHAR & LONGVARCHAR behave like same. NVARCHAR only insert the NULL record into the table. But output the data from retrieved query also be a empty.

Null support: Complete support
Record inserted with NULL, but while retrieve from table and dump the query it'll be empty.

Null support: Partial support
Record inserted with NULL, but while retrieve from table and dump the query it'll be Null.

Added a fix for this issue.

Pull request: https://github.com/lucee/Lucee/pull/539

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Created 16 July 2018 at 12:30
Updated 20 July 2023 at 09:59
Resolved 13 August 2018 at 15:38

Flag notifications