#1 2026-06-18 07:59:18

squirrel
Member
Registered: 2015-08-13
Posts: 166

Run sql statement unprepared

Is there a way to specify that a specific sql statement should not be executed prepared?  In Mysql, some statements should not be prepared and causes Mysql to return:
This command is not supported in the prepared statement protocol yet (1295)
In these limited instances, it would be useful to be able to directly execute the statement without preparing

Offline

#2 2026-06-18 17:58:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,510
Website

Re: Run sql statement unprepared

From the ORM? Or via direct SQL?

Which mormot.db unit do you use to connect to MySQL?

Offline

#3 2026-06-19 06:34:03

squirrel
Member
Registered: 2015-08-13
Posts: 166

Re: Run sql statement unprepared

Direct SQL
mormot.db.sql, mormot.db.sql.odbc and for another project mormot.db.rad.firedac

Offline

#4 2026-06-19 19:48:04

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,510
Website

Re: Run sql statement unprepared

Which statements are you referring to?
Does these statements return results or just execute some command?

You have low-level access to ExecDirect() and ExecDirectW() in TOdbcLib perhaps you could use that.
It may be possible to add some new methods to TSqlDBOdbcStatement, like ExecuteDirect().

But it is not directly supported yet.

Offline

#5 Today 07:19:33

squirrel
Member
Registered: 2015-08-13
Posts: 166

Re: Run sql statement unprepared

Thanks @ab, I'll take a look at ExeDirect.  Currently the LOAD DATA Mysql command can not be run prepared.

Offline

Board footer

Powered by FluxBB