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 3f2d4756f3..73148afb2a 100644
--- a/test/tickets/LDEV1917.cfc
+++ b/test/tickets/LDEV1917.cfc
@@ -1,13 +1,51 @@
-component extends="org.lucee.cfml.test.LuceeTestCase"{
+component extends="org.lucee.cfml.test.LuceeTestCase" labels="mysql" {
function beforeAll(){
variables.uri = createURI("LDEV1917");
}
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();
});
@@ -18,7 +56,6 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{
return baseURI&""&calledName;
}
-
private boolean function hasCredentials() {
return (structCount(server.getDatasource("mysql")) gt 0);
}
diff --git a/test/tickets/LDEV1917/Application.cfc b/test/tickets/LDEV1917/Application.cfc
index ab9198fbc6..65882041cc 100644
--- a/test/tickets/LDEV1917/Application.cfc
+++ b/test/tickets/LDEV1917/Application.cfc
@@ -1,19 +1,23 @@
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){
- this.datasource="#{
- class: 'com.mysql.cj.jdbc.Driver'
- , bundleName:'com.mysql.cj'
- , bundleVersion:'8.0.15'
- , connectionString: 'jdbc:mysql://'&mySQL.server&':'&mySQL.port&'/'&mySQL.database&'?useUnicode=true&characterEncoding=UTF-8&useLegacyDatetimeCode=true'
- , username: mySQL.username
- , password: mySQL.password
- }#";
+ this.datasource=mySQL;
}
+
+ public function onRequestStart() {
+ setting requesttimeout=10;
+
+ var extra= form.notNull ? " NOT NULL" : "";
- public function onApplicationStart() {
query {
echo("DROP PROCEDURE IF EXISTS `LDEV1917SP`");
}
@@ -21,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
@@ -33,33 +37,6 @@ component {
}
}
private struct function getCredentials() {
- // getting the credentials from the enviroment variables
- var mySQL={};
- if(
- !isNull(server.system.environment.MYSQL_SERVER) &&
- !isNull(server.system.environment.MYSQL_USERNAME) &&
- !isNull(server.system.environment.MYSQL_PASSWORD) &&
- !isNull(server.system.environment.MYSQL_PORT) &&
- !isNull(server.system.environment.MYSQL_DATABASE)) {
- mySQL.server=server.system.environment.MYSQL_SERVER;
- mySQL.username=server.system.environment.MYSQL_USERNAME;
- mySQL.password=server.system.environment.MYSQL_PASSWORD;
- mySQL.port=server.system.environment.MYSQL_PORT;
- mySQL.database=server.system.environment.MYSQL_DATABASE;
- }
- // getting the credentials from the system variables
- else if(
- !isNull(server.system.properties.MYSQL_SERVER) &&
- !isNull(server.system.properties.MYSQL_USERNAME) &&
- !isNull(server.system.properties.MYSQL_PASSWORD) &&
- !isNull(server.system.properties.MYSQL_PORT) &&
- !isNull(server.system.properties.MYSQL_DATABASE)) {
- mySQL.server=server.system.properties.MYSQL_SERVER;
- mySQL.username=server.system.properties.MYSQL_USERNAME;
- mySQL.password=server.system.properties.MYSQL_PASSWORD;
- mySQL.port=server.system.properties.MYSQL_PORT;
- mySQL.database=server.system.properties.MYSQL_DATABASE;
- }
- return mysql;
+ return server.getDatasource("mysql");
}
}
\ No newline at end of file
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