To meet your needs, we constantly work to improve Querix products.
This means that Lycia documentation is developing as well.
In case you have found a certain dissonance between the provided information and the actual behavior of Lycia 3 and/or your applications, please, let us know about this via documentation@querix.com so that we can introduce the necessary changes to our documentation.
Thank you for your attention and cooperation.
This method is used to initialize a variable of the PREPARED data type. It prepares an SQL statement for execution in the RDBMS, and allocates the necessary resources to the prepared statement.
After a statement is prepared, it can be executed using the Execute() method. An initialized PREPARED variable can also be used in the Declare() method to declare a cursor for the prepared statement
This method accepts two parameters and returns sqlca.sqlcode, if the statement was prepared without errors.
The statement argument is either a quoted character string or a variable of a character data type which contains the text of the SQL statement to be prepared. The isNative argument specifies whether the statement should be prepared natively or not, and is optional. It is a BOOLEAN argument and its default value is 0 (FALSE) which indicates that the statement is not prepared natively. If you set it to 1 (TRUE), the statement will be prepared natively bypassing the SQL translator. The value of this argument for an initialized PREPARED variable can be checked using the IsNative() method.
An example method call:
# Preparing and executing an SQL statement
DEFINE prep_v PREPARED
CALL prep_v.Prepare("EXECUTE PROCEDURE proc1", 1)
CALL prep_v.Execute()
...
#Using a prepared statement in a cursor
DEFINE prep_v PREPARED,
cur_v CURSOR
CALL prep_v.Prepare("SELECT * FROM customers WHERE cust_id>100")
CALL cur_v.Declare(prep_v)