revQueryDatabase | ||||||||||||||||
Type | function | |||||||||||||||
Dictionary | LCS | |||||||||||||||
Library | LiveCode Script | |||||||||||||||
Syntax |
| |||||||||||||||
Synonyms | revdb_query,revquerydatabaseblob | |||||||||||||||
Associations | database library | |||||||||||||||
Summary | ||||||||||||||||
Introduced | 1.1 | |||||||||||||||
Changes | The revQueryDatabase synonym was added in version 2.0. | |||||||||||||||
OS | mac, windows, linux, ios, android | |||||||||||||||
Platforms | desktop, server, mobile | |||||||||||||||
Parameters |
| |||||||||||||||
Example |
| |||||||||||||||
Values |
| |||||||||||||||
Related | Keyword: integer, element Control Structure: function Command: revCloseCursor, revExecuteSQL Function: revDataFromQuery, revQueryIsAtStart Library: Database library Glossary: command, LiveCode custom library, variable, element, standalone application, binary file, array, prepend, SQL query, record set, return value, record, Standalone Application Settings, database | |||||||||||||||
Security | disk, network | |||||||||||||||
Description | Use the revQueryDatabase function to select records in a database to work on. The SQLQuery may contain one or more placeholders, which are sequential numbers prepended by a colon. The revQueryDatabase function substitutes the corresponding variable name in the variablesList for each of these placeholders. For example, if you have two variables called "valueX" and "valueY", you can use a SQLQuery that includes placeholders as follows:
The content of the variable valueX is substituted for the ":1" in the SQLQuery (in both places where ":1" appears), and the content of valueY is substituted for ":2". If you specify an arrayName rather than a list of ordinary variables, the revQueryDatabase function substitutes the corresponding element of the array for each of the placeholders in the query:
The content of the element myArray[1] is substituted for the ":1" in the SQLQuery (in both places where ":1" appears), and the content of myArray[2] is substituted for ":2". To pass binary data in a variable in the variablesList, prepend
If the query is not successful, the revQueryDatabase function returns an error message. The error message is never an integer, so you can check whether the query was successful by checking whether the return value is an integer or not.
| |||||||||||||||
Tags | database |