Adding/merging cursors
Erik Mueller-Harder
valentina-list at vermontsoftworks.com
Thu Nov 18 15:43:13 CST 2004
> I haven't looked at VSets yet -- there is very little documentation on
> these
Yes. I know everything is in development, but I'm beginning to find
the lack of documentation a bit of a trial.
> so I really don't know what they are for and how best to use them. If
> there is a way of getting cursors -> VSets -> cursors, or something
> else that VSets can do, that might be an answer...
I don't think there's any way to convert between VSets and VCursors.
Cursors are obviously the SQL route; sets involve the API approach.
Check out the Field_Find example for, well, an example. The results of
multiple inquiries against a table can be combined and (apparently)
sorted. The final resulting set can be looped through by means of a
VSetIterator.
I've been dabbling with them and have been quite impressed; they'd be
of limited functionality to me, though, without a method for arriving
at a particular row (see my "Random access in a VSet?" message from
earlier today). I imagine the lack of such a method is probably due to
v2's early stage of development.
In early October, Olivier asked about the advantages of the API method
over standard SQL. I'm including Ruslan's answer below.
-- Erik
> Good question!
> Yes SQL is standard.
> YES SQL is perfect for REMOTE database access and control.
>
> But in the world exists other tasks also,
> And SQL sometimes is not the best way.
>
> --------------------------
> I think in the first turn THE LOCAL db is an issue.
>
> * SQL is slower because you need spend time to build strings,
> then must exists parser which parse strings,
> which build trees of nodes, which at last of end do call
> the same API function.
>
> * SQL parser and engine usually need to have powerful analysator and
> optimizer which also eat space and time
>
> * Or look on this. You have table, you have some WHEHRE condition which
> select from million records e.g. 10,000 records.
> You sort it by f1.
>
> Now user ask to sort by f2. What you do in SQL way ?
> You must again execute the full SQL query, i.e. You again need
> PARSER, optimize, do SEARCH WHERE and only now do new ORDER BY
> Ah, also cursor need unlock records,
> and later again lock records, actually THE SAME records!
>
> What we have with sets?
> You have execute search and get set.
> Now you can THIS SET sort many times in different ways.
> I.e. When user say SORT BY f2, you do only the final step
>
> sort( s2, f2 )
>
> Cool? I think very cool!
More information about the Valentina-beta
mailing list