Why is Lucee choking on TIMESTAMP?

Viewed 27

I am working on a CFML project (Lucee engine) with a MySQL backend. I have a function that contains an SQL update statement. The "raw" query looks like this:

<cfquery name="del" datasource="#APPLICATION.db.source#" username="#APPLICATION.db.user#" password="#APPLICATION.db.pass#">
    UPDATE changemgmt.rfc
    SET deleted_timestamp = <cfqueryparam cfsqltype="CF_SQL_TIMESTAMP" value="#Now()#">,
    SET deleted_by = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#SESSION.user.name#">
    WHERE rfc_id = <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#arguments.rfc_id#">;
</cfquery>

Lucee is returning an error message like this one:

Lucee 5.3.7.48 Error (database)
Message You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET deleted_by = 'first.last'
WHERE rfc_id = 3' at line 3
SQL UPDATE changemgmt.rfc
SET deleted_timestamp = modified_timestamp = {ts '2022-09-12 10:14:13'},
SET deleted_by = 'first.last'
WHERE rfc_id = 3;

If I remove the SET deleted_timestamp line, the function/query executes just as it should. Can anyone tell me why what I have is not working?

1 Answers

I have discovered my error. I need to remove the second SET keyword from the SQL statement. Also, Dreamweaver was being quirky and not reflecting my edits. I closed Dreamweaver and reopened it and it was as if I hadn't made any edits when in fact I had.

Related