Tragedy...
FIREDAC connection Postgre database, using default properties, when executing multiple SQL at a time, will be reported "cannot insert multiple commands into a prepared statement" error
To the online check (Baidu), what information can not be found, and then Google, to find a lot of foreign information (this sentence purely to despise Baidu ...) Everyone crossing can ignore)
Search AH search, probably mean, postgre there are 2 modes one can only execute one sentence of SQL, the other is to support multi-SQL batch execution, the lookup process is ignored, in short, a variety of guesses
Finally, we found that there are 2 interfaces for the execution mode of Postgre:PQexec和PQexecParams 这个可以在Postgre的帮助文档31.3.1 中找到相关资料
where pqexec supports multiple SQL execution at the same time, while Pqexecparams supports only one SQL, the difference is whether SQL variable parameter values are supported
The FIREDAC default is to use the Pqexecparams interface to execute, so the error will be reported, if you want to execute in pqexec way, the method is as follows:
1.fdconnection.execsql
2. Set FDQuery.ResourceOptions.DirectExecute: = True;
Problem solving
Postgre cannot insert multiple commands into a prepared statement