gpt4 book ai didi

delphi - TADO查询已准备

转载 作者:行者123 更新时间:2023-12-03 15:07:40 30 4
gpt4 key购买 nike

TADOQuery 组件具有“prepared”属性,手册中说,当准备设置为 TRUE 时,ADO“准备”命令,这意味着什么??

以下是手册说明:

Set Prepared before calling the Execute method to specify whether ADO prepares the command. If Prepared is set to True and the command component is connected to a data store, ADO prepares the command before executing it. If Prepared is set to False, ADO does not prepare the command.

它将参数注入(inject)到 SQL 文本中?

最佳答案

以下是 Delphi 2007 帮助文件中的一些更好的文档:

Use the Prepared property to have the provider save a prepared (or compiled) version of the query specified in the CommandText property before a Command object's first execution. This may slow a command's first execution, but once the provider compiles a command, the provider will use the compiled version of the command for any subsequent executions, which will result in improved performance.

If the property is False, the provider will execute the Command object directly without creating a compiled version.

If the provider does not support command preparation, it may return an error when this property is set to True. If the provider does not return an error, it simply ignores the request to prepare the command and sets the Prepared property to False.

这基本上表示 SQL 语句已编译(预解析、标记化和分析)。当多次使用查询时,每次只需替换参数值即可使用此编译版本,而无需重新编译所有语句并执行其他工作。

关于delphi - TADO查询已准备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15408957/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com