[vxcmd] Cursor_AddRecords mangles field content

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Jun 14 13:29:56 CDT 2004


On 6/14/04 12:52 PM, "Robert Brenstein" <rjb at rz.uni-potsdam.de> wrote:

> I know you are focused on 2 and hate to deal with bugs in 1 but here
> is one for you.
> 
> I have a function that relies on Cursor_AddRecords to duplicate a set
> of records in a table 'boName'. This function is used to duplicate
> all records associated with a given item when users duplicate an
> existing database entry -- the program loops through all associated
> bo's duplicating appropriate records.
> 
> I have been using it for a few years. However, it has always
> sporadically produced bogus results -- content of fields was messed
> up. This was hard to nail down because each bo has different
> structure and number of fields, some required and some optional.
> 
> I kept repairing this by hand but I think I have finally realized why
> the data is mangled: some of the field values fetched by
> Database_SQLSelectRecords are empty (which is valid). However, those
> empty values make Cursor_AddRecords to shift the content between
> fields. At first glance, it seems to simply skip the empty input and
> pick the next value in the list. The last value is filled with
> something random, usually left empty.
> 
> Here is my function (sans error checking to make reading easier) in
> case you want to see the usage. You could add this to your testing
> suite as well, Ruslan.  This is very efficient way to clone entries.
> 
> on doDupBo boName, refFld,idOld,idNew,refCol
>  --  duplicate a set of records from a single baseobject while
> changing their course ref
>  set the itemDelimiter to tab
>  put "SELECT * FROM" && boName && "WHERE" && refFld && " = " & idOld
> into query
>  put Valentina("Database_SQLSelectRecords",dbName, query) into boKurs
>  if boKurs is empty then return empty -- nothing to do
>  put "SELECT * FROM" && boName && " WHERE recid = 0" into query
>  put Valentina("DataBase_SQLSelect",DbName,query) into crs
>  repeat with i=1 to the number of lines of boKurs
>    put idNew into item refCol of line i of boKurs
>  end repeat
>  put Valentina("Cursor_AddRecords",crs,boKurs) into ur
>  get Valentina("Cursor_Remove",crs)
> end doDupBo
> 
> It seems to be a bug in xcmd interface.

Hi Robert,

Thn you should be able get the same mistake using just

    one db
    one table
Do 
   
    Cursor_AddRecords()

And send here data to fill 3 records.
E.g. Second record contain some empty values.

Please show me such string with values.
It skip empty value and get next column or next row value?


-- 
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 mailing list