[V4RB] API Equivalent of UPDATE WHERE
Ruslan Zasukhin
sunshine at public.kherson.ua
Mon Jan 3 22:15:21 CST 2005
On 1/3/05 9:53 PM, "Frank Schima" <frank-list3 at mindstarprods.com> wrote:
Hi Frank,
> With all this talk about the API way being faster than SQL, I was
> wondering what is the equivalent code for UPDATE... WHERE... with the
> new V4RB API?
>
> UpdateRecord will update a single record, and UpdateAllRecords will
> update all the records of a table/cursor. So how can I update a subset
> of records without looping through them all and using UpdateRecord?
>
> Basically I'm looking for an API workaround for that UPDATE SQL
> statement that is crashing for me. Namely:
>
> UPDATE MyTable Set MyVarcharField = 'some text' WHERE MyVarcharField
> is Null
>
> Pseudo-code please? :^)
* But what is bad in looping ?
if this is local db then no problems in fact,
RB is fast on this.
* API way will require more coding. This is a RULE.
so the pure API way can be:
set = fldVarChar.FindNulls()
Iter = set.MakeNewIterator
recid = Iter.first
do
tbl.RecID = recid
fldVarChar.value = "some text"
tbl.UpdateRecord()
while recid = iter.next
* Also your task CAN be made with UpdateAllRecords() as I see.
curs = db.SqlSelect(
"SELECT MyVarcharField WHERE MyVarcharField IS NULL" )
curs.VarCharField(x).valule = "someText"
curs.UpdateAllRecords()
* keep in mind that API way cannot do JOINS, GROUP BY and so on.
this is RELATIONAL Model features, mirrored in the SQL.
--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com
To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------
More information about the Valentina-beta
mailing list