Board index » delphi » Corrupt indexes in Paradox -- fixing up them

Corrupt indexes in Paradox -- fixing up them

Sometime some network problems on my clients' installation site gets me
with corrupt indexes on my app. So I decided to build a "regen all
indexes" app. By studying BDE dbi... procedures I figured out how to
drop all indexes (that's how far I went, rebuilding them will be my next
step), but I'm getting an AV message from idbat32.dll. I must be doing
something foolish, so I decided to post it for your apreciation, dear
fellows.

The core code was initially sent to me by Roman, and I made some
adaptations.

  DB := TDatabase.Create( NIL );
  try
    DB.SessionName := Session.SessionName;
    Db.Closedatasets; // tdatabase component pointing to the folder with
tables
    Db.databasename := '__FOO__'; // This prevents the "invalid database
handle" error

    Tbl := ttable.Create(NIL);
    try
      Tbl.databasename := Path; // set databasename
      Tbl.tablename := Tabela;
      Tbl.Exclusive := True;
      Tbl.open;
      Check(dbiGetCursorprops(Tbl.handle,Props));
      Tbl.close;

      for i := 1 to Props.iIndexes do
        arrayCROpType[i-1] := crDROP;

      FillChar(TblDesc, SizeOf(CRTblDesc), 0);
      StrPCopy(TblDesc.szTblName, tbl.tablename);
      TblDesc.bProtected := True;
      StrPCopy(Tbldesc.szPassword,Calc123( edCodigo.Text ));
      TblDesc.szTblType := szPARADOX;
      TblDesc.iIdxCount := Props.iIndexes;
      TblDesc.pecrIdxOp := @arrayCROpType;

      with Session.FindDatabase(Tbl.databasename) do hDb := handle;
      Check(DbiDoRestructure(hDB, 1, @TblDesc, nil, nil, nil, False));
    finally
      Tbl.Free;
    end;
  finally
    Db.Free;
  end;

  fmbraga.vcf
< 1K Download
 

Re:Corrupt indexes in Paradox -- fixing up them


try this!

 Check(DbiRegenIndexes(Tbl.Handle));

Jeff Crump

Quote
Fernando Braga wrote:

> Sometime some network problems on my clients' installation site gets me
> with corrupt indexes on my app. So I decided to build a "regen all
> indexes" app. By studying BDE dbi... procedures I figured out how to
> drop all indexes (that's how far I went, rebuilding them will be my next
> step), but I'm getting an AV message from idbat32.dll. I must be doing
> something foolish, so I decided to post it for your apreciation, dear
> fellows.

> The core code was initially sent to me by Roman, and I made some
> adaptations.

>   DB := TDatabase.Create( NIL );
>   try
>     DB.SessionName := Session.SessionName;
>     Db.Closedatasets; // tdatabase component pointing to the folder with
> tables
>     Db.databasename := '__FOO__'; // This prevents the "invalid database
> handle" error

>     Tbl := ttable.Create(NIL);
>     try
>       Tbl.databasename := Path; // set databasename
>       Tbl.tablename := Tabela;
>       Tbl.Exclusive := True;
>       Tbl.open;
>       Check(dbiGetCursorprops(Tbl.handle,Props));
>       Tbl.close;

>       for i := 1 to Props.iIndexes do
>         arrayCROpType[i-1] := crDROP;

>       FillChar(TblDesc, SizeOf(CRTblDesc), 0);
>       StrPCopy(TblDesc.szTblName, tbl.tablename);
>       TblDesc.bProtected := True;
>       StrPCopy(Tbldesc.szPassword,Calc123( edCodigo.Text ));
>       TblDesc.szTblType := szPARADOX;
>       TblDesc.iIdxCount := Props.iIndexes;
>       TblDesc.pecrIdxOp := @arrayCROpType;

>       with Session.FindDatabase(Tbl.databasename) do hDb := handle;
>       Check(DbiDoRestructure(hDB, 1, @TblDesc, nil, nil, nil, False));
>     finally
>       Tbl.Free;
>     end;
>   finally
>     Db.Free;
>   end;

>   ------------------------------------------------------------------------

>   Fernando Braga <fmbr...@sincro.com.br>
>   InfNet Ltda

>   Fernando Braga
>   InfNet Ltda                   <fmbr...@sincro.com.br>
>                                 HTML Mail
>   R. Des. Barreto Cardoso, 444  Fax: +55 82 338-2355
>   Macei                        Work: +55 82 338-2355
>   AL
>   57052-320
>   Brazil
>   Additional Information:
>   Last Name    Braga
>   First Name   Fernando
>   Version      2.1

Re:Corrupt indexes in Paradox -- fixing up them


You might want to consider verifying and rebuilding the tables with the
Paradox table repair utility DLL, tutil32.dll.  There is a sample program at
www.inprise.com/devsupport/bde/utilities.html.  You can download the
tutil32.dll for your BDE version at the same location.

Out and About Productions markets a set of components that make using the
table repair DLL much easier.  See their Web site at www.o2a.com.

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:Corrupt indexes in Paradox -- fixing up them


I don't know if I'm one the only one whom Tutil32.dll doesn't work (so I guess).
Every time I have some kind of corruption of my table, I couldn't fix it up with
TUtil32. That's why I decided to delete all index files (.PX, .XG?, .YG?) and
rebuild them.

Quote
"Bill Todd (TeamB)" wrote:
> You might want to consider verifying and rebuilding the tables with the
> Paradox table repair utility DLL, tutil32.dll.  There is a sample program at
> www.inprise.com/devsupport/bde/utilities.html.  You can download the
> tutil32.dll for your BDE version at the same location.

> Out and About Productions markets a set of components that make using the
> table repair DLL much easier.  See their Web site at www.o2a.com.

> --
> Bill Todd
> (Sorry but TeamB cannot answer questions received via email)
> (Remove nospam from my email address to contact me for any other reason)

  fmbraga.vcf
< 1K Download

Re:Corrupt indexes in Paradox -- fixing up them


I have used Tutil32.dll many times with very good results.  I am not sure
why you are having problems.  Make sure that you have the version of
Tutil32.dll that matches the BDE version you are using.

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:Corrupt indexes in Paradox -- fixing up them


Quote
Fernando Braga wrote:

> I don't know if I'm one the only one whom Tutil32.dll doesn't work (so I guess).
> Every time I have some kind of corruption of my table, I couldn't fix it up with
> TUtil32. That's why I decided to delete all index files (.PX, .XG?, .YG?) and
> rebuild them.

one of the best method but you must have your own datadictionary

Quote
> "Bill Todd (TeamB)" wrote:

> > You might want to consider verifying and rebuilding the tables with the
> > Paradox table repair utility DLL, tutil32.dll.  There is a sample program at
> > www.inprise.com/devsupport/bde/utilities.html.  You can download the
> > tutil32.dll for your BDE version at the same location.

> > Out and About Productions markets a set of components that make using the
> > table repair DLL much easier.  See their Web site at www.o2a.com.

I use the TUtility to verifying and rebuilding corrupt index and tables.
Easy and good.
But, I have only one problem with this tool - corrupt index by
index-field "autoinc".

Re:Corrupt indexes in Paradox -- fixing up them


In article <362E2824....@t-online.de>, Wintzheimer <wintzheimer@t-
online.de> writes

Quote
>Fernando Braga wrote:
>But, I have only one problem with this tool - corrupt index by
>index-field "autoinc".

I am not happy about using an autoinc field on a primary index - it is
in the system I have inherited, but I plan to move it very soon.  I
currently have to delete the index files, and re-create them, using
Database Desktop is the simplest way.  TUtil doesnt fix the problem.

And someone mention 'make sure you have the correct version' of
TUtilities.  How do I check that?

--
Pete Clark

Give me the strength to change the things I can, the grace to accept the
things I cannot, and a shitload of money.

Re:Corrupt indexes in Paradox -- fixing up them


Pete,

The problem you describe is indeed not handled by TUTIL32 directly.
Logic Process has included a workaround (in the form of a
multiple-pass rebuild sequence) in its SelfCheck Data Maintenance API.
The multi-pass rebuild effectively does what you have described
programatically. In addition, it preserves the autoinc "next" value.
It is aimed at tables with single-field autoinc primary indexes.

The SelfCheck Data Maintenance API is a set of Object Pascal routines
which form a wrapper around the BDE and TUTIL calls needed for Paradox
table repair (and other handy table maintenance functions). It comes
with full source, and allows the Delphi developer to include table
maintenance features in his/her own 16-bit or 32-bit apps for
royalty-free distribution. It is also a great learning tool for using
the BDE and TUTIL APIs for table maintenance.

If you are interested, you can check out the SelfCheck API as part of
a Paradox table maintenance trial download. See the
DataSentry/SelfCheck API trial download on our web site
(http://www.logicprocess.com). DataSentry is a standalone Paradox
table maintenance utility for Win95/98/NT4 systems. Make sure and give
this a look as well. The SelfCheck API source is not included in the
trial version, however, a demo application and full help file are
included.

Hope this helps,

Jim McCullin
Logic Process Corporation
sa...@logicprocess.com
http://www.logicprocess.com

On Wed, 21 Oct 1998 20:50:13 +0100,

Quote
computergeniusdoesntwants...@bigfoot.com wrote:
>In article <362E2824....@t-online.de>, Wintzheimer <wintzheimer@t-
>online.de> writes
>>Fernando Braga wrote:
>>But, I have only one problem with this tool - corrupt index by
>>index-field "autoinc".

>I am not happy about using an autoinc field on a primary index - it is
>in the system I have inherited, but I plan to move it very soon.  I
>currently have to delete the index files, and re-create them, using
>Database Desktop is the simplest way.  TUtil doesnt fix the problem.

>And someone mention 'make sure you have the correct version' of
>TUtilities.  How do I check that?

>--
>Pete Clark

>Give me the strength to change the things I can, the grace to accept the
>things I cannot, and a shitload of money.

Other Threads