<commit_before>component extends = "org.lucee.cfml.test.LuceeTestCase"{

	function beforeAll() {
		variables.uri = createURI("LDEV2586");

		variables.credencials=getCredencials();
		variables.hasCredencials=structCount(variables.credencials);
		if(variables.hasCredencials) {
			// define datasource
			application action="update" 
				datasource={
				'LDEV2586': {
			 	class: 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
				, bundleName: 'com.microsoft.sqlserver.mssql-jdbc'
				, bundleVersion: '7.0.0'
				, connectionString: 'jdbc:sqlserver://'&msSQL.server&':'&msSQL.port&';DATABASENAME='&msSQL.database&';sendStringParametersAsUnicode=true;SelectMethod=direct'
				, username: msSQL.username
				, password: <PASSWORD>
			}};

			// create necessary tables
			query datasource="LDEV2586" {
				echo("DROP TABLE IF EXISTS LDEV2586");
			}
			query datasource="LDEV2586"{
				echo("CREATE TABLE LDEV2586( id int, value decimal )");
			}
			query datasource="LDEV2586"{
				echo("INSERT INTO LDEV2586 VALUES( 1,'1000' )");
				echo("INSERT INTO LDEV2586 VALUES( 2,'23.45' )");
			}
		}
	}

	public function afterAll(){
		query datasource="LDEV2586"{
			echo("DROP TABLE IF EXISTS LDEV2586");
		}
	}

	function run( testResults , testBox ) {
		describe( "Test case for LDEV-2586", function() {



			it(title = " cfqueryparam does handle decimal value = 1000 with maxLength = 8 ",skip=!variables.hasCredencials, body = function( currentSpec ) {
				query name="local.test" datasource="LDEV2586" {
					echo("SELECT * FROM LDEV2586");
				}
				query name="local.subUsers" datasource="LDEV2586" {
				   echo("SELECT * FROM LDEV2586 WHERE value = ");
				   queryparam value='#test.value[1]#' cfsqltype="CF_SQL_DECIMAL" maxlength="8";
				}
				expect(subUsers.value).toBe('1000');
			});

			it(title = " cfqueryparam doesn't handle deciaml value = 1000 with maxLength = 7",skip=!variables.hasCredencials, body = function( currentSpec ) {
				query name="local.test" datasource="LDEV2586" {
					echo("SELECT * FROM LDEV2586");
				}
				query name="local.subUsers" datasource="LDEV2586" {
				   echo("SELECT * FROM LDEV2586 WHERE value = ");
				   queryparam value='#test.value[1]#' cfsqltype="CF_SQL_DECIMAL" maxlength="7";
				}
				expect(subUsers.value).toBe('1000');
			});

			it(title = " cfqueryparam does handle decimal value = 23.45 with maxLength = 5",skip=!variables.hasCredencials, body = function( currentSpec ) {
				query name="local.test" datasource="LDEV2586" {
					echo("SELECT * FROM LDEV2586");
				}
				query name="local.subUsers" datasource="LDEV2586" {
				   echo("SELECT * FROM LDEV2586 WHERE value = ");
				   queryparam value='#test.value[2]#' cfsqltype="CF_SQL_DECIMAL" maxlength="5";
				}
				expect(subUsers.value).toBe('23');
			});
		});
	}

	private string function createURI(string calledName){
		var baseURI = "/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
		return baseURI&""&calledName;
	}


	private struct function getCredencials() {
		// getting the credetials from the enviroment variables
		var msSQL={};
		if(
			!isNull(server.system.environment.MSSQL_SERVER) && 
			!isNull(server.system.environment.MSSQL_USERNAME) && 
			!isNull(server.system.environment.MSSQL_PASSWORD) && 
			!isNull(server.system.environment.MSSQL_PORT) && 
			!isNull(server.system.environment.MSSQL_DATABASE)) {<commit_msg>improve testcase, no additional call<commit_after>component extends = "org.lucee.cfml.test.LuceeTestCase"{

	function beforeAll() {
		variables.uri = createURI("LDEV2586");

		variables.credencials=getCredencials();
		if(structCount(variables.credencials)) {
			// define datasource
			application action="update" 
				datasource={
				'LDEV2586': {
			 	class: 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
				, bundleName: 'com.microsoft.sqlserver.mssql-jdbc'
				, bundleVersion: '7.0.0'
				, connectionString: 'jdbc:sqlserver://'&msSQL.server&':'&msSQL.port&';DATABASENAME='&msSQL.database&';sendStringParametersAsUnicode=true;SelectMethod=direct'
				, username: msSQL.username
				, password: <PASSWORD>
			}};

			// create necessary tables
			query datasource="LDEV2586" {
				echo("DROP TABLE IF EXISTS LDEV2586");
			}
			query datasource="LDEV2586"{
				echo("CREATE TABLE LDEV2586( id int, value decimal )");
			}
			query datasource="LDEV2586"{
				echo("INSERT INTO LDEV2586 VALUES( 1,'1000' )");
				echo("INSERT INTO LDEV2586 VALUES( 2,'23.45' )");
			}
		}
	}

	public function afterAll(){
		if(hasCredencials()) {
			query datasource="LDEV2586"{
				echo("DROP TABLE IF EXISTS LDEV2586");
			}
		}
	}

	function run( testResults , testBox ) {
		describe( "Test case for LDEV-2586", function() {



			it(title = " cfqueryparam does handle decimal value = 1000 with maxLength = 8 ",skip=!hasCredencials(), body = function( currentSpec ) {
				query name="local.test" datasource="LDEV2586" {
					echo("SELECT * FROM LDEV2586");
				}
				query name="local.subUsers" datasource="LDEV2586" {
				   echo("SELECT * FROM LDEV2586 WHERE value = ");
				   queryparam value='#test.value[1]#' cfsqltype="CF_SQL_DECIMAL" maxlength="8";
				}
				expect(subUsers.value).toBe('1000');
			});

			it(title = " cfqueryparam doesn't handle deciaml value = 1000 with maxLength = 7",skip=!hasCredencials(), body = function( currentSpec ) {
				query name="local.test" datasource="LDEV2586" {
					echo("SELECT * FROM LDEV2586");
				}
				query name="local.subUsers" datasource="LDEV2586" {
				   echo("SELECT * FROM LDEV2586 WHERE value = ");
				   queryparam value='#test.value[1]#' cfsqltype="CF_SQL_DECIMAL" maxlength="7";
				}
				expect(subUsers.value).toBe('1000');
			});

			it(title = " cfqueryparam does handle decimal value = 23.45 with maxLength = 5",skip=!hasCredencials(), body = function( currentSpec ) {
				query name="local.test" datasource="LDEV2586" {
					echo("SELECT * FROM LDEV2586");
				}
				query name="local.subUsers" datasource="LDEV2586" {
				   echo("SELECT * FROM LDEV2586 WHERE value = ");
				   queryparam value='#test.value[2]#' cfsqltype="CF_SQL_DECIMAL" maxlength="5";
				}
				expect(subUsers.value).toBe('23');
			});
		});
	}

	private string function createURI(string calledName){
		var baseURI = "/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
		return baseURI&""&calledName;
	}


	private boolean function hasCredencials() {
		return structCount(getCredencials());
	}

	private struct function getCredencials() {
		// getting the credetials from the enviroment variables
		var msSQL={};
		if(
			!isNull(server.system.environment.MSSQL_SERVER) && 
			!isNull(server.system.environment.MSSQL_USERNAME) && 
			!isNull(server.system.environment.MSSQL_PASSWORD) && 
			!isNull(server.system.environment.MSSQL_PORT) && 
			!isNull(server.system.environment.MSSQL_DATABASE)) {
{'fraction_non_alphanumeric': 0.14582419189703086, 'fraction_numerical': 0.040953634635073864, 'mean_word_length': 4.180303030303031, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1277550', 'n_tokens_mistral': 2861, 'n_tokens_neox': 2262, 'n_words': 420}