We have an application here which needs to be working both linked to the Advantage database server that is on our servers and “unplugged” to be able to work on the road on a local subset of data that has been copied to local tables beforehand.

This application needs to be able to reindex these tables. Lately we have linked the application tables inside a data dictionary so I had to review the reindexation feature.

I currently have the following problem : I use the same code on the server tables and the local tables, but it doesn’t give me the same results. On the server, I’m able to do my reindexation, then after freeing and recreating my datamodule, I’m able to reopen the tables and everything is fine. On the local tables, when I try to reindex using the same code, I have advantage errors no 5016, 5132, 5068 or 5089 pop out and some of my indexes physically disappear… When I try the reindexation a second time, everything seems to come back to normal.

Here is the code used to reindex (Delphi 2010 with Advantage 11.1, traces added in order to try to pinpoint the problem) :

procedure _AdsReCreateIndex(const aTable : TAdsTable; const strFileName, strTagName, strExpression, strCondition, strWhile: string; setIndexOptions: TAdsIndexOptions); begin try Writeln(_F, Format('1 DELETE - Filename : %s - Tag : %s', [strFileName, strTagName])); aTable.AdsDeleteIndex(strTagName); Writeln(_F, Format('2 DELETE - Filename : %s - Tag : %s', [strFileName, strTagName])); except on E:EAdsDatabaseError do begin Writeln(_F, Format('DELETE ERROR - Filename : %s - Tag : %s - Error : %s', [strFileName, strTagName, E.Message])); if (E.ACEErrorCode = 5016) or (E.ACEErrorCode = 5132) then // Forget about these errors, seems to happen if there was an error in the creation // of an index and it is not found anymore... else begin raise; end; end; end; try Writeln(_F, Format('1 CREATE - Filename : %s - Tag : %s', [strFileName, strTagName])); aTable.AdsCreateIndex(strFileName, strTagName, strExpression, strCondition, strWhile, setIndexOptions); try aTable.Close; aTable.Open; except on E:EAdsDatabaseError do Writeln(_F, Format('CREATE OPEN ERROR - Filename : %s - Tag : %s - Error : %s', [strFileName, strTagName, E.Message])); end; Writeln(_F, Format('2 CREATE - Filename : %s - Tag : %s', [strFileName, strTagName])); except on E:EAdsDatabaseError do begin Writeln(_F, Format('CREATE ERROR - Filename : %s - Tag : %s - Error : %s', [strFileName, strTagName, E.Message])); end; end; end;

Here is an excerpt of my log file :
- When used on the network :
1 DELETE - Filename : Verif - Tag : Verif
2 DELETE - Filename : Verif - Tag : Verif
1 CREATE - Filename : Verif - Tag : Verif
2 CREATE - Filename : Verif - Tag : Verif
1 DELETE - Filename : Verif - Tag : VerifType
2 DELETE - Filename : Verif - Tag : VerifType
1 CREATE - Filename : Verif - Tag : VerifType
2 CREATE - Filename : Verif - Tag : VerifType

  • When used on the local tables :
    1 DELETE - Filename : Verif - Tag : Verif
    DELETE ERROR - Filename : Verif - Tag : Verif - Error : adstblVerif: Error 5132: The specified database object name is not valid. The specified index order is not defined for the table.
    1 CREATE - Filename : Verif - Tag : Verif CREATE ERROR - Filename : Verif - Tag : Verif - Error : adstblVerif: Error 5068: There is no current record.
    1 DELETE - Filename : Verif - Tag : VerifType
    DELETE ERROR - Filename : Verif - Tag : VerifType - Error : adstblVerif: Error 5132: The specified database object name is not valid. The specified index order is not defined for the table.
    1 CREATE - Filename : Verif - Tag : VerifType
    CREATE ERROR - Filename : Verif - Tag : VerifType - Error : adstblVerif: Error 5068: There is no current record.
    1 DELETE - Filename : Dossiers - Tag : ByBranch
    DELETE ERROR - Filename : Dossiers - Tag : ByBranch - Error : adstblCDossiers: Error 5132: The specified database object name is not valid. The specified index order is not defined for the table.
    1 CREATE - Filename : Dossiers - Tag : ByBranch
    CREATE ERROR - Filename : Dossiers - Tag : ByBranch - Error : adstblCDossiers: Error 5089: The operation is not valid for the auto-open index. Cannot redefine an existing index order in the data dictionary.
    1 DELETE - Filename : Dossiers - Tag : Dossiers
    DELETE ERROR - Filename : Dossiers - Tag : Dossiers - Error : adstblCDossiers: Error 5132: The specified database object name is not valid. The specified index order is not defined for the table.
    1 CREATE - Filename : Dossiers - Tag : Dossiers
    CREATE ERROR - Filename : Dossiers - Tag : Dossiers - Error : adstblCDossiers: Error 5089: The operation is not valid for the auto-open index. Cannot redefine an existing index order in the data dictionary.

Any help with this problem will be appreciated.

asked 22 Nov '13, 06:04

ygagnon's gravatar image

ygagnon
6113
accept rate: 0%

edited 26 Feb '15, 09:18

Jens%20M%C3%BChlenhoff's gravatar image

Jens Mühlenhoff
1.3k51037

I'll check into it and come back if it solves my problem.

(22 Nov '13, 06:23) ygagnon

why not just using AdsTable.Reindex method?

link

answered 22 Nov '13, 06:16

Joachim%20Duerr's gravatar image

Joachim Duerr
8.7k1031133
accept rate: 18%

The program is an old one (developped in 2000) and the indexes at that time where prone to get corrupted. That is why it was developped with a "delete" and "create" mode. I have changed it for the Reindex method wich solves my problem, but I still am confused as to why my code is not reacting the same way on network and local server.

(22 Nov '13, 10:09) ygagnon
Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×271
×172
×79
×4
×1

Asked: 22 Nov '13, 06:04

Seen: 2,843 times

Last updated: 26 Feb '15, 09:18

Advantage Developer Zone Contact Us Privacy Policy Copyright Info


Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.