[V4RB] DELETE and Index Corruption
Dave Addey
support at dj1800.com
Mon May 19 23:27:54 CDT 2003
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? 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.
Dave.
On 19/5/03 11:13 pm, "Gunnar Swan" <GunnarSwan at practicetopass.com> wrote:
>
> Are you doing all deletes with the same cursor.
> Maybe create a new cursor or each record, delete the record, kill the cursor.
> Start with next record to delete.
>
>
> 5/19/03 3:13:09 PM, Dave Addey <support at dj1800.com> wrote:
>
>> I have a vaguely similar problem, and it's driving me mad!
>>
>> I have a database with 3,000 or so records. One column is a Long field
>> called UniqueID, which is indexed and unique.
>>
>> I load the contents of the database into a listbox. The user can then
>> select multiple rows of the listbox. When they press delete, I attempt to
>> delete all selected records by getting the UniqueID from a hidden column for
>> each row, one by one, and deleting the record with that UniqueID.
>>
>> I have tried doing this multiple delete using an SQL statement, and also
>> using a VCursor. I get the same problem in both cases. When doing multiple
>> deletes one after another (as separate SQL statements), after a while some
>> deletes fail, even though they claim to work successfully (returning no
>> error). Subsequently, my database can't find these entries with a "Select *
>> from [tablename] where UniqueID [a valid value]".
>>
>> Interestingly, in this situation both my application and ViSQL can see these
>> records, but neither can delete them. However, Valentina App can delete
>> these records.
>>
>> This would imply that the index has got corrupted. Certainly, rebuilding the
>> index seems to help matters, but the next multiple delete fails in the same
>> way.
>>
>> I have run a Diagnose on the database, and it comes up all okay.
>>
>> Believe me, I have checked my code very thoroughly. Flushing the database
>> makes no difference. I have tried every possible way to avoid this, but to
>> no avail.
>>
>> It's very annoying, as I can't think of a way round this!
>>
>> For the record, I am using 10.2.5, Valentina 4 RB 1.9.7, REALbasic 4.5.2.
>>
>> Please help!
>>
>> Thanks in advance,
>>
>> Dave.
>>
>> ------------------------------------
>> Dave Addey
>> dave at dj1800.com
>>
>> DJ-1800
>> Complete MP3 DJ solution for the Mac
>> http://www.dj1800.com/
>>
>> Support and pre-release forums:
>> http://dj1800.myforums.net/
>>
>> _______________________________________________
>> Valentina mailing list
>> Valentina at lists.macserve.net
>> http://lists.macserve.net/mailman/listinfo/valentina
>>
>
>
> Best Regards,
> Gunnar Swan
> http://www.PracticeToPass.Com
>
>
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>
------------------------------------
Dave Addey
dave at dj1800.com
DJ-1800
Complete MP3 DJ solution for the Mac
http://www.dj1800.com/
Support and pre-release forums:
http://dj1800.myforums.net/
More information about the Valentina
mailing list