[V4Rev]Valentina equivalent of revDataFromQuery

Kay C Lan lan.kc.macmail at gmail.com
Tue Jun 15 20:59:59 EDT 2010


Diving into Rev + Valentina, again.

This time around, as highly recommended by Ruslan (William Humphrey and
others) I've tried to steer clear of Rev's own DB calls and stick
exclusively with Val API calls. At his point all I'm trying to replicate is
revDataFromQuery; ie extract actual data, not a cursor. I did a search of
the Val Wiki and couldn't find anything that seemed right, so searching the
Val and Rev Lists I discovered and email from Chris Sheffield 26Feb08
(thanks) basically pointing out that in earlier versions of Val there were:

Cursor_GetRecord and Cursor_GetRecords

but these had disappeared. Ruslan mentions adding them back, but as I say, I
can't find any reference searching the Val Wiki.

In desperation I thought I'd just lower my standard and use a Non-API call
just for this task. Then I discovered I can't do any revDB calls.

In a brand new stack I do a simple (based on Rev Dictionary Syntax):

revOpenDatabase("Valentina","",myDbPath,"","","",myMacSN,"")

and I get an error indicating that it's an invalid DB type? By searching the
list I see Trevor is using "Valentina2", same error. In the Test.rev stack
that comes with Val I see it's using "Valentina4" but still the same error.
I also notice that the majority of the tests in the Test stack aren't even
run, but that's beside the point.

So, thanks again to Chris, I did some snooping of externalFunctions of the
"home" stack, I see there are API calls for VCursor_GetRecord,
VCursor_GetRecords and VDatabase_SqlSelectRecords. Unfortunately doing a
search of the Val website for 'sqlselectrecords' has 1 hit for
VConnection_SqlSelectRecords under the NEW for V4REV but gives no detail or
syntax. Again, no hits for 'getrecord'.

Looking inside the Test.rev stack I see this:

put VDatabase_SqlSelectRecords( mDatabase, "SELECT a1 FROM T1 WHERE a1 = 1
or a1 = 2", "kServerSide", "kReadWrite",, 1,3, " ", " ", "<td>", "</td>" ,
"<tr>", "</tr>") into res

put VCursor_GetRecords( mcurs,1,4344," ", " " ) into res

So does this do what I'm looking for, and if so, what are the parameters
required and what is returned?

If this is not what I'm looking for I'm assuming someone out there has
already invented the wheel (generic function) that takes any Cursor returned
from VDatabase_SqlSelect, and does a nested repeat through each field of
each record and returns the content either into a multi-line list or an
array? Care to share… please :-)

Help appreciated.

Val 4.6, Rev Studio 4.0 Bld 950, OS X 10.6.3, MBPro



More information about the use-livecode mailing list