Problem with Indexes

Joakim Schramm joakim at astrocalc.com
Sun Dec 10 23:45:36 CST 2006


Hi Claudius,

I don't use RB but I use Valentina and also have a Backup, restore
functionality. For this I use .Dump and LoadDump to XML file. This is a much
easier and simpler way, and indeed what the dump is for, you get exact copy
back of what you dumped, no need to keep track of old RecID or indexes. I
think you make it unnecessary complicated with your way. If you like you can
have my 2 routines for this to test, it's for VB6 but it should be easy to
make work in RB. It's very little code needed.

Just a small warning, this is new code for new version of my app which
haven't been relesed yet, so I have only done small in house test but it
seem to work fine.

Regards,
Joakim 

> -----Original Message-----
> From: valentina-bounces at lists.macserve.net 
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of 
> Claudius Sailer
> Sent: 10 December 2006 22:52
> To: Valentina Developers
> Subject: Problem with Indexes
> 
> Hello,
> 
> I have an Backup-Restore-Functionality in my application. I 
> write all records of each table to a Textfile separated with 
> TAB. This works and worked fine now for years.
> 
> With Valentina 2.5 I have now this curiosity. When I reload 
> the database from a file I do following:
> - DeleteAllRecords from every table in the sorting that no 
> referencation is broken or destroid
> - Reading Textfile
> - Writing every record back to the database
>   In the last process all new RecIDs are stored in an array 
> with the old RecID which was saved in the Textfile. So I can 
> reproduce which record is referenced to which other. After 
> that I ran an Diagnose database and got the information that 
> database has problems in one index. Now I added to my 
> Importfunctionality as last step "REINDEX DATABASE" and 
> everything is fine.
> I would expect that INDEXES are corrected and build after 
> DeleteAllRecords and after loading records and stored into 
> database, but I get always the problem. Does someone have 
> same problem?
> 
> this is an example how I write to the database and in the 
> last row you can see how I write old-new-RecID
> 
>      //Kategorien auslesen
>      if TextZeichen.countfields(chrb(9))=12 or 
> TextZeichen.countfields (chrb(9))=10 then
>        meineDatenbank.TKategorien.SetBlank
>        meineDatenbank.TKategorien.Kategorie_Name.Value=ASCIIToUniCode
> (TextZeichen.nthfield(chrb(9),2))
>         
> meineDatenbank.TKategorien.Kategorie_Art.Value=TextZeichen.nthfield
> (chrb(9),3).cdbl
>        meineDatenbank.TKategorien.KategorieGruppen_ID.Value=RecIDIndex
> (2,TextZeichen.nthfield(chrb(9),4).cdbl)
>        meineDatenbank.TKategorien.SteuerFeld.Value=RecIDIndex
> (11,TextZeichen.nthfield(chrb(9),5).cdbl)
>        if NOT CheckLeer(TextZeichen.nthfield(chrb(9),6)) then
>          meineDatenbank.TKategorien.LfdNr.Value=TextZeichen.nthfield
> (chrb(9),6).cdbl
>        end if
>        meineDatenbank.TKategorien.MWSt.Value=RecIDIndex
> (14,TextZeichen.nthfield(chrb(9),7).cdbl)
>         
> meineDatenbank.TKategorien.Sortierung.Value=TextZeichen.nthfield(chrb
> (9),8).cdbl
>        if NOT CheckLeer(TextZeichen.nthfield(chrb(9),9)) then
>          meineDatenbank.TKategorien.Budget.Value=RoundTextNumber
> (TextZeichen.nthfield(chrb(9),9))
>        end if
>        if NOT CheckLeer(TextZeichen.nthfield(chrb(9),10)) then
>           
> meineDatenbank.TKategorien.BudgetLaufzeit.Value=TextZeichen.nthfield
> (chrb(9),10).cdbl
>        end if
>        if TextZeichen.countfields(chrb(9))=10 then //kann 
> auch BackUps aus der Version 3.2.3 verarbeiten
>          meineDatenbank.TKategorien.Beeinflussbarkeit.Value=3
>          meineDatenbank.TKategorien.Analysieren.value=true
>        else
>           
> meineDatenbank.TKategorien.Beeinflussbarkeit.Value=TextZeichen
> .nthfield(
> chrb(9),11).cdbl
>          if TextZeichen.nthfield(chrb(9),12).cdbl = 1 then
>            meineDatenbank.TKategorien.Analysieren.value=true
>          else
>            meineDatenbank.TKategorien.Analysieren.value=false
>          end if
>        end if
>        NewRecID=meineDatenbank.TKategorien.addRecord
>        RecIDIndex(4,TextZeichen.nthfield(chrb(9),1).cdbl)
> =meineDatenbank.TKategorien.RecordCount
> 
> 
> 
> bye
> 
> 
> Claudius
> 
> --
> iMac CD 2GHz / MacOS X 10.4de / RB 2006r4/ Valentina 2.5
> Homepage    http://www.ClaSai.de
> iChat        ryhoruk
> RealBasic ListBoxes: [ I feel the need...the need for speed!!! ]
> 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list