I've just come across what I think must be a coldfusion bug.
I have a query:
<cfquery name="qryTest" datasource="#This.ds#">
SELECT *
FROM MyLovelyTable
WHERE 1=1
AND phoneNumber = <cfqueryparam cfsqltype="cf_sql_bigint" value="#variables.phoneNumber#">
AND callTime between <cfqueryparam cfsqltype="cf_sql_date" value="#variables.startDate#"> AND <cfqueryparam cfsqltype="cf_sql_date" value="#variables.endDate#">
ORDER BY phoneID
</cfquery>
The problem is that if I pass through the second date variable nothing is returned. If I copy the query prefix SQL and parameters out and query the database directly results are returned. Its just when it goes through CF that it doesn't work. If I remove the second date parameter it works fine. And if I convert the second date parameter into a string it will work.
I've tried swapping the value of the second parameter out to now() which doesn't work either.
As far as I can tell the issue is that the second date parameter is a date type.
Am I doing anything clearly wrong which im not aware of?
The startDate and endDate variables are coldfusion dateTime objects. CallTime is a dateTime column in a MariaDB.