Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/db/SQLCaster.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public static void setValue(PageContext pc, TimeZone tz, PreparedStatement stat,
case Types.DOUBLE:
case Types.FLOAT:
try {
if (type == Types.FLOAT) stat.setFloat(parameterIndex, Caster.toFloatValue(value));
if (type == Types.FLOAT) stat.setDouble(parameterIndex, Caster.toDoubleValue(value));
else if (type == Types.DOUBLE) stat.setDouble(parameterIndex, Caster.toDoubleValue(value));
else stat.setObject(parameterIndex, Caster.toDouble(value), type);
}
Expand Down
26 changes: 26 additions & 0 deletions test/tickets/LDEV6305.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
component extends = "org.lucee.cfml.test.LuceeTestCase" labels="mssql" {

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

function run( testResults, testBox ){
describe("Test case for LDEV6305", function(){
it( title = "CF_SQL_FLOAT Should Return Records for Matching Decimal Values", skip=isNotSupported(), body = function( currentSpec ){
local.result = _InternalRequest(
template : "#uri#/ldev6305.cfm"
);
expect(trim(result.filecontent)).toBe(1);
});
});
}

private function isNotSupported() {
return isEmpty(server.getDatasource("mssql"));
}

private string function createURI(string calledName){
var baseURI="/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI&""&calledName;
}
}
25 changes: 25 additions & 0 deletions test/tickets/LDEV6305/Application.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
component {

this.name = "ldev6305";
this.datasources["LDEV6305"] = server.getDatasource("mssql");
this.datasource = "LDEV6305";

public function onRequestStart() {
setting requesttimeout=10;
query{
echo("DROP TABLE IF EXISTS LDEV6305");
}
query{
echo("CREATE TABLE LDEV6305(id INT IDENTITY(1,1) PRIMARY KEY, float_value FLOAT)");
}
query{
echo("INSERT INTO LDEV6305(float_value) VALUES(2.01)");
}
}

public function onRequestEnd(){
query{
echo("DROP TABLE IF EXISTS LDEV6305");
}
}
}
13 changes: 13 additions & 0 deletions test/tickets/LDEV6305/LDEV6305.cfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<cfoutput>
<cftry>
<cfquery name="LDEV6305">
SELECT *
FROM LDEV6305
WHERE float_value = <cfqueryparam value="2.01" cfsqltype="CF_SQL_FLOAT">
</cfquery>
#LDEV6305.recordcount#
<cfcatch type="any">
#cfcatch.stacktrace#
</cfcatch>
</cftry>
</cfoutput>
Loading