Postgre cannot insert multiple commands into a prepared statement

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.