Where are DB commands

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Don Pederson
Posts: 6
Joined: Thu Jun 01, 2006 7:20 pm

Where are DB commands

Post by Don Pederson » Tue Mar 10, 2009 3:07 pm

Page 285 in user's guide refers to the following ==

put revGetSQLQuery and revSetSQLofQuery

Where are these found and how does one use them?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Tue Mar 10, 2009 9:16 pm

Hi Don,

This pair of function and command pertain to automated database queries - where you use the Database Query Builder to setup a connection to a database and define a number of fixed queries.
Once you have setup the queries, you can lay out fields, checkboxes and other controls, and link them to those queries to display and edit individual columns - and buttons to traverse the query result set, refreshing the linked controls to display the data of the current record in the result set.
While mainly meant for browsing and light editing of the contents of database records, it can't help you for creating or deleting records; nor can two queries be 'linked' to one another, which would help for 'master-detail' style forms. However, the function and command you mention come to aid for that.
These queries have a name, which you can use to read and alter the SQL query, triggering a refresh of the linked controls. So suppose you have a query "CustomerDetails" with SQL statement

Code: Select all

SELECT * FROM Customer WHERE Customer.cust_Id = 5
then you can retrieve the SQL by using the function

Code: Select all

put revGetSQLOfQuery("CustomerDetails") into tSqlQuery
and you can alter it by using the command

Code: Select all

put 99 into word -1 of tSqlQuery
revSetSQLOfQuery "CustomerDetails", tSqlQuery
which will cause Revolution to run the new query and update all the linkd controls with the correct data. Neat, isn't it?

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply