[V4RB] DELETE and Index Corruption

Ruslan Zasukhin sunshine at public.kherson.ua
Tue May 20 10:10:25 CDT 2003


on 5/20/03 1:27 AM, Dave Addey at support at dj1800.com wrote:

> Hi Gunnar,
> 
> No, each delete is with a separate cursor, which is a local cursor to a
> delete function I created on a subclass of Vdatabase.  I call the delete
> method separately for each row of the listbox that I want to delete.
> 
> 
> Likewise with the SQLExecute approach, I have a method as part of the
> Vdatabase subclass:
> 
> Sub RemoveSong(UniqueID as integer)
> 
> Dim err as integer
> 
> err = LibraryDB.SQLExecute("delete from ImportedSongs where UniqueID =
> "+Str(UniqueID))
> 
> end Sub 
> 
> 
> Is this bad practice, to add methods to a subclass of Vdatabase?

NO. This is good OO way.

> LibraryDB is the name of my instance of the subclass.  Now I look at it, it
> should probably be me.SQLexecute rather than LibraryDB.SQLExecute, but
> strictly speaking it should still work as above.

Yes, if it delete some records, then it works. Problem not here.

---
Dave, so you on start have some cursor with e.g. N records.
You read records from this cursor to listbox, yes?
    
In fact the best way is next:

1) you still keep this cursor.

2) assume user have choose 3,7,14 rows to be deleted.
Now you simply do

    cursor.Goto( 14 )
    cursor.Delete 

    cursor.Goto( 7 )
    cursor.Delete 

    cursor.Goto( 3 )
    cursor.Delete 

Of course this is written one time as procedure.

It needs delete from end, to still have correct index for forward records.
I think this is the fastest way.

3) it seems you COPY to listbox all N records.
    consider using of class from viSQL.

4) even if you will try this way, and it start work for you, I very ask make
for me project that reproduce original problem.


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