Description
Executes a query method; a query corresponds to a statement handle for a Connection Object.
Syntax
flag = QryMethod (hQry, method, arg1, arg2, arg3, arg4, arg5)
Parameters
The QryMethod function has the following parameters:
Parameter | Description |
---|---|
hQry | Handle to the Query. |
method | See methods below. |
arg1...arg5 | Method specific; see methods below. |
Method | Description | ||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
QRY_CANCEL$ | Cancels an active query.
| ||||||||||||||||||||||||||||||||||||||||||
QRY_DESTROY$ | Releases a Query handle.
Error returned for an invalid handle or if an error occurred destroying the query. | ||||||||||||||||||||||||||||||||||||||||||
QRY_EXECUTE$ | Executes a query and checks for results.
| ||||||||||||||||||||||||||||||||||||||||||
QRY_GETERROR$ | Retrieves all pending query errors from the DS/XO API.
Error returned if no errors were pending. | ||||||||||||||||||||||||||||||||||||||||||
QRY_GETROW$ | Retrieves a row from the result set.
| ||||||||||||||||||||||||||||||||||||||||||
QRY_LISTCOLUMNS$ | Creates a result set (as if a script had been executed with QRY_EXECUTE$) of the columns in a database object. The result set contains the columns COLUMN NAME, DATA TYPE, PRECISION, SCALE, NULLABLE, TYPE NAME, LENGTH, RADIX, and REMARKS.
| ||||||||||||||||||||||||||||||||||||||||||
QRY_LISTTABLES$ | Creates a result set (as if a script had been executed with QRY_EXECUTE$) of the tables in the connected database. The result set contains the columns QUALIFIER, OWNER, NAME, TYPE, and REMARKS.
| ||||||||||||||||||||||||||||||||||||||||||
QRY_TRANSLATEFLAG$ | Translates the bit-masked flag returned from the DS/XO API into TRUE$ for success and FALSE$ for failure; success includes both success and success with information (meaning possible pending messages) and failure includes an error (meaning possible pending messages), an invalid handle, and no more data.
|
Returns
TRUE for successful execution or FALSE for failure.
See also
XOGetProperty()-XO_TABLEDESCRIPT$
Remarks
* example for QryMethod: function ExecuteScript(Script) $insert XO_Equates * returns @rm/@fm delimited results Results = "" * create connection (this could take params if you wanted, * but calling it with no params lets the user choose what * connection, etc. this is how the query window calls it: hXO = XOInstance() hQry = 0 if hXO then * create the query handle for the connection handle hQry = QryInstance(hXO) if hQry then * execute a script Flag = QryMethod(hQry, QRY_EXECUTE$, Script) if Flag then /* retrieve results and stick them in an @rm delimited array */ loop Flag = QryMethod(hQry, QRY_GETROW$, Row) while Flag Results := @rm: Row repeat Results [1,1] = "" * cancel script Flag = QryMethod(hQry, QRY_CANCEL$) end else gosub error end * close the query handle Flag = QryMethod(hQry, QRY_DESTROY$) end else gosub error end * close the connection Flag = XOMethod(hXO, XO_DESTROY$) end else gosub error end return Results * Error handling Error: if hQry then Flag = QryMethod(hQry, QRY_GETERROR$, "", "", "",| "",Text) end else Flag = XOMethod(hXO, QRY_GETERROR$, "", "", "", | "",Text) end convert @vm to @tm in Text Def = "" Def<MTEXT$> = Text Def<MCAPTION$> = "ExecuteScript Error" Def<MICON$> = "!" Msg(@window, Text) Results = "" return