use-revolution Digest, Vol 40, Issue 30

Reinhold Venzl-Schubert r.venzl-schubert at t-online.de
Sun Jan 21 16:49:15 EST 2007


Hello Brent,

I had studied thoroughly the database library of Revolution and the
SQL-Tutorial before. But that did not saved me from going a wrong way.

Unfortunately I became aware of it, when I worked some time at
my database junction. Creating the db, filling it, selecting  
information and
at least changing them.

Now I use revDataFromQuery too and hope I will be more successful.

Thanks for your suggestion!
Reinhold



Am 19.01.2007 um 16:26 schrieb use-revolution-request at lists.runrev.com:

> 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




More information about the use-livecode mailing list