DbUseArea() Internal error 1010 after index with error

DbUseArea() Internal error 1010 after index with error

Postby dutch » Thu Jul 27, 2006 2:36 pm

Dear All,

I've found this error following message while build index files.

TEST.EXE caused a General Protection Fault in
module TEST.EXE at 0022:4221.

Choose close TEST.EXE will close.

After I close this error message box. The index file of last file is 0 byte and when I browse this database file the another error is below

DbUseArea() Internal error 1010

I try to find out and got some post that inform to increase stack size and set clipper //E:0 for disable EMS but it doesn't work. The error is still. How can I fix it?

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Detlef Hoefner » Thu Jul 27, 2006 2:49 pm

Hi Dutch,

could you please show us the piece of prg for your index creation?

Regards,
Detlef
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

Index corrupt after add TSbrowse

Postby dutch » Thu Jul 27, 2006 3:36 pm

Dear Detlef,

This is my index file procedure. I found this error has occur after I add TSbrowse.lib in my program. When I do not include Tsbrowse.ch and do not call TSbrowse the index run fine. I don't know why does it append?

Regards,
Dutch

*--------------*
Procedure IndexCheck(IndexAll)
OPENFILE('CCRIND','DX')
DX->(DbGotop())
do while !DX->(eof())
if ((!file(rtrim(DX->IND_DBF)+'.CDX').or.IndexAll) .and. !empty(DX->IND_NTX) .and. file(MEMVAR->cFoPath+rtrim(DX->IND_DBF)+'.DBF'))
cDbf := upper(rtrim(DX->IND_DBF))
OPENFILE(cDBF,,,.F.)
do while upper(rtrim(DX->IND_DBF)) == cDBF
cNtx := rtrim(DX->IND_NTX)
cExp := rtrim(DX->IND_EXP)
lAsend := iif(DX->IND_SORT='D',.F.,.T.)

if IndexAll .and. dow(date()) = 1
pack
end

MsgMeter( { | oMeter, oText, oDlg, lEnd | ;
BuildIndex( oMeter, oText, oDlg, @lEnd, cNtx, cExp, lAsend ) },;
"Indexing TAG "+cNtx,'Building index file, Please wait..' )

DX->(dbskip())
if !(upper(rtrim(DX->IND_DBF)) == cDBF)
DX->(dbskip(-1))
exit
end
end
CLOSEFILE(cDbf)
SELECT('DX')
end
DX->(dbskip())
end
CLOSEFILE('DX')
select(old_sel)
return

*----------------------------------------------*
Static Function BuildIndex( oMeter, oText, oDlg, lEnd, cNtx, cExp, lAsend )
oMeter:nTotal := Int(LastRec()/10)
if lAsend
INDEX ON &cExp TAG &cNtx ;
EVAL ( oMeter:Set( int(RecNo()/10) ), SysRefresh(), !lEnd ) ;
EVERY Int(Lastrec()/10)
else
INDEX ON &cExp TAG &cNtx ;
EVAL ( oMeter:Set( int(RecNo()/10) ), SysRefresh(), !lEnd ) ;
EVERY Int(Lastrec()/10) ;
DESCENDING
end
return nil
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Gale FORd » Thu Jul 27, 2006 3:44 pm

You do not want to index using trim(). The index has to remain a fixed length.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

no trim in index expression

Postby dutch » Thu Jul 27, 2006 3:58 pm

Dear Gale,

The index expression has no trim() function.

Thanks,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Strange behavier of index bar

Postby dutch » Thu Jul 27, 2006 6:47 pm

Dear All,

I try to create index without MsgMeter() and the error is not occur and still link TSbrowse. I think the problem is TSbrowse+MsgMeter().

- TSbrowse + MsgMeter() is problem
- MsgMeter() is no problem
- TSbrowse is no problem

Does anyone face the problem?

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Postby Detlef Hoefner » Thu Jul 27, 2006 10:08 pm

Hi Dutch,

i doubt that either TsBrowse or MsgMeter is the cause of your protection fault.

I made some modifications to your code.
Because i didn't have the necessary dbf files and the rest of your code i couldn't try my suggest.
The most important IMO is to avoid calling lastrec() in the index command and the call of Sysrefresh() in the ordCondSet() call.

Perhaps this might help you?

Best regards,
Detlef

Code: Select all  Expand view
// ----------------------------
PROCEDURE IndexCheck( IndexAll )
// ----------------------------
   
   OPENFILE( 'CCRIND','DX' )
   
   DX->( DbGotop() )
   
   do while !DX->( eof() )
      if ( ( !file( rtrim( DX->IND_DBF ) + '.CDX' ) .or. IndexAll ) .and.;
             !empty( DX->IND_NTX ) .and. file( MEMVAR->cFoPath + rtrim( DX->IND_DBF ) + '.DBF' ) )

         cDbf := upper( rtrim( DX->IND_DBF ) )
         dbUseArea( .t., "comix", cDbf, "wrk", .f., .f.)

         if neterr()
            alert( "File " + cDbf + " could not be opened in exclusive mode.", {} )

            RETURN
         endif
                 
         do while upper( rtrim( DX->IND_DBF ) ) == cDBF
            cNtx   := rtrim( DX->IND_NTX )
            cExp   := rtrim( DX->IND_EXP )

            lAsend := if( DX->IND_SORT = 'D', .F., .T. )

            if IndexAll .and. dow( date() ) = 1
               wrk->( __dbPack() )
            endif

            MsgMeter( { | oMeter, oText, oDlg, lEnd | BuildIndex( oMeter, oText, oDlg, @lEnd, cNtx, cExp, lAsend ) },;
                          "Indexing TAG " + cNtx, 'Building index file, Please wait..' )

            DX->( dbskip() )
           
            if !( upper( rtrim( DX->IND_DBF ) ) == cDBF )
               DX->( dbskip( -1 ) )
               
               EXIT
            end
         end
         
         wrk->( dbCloseArea() )
         
         dbSelectArea( 'DX' )
      end
     
      DX->( dbskip() )
   end
   
   CLOSEFILE( 'DX' )
   select( old_sel )
return

// -------------------------------------------------------------------------
STATIC PROCEDURE BuildIndex( oMeter, oText, oDlg, lEnd, cNtx, cExp, lAsend )
// -------------------------------------------------------------------------
LOCAL nEvery := int( wrk->( lastrec() ) / 10 )


   oMeter:nTotal :=  wrk->( lastrec() )
   
   ordCondSet( nil, nil, nil, !lEnd, { || oMeter:Set( int( wrk->( recno() / 10 ) ) ), SysRefresh() }, nEvery, nil, nil, nil, nil, !lAsend, nil, .f., .f., .f., .f. )
   ordCreate( NIL,  cNtx, cExp, &( "{||" + cExp + "}" ), .f. )

RETURN
User avatar
Detlef Hoefner
 
Posts: 312
Joined: Sat Oct 08, 2005 9:12 am
Location: Germany

I will try

Postby dutch » Fri Jul 28, 2006 2:30 am

Dear Detlef,

Thank you for your suggestion and I will try.

Regards,
Dutch
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 5 guests