another beginning SQL/Rev question
Charles Hartman
charles.hartman at conncoll.edu
Sun Oct 9 22:38:15 EDT 2005
Exactly right:
put "show columns from person" into tQuery
get revDataFromQuery(comma,return,myDBid,tQuery)
Now 'it' contains a list of lines, one per db column, of comma-
delimited items.
Don't know how I'm going to use it yet -- but thanks very much for
helping me get it.
Charles Hartman
On Oct 9, 2005, at 4:20 PM, Dave Cragg wrote:
>
> On 9 Oct 2005, at 19:26, Charles Hartman wrote:
>
>
>> Something I don't understand about the revExecuteSQL command. I
>> open my MySQL database and get an id. Now, to make later steps
>> more general purposes, I'd like to ask the database for the
>> structure of one of its tables (number of columns, column names)
>> rather than hardwiring that into the Rev front-end. So I should be
>> able to create a
>> global myArray
>> and then with my dbID in hand,
>> revExecuteSQL dbID, "show columns in myTable", "myArray"
>> (taking care to put quotes around myArray as the docs say).
>>
>> Trouble is, nothing shows up in myArray, or anywhere else as far
>> as I can see. Using a variable (or several) instead of myArray
>> doesn't help, neither does putting some dummy stuff ("") into
>> myArray[1], myArray[2], etc., ahead of time.
>>
>
> The variable or array is used to substitute values in the SQL
> statement, not to receive data from the query.
>
> Try using revdb_querylist (or revDataFromQuery) to execute SQL that
> returns data.
>
> For example
>
> put "show columns in myTable" into tQuery
> put revdb_querylist(,, dbID,tQuery) into tData
> put tData into field "whatever'
>
> The docs aren't too clear on this. They seem to say use
> revdb_execute (or revExecuteSQL) for everything except SELECT
> statements. But I think we have to infer that any SQL that returns
> data should be treated in the same way as SELECT. (as opposed to
> INSERT, UPDATE, etc. where we should use revdb_execute)
>
>
> Cheers
> Dave
> _______________________________________________
> 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