The TADOQuery component has "prepared" property the manual says that when prepared is set TRUE, the ADO 'prepares' the commmand, what this means??
Here is the manual explanation:
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.
It injects the parameters into SQL Text?
Here's some better documentation from the Delphi 2007 help file:
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.
This basically says that the SQL statement is compiled (pre-parsed and tokenized and analyzed). When the query is used more than once, this compiled version can be used each time just substituting the parameter values, without having to re-compile all of the statement and do the other work.
Tt's to reduce the parsing and compiling overhead associated with repeatedly executing an SQL statement that is executed numerous times.
An application can execute a parameterized statement more than once by supplying a different parameter set at each execution instead of reconstructing the statement whenever the parameter set is different.
Executing Prepared Statements
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With