Copy link to clipboard
Copied
i have function for running multiple query MariaDB. but i have problem with cfquery.
<cffunction name="testQuery">
<cftry>
<cfquery name="qResult" datasource="dbsf_mariadev" result="qResult">
BEGIN;
DROP PROCEDURE if exists SF6COLA_INSERTTBL;
CREATE PROCEDURE SF6COLA_INSERTTBL()
LANGUAGE SQL
BEGIN
IF (select id from __contoh01 where id=1 and nilai=1) THEN
BEGIN
update __CONTOH01 set id=1,nilai=1 where id=1 and nilai=1;
END;
ELSE
BEGIN
insert ignore into __contoh01 (id,nilai) values (1,1) ON DUPLICATE KEY UPDATE id=1 , nilai=1;
END;
END IF;
END;
CALL SF6COLA_INSERTTBL();
COMMIT;
</cfquery>
<cfdump var="#qResult#"/>
<cfcatch><cfdump var="#cfcatch#"/></cfcatch>
</cftry>
</cffunction>
result:
please help me to solved this case.
Copy link to clipboard
Copied
I suspect you have a database error. To verify, run the SQL in a MySQL database management tool such as SQLyog.
Copy link to clipboard
Copied
i was try in tools HeidiSQL, the result is success running this query
Copy link to clipboard
Copied
What is the result of cfdump when you change <cfcatch> into <cfcatch type="database">?
Second idea: the error may have occurred elsewhere. For example, in Application.cfm or Application.cfc. Could you show us the code in your application file.