Using a database cursor

Trevor DeVore trevor at mangomultimedia.com
Thu Sep 5 10:10:01 EDT 2002


I read your first email too quickly and didn't notice you wanted to use column numbers rather than column names.  So if you wanted to map the results from a database query to an array in Rev then you could do something like this:

put 1 into iteration
repeat while revdb_iseof(dbCursor) is false
    put revdb_columnbynumber(dbResult, 1) into dbArray[iteration, "Name"]
    put revdb_columnbynumber(dbResult, 2) into dbArray[iteration, "Login"]
    
    get revdb_movenext(dbResult)
    add 1 to iteration
end repeat

If you go to Help -> Revolution Documentation -> Transcript Language Dictionary and select "Database" from the Show dropdown menu it shows all the database related functions which is really helpful.

Trevor DeVore
Blue Mango Multimedia
trevor at mangomultimedia.com


>This seems to be fine, but I can only get it to return things like how
>many records. How do I get eg the first field of the first record in
>the cursor? I tried
>
>put item 1 of line 1 of it into field "MyMessage"
>
>But it didn't like that. Also, how do I rename the cursor? I tried
>
>rsLogin = get revdb_query(field "dbID",strSql)



More information about the Use-livecode mailing list