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.
CURSOR data type is an object data type which stores the cursor identifier. A cursor can be declared implicitly without using the CURSOR data type - by means of the DECLARE statement. Such cursor has global scope of reference. Using the CURSOR data type to declare a cursor explicitly a programmer can specify any desired scope of reference in the same way like for any other variable. Thus a CURSOR variable defined in the GLOBALS file will have the global scope of reference and a variable defined within a function will have the local scope of reference.
CURSOR variables can be passed to functions and returned by them in the same way as the variables of simple data types. You should not assign values to variables of this data type using the LET statement, for it may cause unexpected behavior.
Both explicitly and implicitly declared cursors are mangled internally to ensure compliance with name size restrictions, and to ensure uniqueness. Use the CURSOR_NAME() function to retrieve the name of a cursor declared as a data type with the CURSOR variable as its argument.
A CURSOR variable can be used with the special methods which declare the cursor, open it, fetch the rows, etc. These methods are different depending on the type of the cursor (select or insert). The methods are called in the same way as other functions and are used together with the CURSOR variable in the following manner:
variable.Method()
The methods used with the CURSOR variable to create and process a select cursor are as follows:
Declare() - declares the cursor
SetParameters() - sets the values for the placeholders, if any
Open() - opens the cursor
SetResults() - specifies variables to receive the returned records
A number of methods performing fetching, e.g.: Fetch(), FetchNext(), FetchFirst(), etc..
Close() - closes the cursor
An insert cursor needs a transaction to be opened first and then it will be typically used with the following methods:
Declare() - declares the cursor
Open() - opens the cursor
SetParameters() - specifies the values for the placeholders, if any
Put() - sends the rows into the buffer
Flush() - inserts the rows into the table
Close() - inserts the rows into the table and closes the cursor