small lesson in using database wanted

Brent Anderson brentj84062 at gmail.com
Thu Jan 18 19:39:29 EST 2007


Hello.

Although there are many database functions provided with Revolution,  
I prefer opening a connection and making SQL calls using  
revDataFromQuery. A full tutorial on SQL can be found at  
www.w3schools.com/sql/ that goes over everything you need to know to  
work with any SQL database.

Thanks,
Brent Anderson
CMSEC


On Jan 18, 2007, at 5:32 PM, Reinhold Venzl-Schubert wrote:

> 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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list