cmxAutoOpen[solved]

Re: cmxAutoOpen

Postby StefanHaupt » 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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Re: cmxAutoOpen

Postby James Bott » Thu Jan 27, 2011 1: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: cmxAutoOpen

Postby Salvo1087 » 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: Select all  Expand view  RUN
 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
Salvo1087
 
Posts: 34
Joined: Fri Jan 07, 2011 5:39 pm

Re: cmxAutoOpen

Postby James Bott » Fri Jan 28, 2011 2: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: cmxAutoOpen

Postby Salvo1087 » Fri Feb 04, 2011 3:14 pm

thanks both, i have solved problem :) !!
Salvo1087
 
Posts: 34
Joined: Fri Jan 07, 2011 5:39 pm

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 33 guests