FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour cmxAutoOpen[solved]
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM

Re: cmxAutoOpen

Posted: Thu Jan 27, 2011 12:55 PM

Salvo,

yes, please look the post from James.

But I don´t understand, why you pack a dbf without it´s indexes, you´ll always get inconsistent index files. I would pack a dbf only with open indexes.

kind regards

Stefan
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: cmxAutoOpen

Posted: Thu Jan 27, 2011 01:06 PM

Salvo,

An even better solution is to reuse deleted records instead of packing.

With my TData class there is an optional subclass to reuse deleted records automatically. This way you never have to PACK a DBF. You can find more information about TData on this page:

http://www.gointellitech.com/program.htm

Regards,
James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 34
Joined: Fri Jan 07, 2011 05:39 PM

Re: cmxAutoOpen

Posted: Fri Jan 28, 2011 10:43 AM
james ,

thanks a lot for advice,but pack is? .Second question : i have use set autopen on before seek
Code (fw): Select all Collapse
  set autopen on
    select parti
    set filter to upper(cod_contro+qualita)=upper(cCodFascicolo+STR_PARTI)
        seek upper(m->cCodFascicolo+STR_PARTI)

        select cparti
    set filter to upper(cod_contro+qualita)=upper(cCodFascicolo+STR_CPARTI)
        seek upper(m->cCodFascicolo+STR_CPARTI)

        select altri
    set filter to upper(cod_contro+qualita)=upper(cCodFascicolo+STR_ALTRI)
        seek upper(m->cCodFascicolo+STR_ALTRI)

        select nota_spe
    set order to tag codice
    set filter to upper(field->cod_pratic)=m->cCodPratica //nooptimize
        seek upper(m->cCodPratica)


is right?and when you say "open file" you mean file .cdx? thanks a lot for patience. regard

Salvo
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM

Re: cmxAutoOpen

Posted: Fri Jan 28, 2011 02:18 PM
Salvo,

thanks a lot for advice,but pack is?


I was refering to the PACK command which removes all deleted records from a file. As Stefan pointed out, you don't really need to open the file (DBF) without the indexes when you PACK. If you leave the indexes open when PACKing, then the indexes are updated also. If you don't leave the indexes open, then you have to reopen the file and rebuild the indexes after PACKing. I presume that is what you are doing now.

Second question : i have use set autopen on before seek, is right?


No, in your case you only need to set autopen on after packing. Autopen must be on when you open the files (DBFs). Then if you have more than one index, you must select the desired index before seeking.

when you say "open file" you mean file .cdx?


No, I mean open the database (DBF). I think you are getting confused by auto open. I never turn it on or off in my apps. It is on by default and so whenever a DBF is opened the indexes are opened also automatically. Of course, the indexes need to be opened for any SEEKs. You don't need to be opening and closing the indexes, except possibly as your app is doing when PACKing.

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 34
Joined: Fri Jan 07, 2011 05:39 PM

Re: cmxAutoOpen

Posted: Fri Feb 04, 2011 03:14 PM

thanks both, i have solved problem :) !!

Continue the discussion