small lesson in using database wanted

Reinhold Venzl-Schubert R.Venzl-Schubert at T-Online.de
Thu Jan 18 19:32:03 EST 2007


Hi,

I need a small lesson in using database:

1. I created a db (using SQLite3) with several fields. One of them is  
a boolean field. It is corresponding to a checkbox button in the card  
of my stack. Only one record of the database is displayed on the card.

2. I built a query that selects some of the records of my db and  
sorts them by some fields.

3. With a forward and backward button >revdb_movenext(recordSetID)<  
and >revdb_moveprev(recordSetID)< I navigate through the records of  
the recordSet.

4. With a script >set the hilite of btn "checkbox" to  
revdb_columnbynumber(recordSetID,5)< I display the database fields of  
the actual record in the fields of my card.

5. Then I wrote a script for the checkbox button >revdb_execute 
(recordSetID,tSQL)< with tSQL like: >UPDATE my_db SET checkbox =  
"true" .... < and so on. I tested it with the SQLite Database  
Browser: the changes have been saved.

6. When I use my forward and backward button, to switch to the next  
record and then back to the changed record I do not see the change in  
my field or in my special case, the checkbox is not hilited.

7. When I close the current cursor (recordSet) and make a new query  
the checkbox is hilited.

I learned that the UPDATE-script changes the database but it do not  
change the cursor (recordSet).
But the forward/backward button do not display the content of the  
database but the content of the current cursor (recordSet).

- How can I get the content of the database?
- Do I have to make a new query after every change of fields?
- Or is it better to use the revdb_query funktion only to get a  
sorted list of primary keys of the wanted records and to use the  
revdb_querylist funktion to display the content of the db fields on  
the card?

I am rather confused.

Reinhold



More information about the use-livecode mailing list