Using SQL and revDatabase methods with Valentina

Ruslan Zasukhin sunshine at public.kherson.ua
Fri Feb 1 02:44:20 EST 2008


On 1/2/08 12:50 AM, "Walton Sumner" <wsumner at im.wustl.edu> wrote:

Hi Walton,

First quick points.

1) Many people say very good words about Trevors db library, which is
wrapper to few dbs or Rev. So you get from box universal API.

2) I advice you subscribe to Valentina list and CC to both lists questions
which may be related to both Rev and Valentina, or only to Valentina list if
question is specific to Valentina. Important is that Valentina engineers
will be able see your questions.

3) Check V4REV/Examples/TestProject.rev
    
    It have section which tests RBDB API, so you can see how it should be
used. Also it show how can be used bridges from Valentina API to RevDB and
visa versa.

P.S. Trevor, superbundle have got a lots new REV developers, as you know.
Will be great if you once again make sure that your cool db lib works fine
with all dbs.


> Help, please. I'm using Valentina 2.5.8 (superbundle), and would like to use
> SQL or the Revolution methods for the sake of portability, but I have not
> learned to do this yet. The Valentina direct access functions work, so most
> of the pieces must be in place. What am I doing wrong? Here's an example:
> 
> function errorCheck pDialog
>     if Valentina_ErrNumber()<>0 then
>         if pDialog<>false then
>             answer Valentina_ErrString()
>         end if
>         return "Error"
>     end if
>     return ""
> end errorCheck
> 
> --see here for the tQuery prototype:
> http://www.valentina-db.com/dokuwiki/doku.php?id=paradigma:public:en:documen
> tation:vsql:reference:show:show_table
> 
> --This function should list the tables in sDatabase
> --sDatabase is a script level variable identifying the database
> function DatabaseTables
> 
>     local tQuery = "SELECT name FROM (SHOW TABLES) WHERE type = 'TABLE'"
>     local tList,tArray,tFirstRec,tMaxRec,tCursor
>     put "" into tArray
> 
>     breakpoint
> 
>     put VDatabase_SqlSelectRecords(sDatabase, \
>        tQuery,"kClientSide","kReadOnly","kForwardOnly", \
>        tArray,1,-1,tab,CR) into tList
>     get errorCheck() --> Unexpected token SHOW
> 
>     put "SELECT * FROM (SHOW TABLES)" into tQuery
>     put VDatabase_SqlSelectRecords(sDatabase, tQuery,"kClientSide", \
>        "kReadOnly","kForwardOnly",tArray,1,-1,tab,CR) \
>        into tList
>     get errorCheck() --> Unexpected token SHOW
> 
>     put VDataBase_SqlSelect( sDatabase, tQuery,"kClientSide", \
>        "kReadOnly", "kForwardOnly", tArray ) into tCursor
>     get errorCheck() --> Unexpected token SHOW
>      
>     --local tList
>     local tCount, i, tReference, tName, tID, tFields, tRecords
>     put VDataBase_TableCount( sDatabase ) into tCount
>     repeat with i = 1 to tCount
>         put VDatabase_Table( sDatabase, i ) into tReference
>         put VTable_Name( tReference ) into tName
>         put VTable_ID( tReference ) into tID
>         put VTable_FieldCount( tReference ) into tFields
>         put VTable_RecordCount( tReference ) into tRecords
>         put i & tab & tName & tab & tReference & tab & tID \
>             & tab & tFields & tab & tRecords & CR after tList
>     end repeat
>     delete last char of tList
>     return tList --> tList is correct
> end DatabaseTables
> 
> In general, I find that Valentina examples, tutorials, etc, use the direct
> Valentina calls for a wide range of operations, and SQL and revDatabase
> methods for far fewer operations, if any.
> 
> Before I surrender and use only Valentina calls, are there some working
> examples of the other two strategies lying about?
> 
> And how do you get "SHOW TABLES" to work in a select statement?
> 
> Thanks,
> 
> Walt Sumner

-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]





More information about the use-livecode mailing list