diff --git a/core/src/main/java/lucee/runtime/tag/ProcParamBean.java b/core/src/main/java/lucee/runtime/tag/ProcParamBean.java index 770de75194..e7d91d8b6c 100755 --- a/core/src/main/java/lucee/runtime/tag/ProcParamBean.java +++ b/core/src/main/java/lucee/runtime/tag/ProcParamBean.java @@ -181,7 +181,9 @@ public Object getValueForCF() throws PageException { @Override public boolean isNulls() { return getValue() == null - || (sqlType != Types.VARCHAR && sqlType != Types.LONGVARCHAR && sqlType != Types.NVARCHAR && getValue() instanceof String && StringUtil.isEmpty(getValue())); + || (sqlType != Types.VARCHAR && sqlType != Types.LONGVARCHAR && sqlType != Types.NVARCHAR + && sqlType != Types.NCHAR && sqlType != Types.CHAR + && getValue() instanceof String && StringUtil.isEmpty(getValue())); } @Override diff --git a/test/tickets/LDEV1917.cfc b/test/tickets/LDEV1917.cfc index 54e30491bd..73148afb2a 100644 --- a/test/tickets/LDEV1917.cfc +++ b/test/tickets/LDEV1917.cfc @@ -4,10 +4,48 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="mysql" { } function run( testResults , testBox ) { if(!hasCredentials()) return; - describe( "test suite for LDEV-1917()", function() { + describe( "test suite for LDEV-1917", function() { it(title = "cfprocparam passes null instead of empty strings with NVARCHAR cfsqltype", body = function( currentSpec ) { local.result = _InternalRequest( - template:"#variables.uri#/test.cfm" + template:"#variables.uri#/test.cfm", + form: { + datatype: "nvarchar" + } + ); + expect(local.result.filecontent.trim()).toBeTrue(); + }); + + it(title = "cfprocparam passes null instead of empty strings with CHAR cfsqltype", body = function( currentSpec ) { + local.result = _InternalRequest( + template:"#variables.uri#/test.cfm", + form: { + datatype: "char" + } + ); + expect(local.result.filecontent.trim()).toBeTrue(); + }); + }); + + describe( "test suite for LDEV-4645", function() { + + it(title = "cfprocparam passes null instead of empty strings with NVARCHAR cfsqltype, col not null", body = function( currentSpec ) { + local.result = _InternalRequest( + template:"#variables.uri#/test.cfm", + form: { + datatype: "nvarchar", + notNull: true + } + ); + expect(local.result.filecontent.trim()).toBeTrue(); + }); + + it(title = "cfprocparam passes null instead of empty strings with CHAR cfsqltype, col not null", body = function( currentSpec ) { + local.result = _InternalRequest( + template:"#variables.uri#/test.cfm", + form: { + datatype: "char", + notNull: true + } ); expect(local.result.filecontent.trim()).toBeTrue(); }); diff --git a/test/tickets/LDEV1917/Application.cfc b/test/tickets/LDEV1917/Application.cfc index b1c1ff4e46..65882041cc 100644 --- a/test/tickets/LDEV1917/Application.cfc +++ b/test/tickets/LDEV1917/Application.cfc @@ -1,5 +1,12 @@ component { - this.name = "ac"; + this.name = "ldev-1917"; + + param name="form.datatype"; + param name="form.notNull" default="false"; + + + if (form.datatype neq "char" and form.datatype neq "nvarchar") + throw "bad datatype [#form.datatype#]"; mySQL = getCredentials(); if(mySQL.count()!=0){ @@ -8,9 +15,9 @@ component { public function onRequestStart() { setting requesttimeout=10; - } - public function onApplicationStart() { + var extra= form.notNull ? " NOT NULL" : ""; + query { echo("DROP PROCEDURE IF EXISTS `LDEV1917SP`"); } @@ -18,11 +25,11 @@ component { echo("DROP TABLE IF EXISTS `LDEV1917`"); } query { - echo("CREATE TABLE LDEV1917 (null_Value nvarchar(10))"); + echo("CREATE TABLE LDEV1917 (null_Value #form.datatype#(10) #extra# )"); } query { echo(" - CREATE PROCEDURE `LDEV1917SP`(IN null_Value nvarchar(10)) + CREATE PROCEDURE `LDEV1917SP`(IN null_Value #form.datatype#(10)) BEGIN INSERT INTO LDEV1917 VALUE(null_Value); END diff --git a/test/tickets/LDEV1917/test.cfm b/test/tickets/LDEV1917/test.cfm index c85308c13e..346c74ffab 100644 --- a/test/tickets/LDEV1917/test.cfm +++ b/test/tickets/LDEV1917/test.cfm @@ -1,6 +1,6 @@ - + select * from LDEV1917