Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Code sample for freeing advantage database server table

I have a set of tables that were included in an Advantage Database data dictionary. The dictionary is no longer available, and the tables will not open.

I would like to free those tables using code (not the Advantage Data Architect).

The only reference I can find to this is a function listed in the help called ADSDDFreeTable.

The documentation for the function is at this link:

http://devzone.advantagedatabase.com/dz/WebHelp/Advantage11.1/index.html?ace_adsddfreetable.htm

but it does not offer a code sample, and I cannot understand how to use it.

Would anyone be kind enough to show a code sample of how this function is used (with variables, not literals, for file names, etc)

Thanks very much!

like image 266
Bill Seven Avatar asked Dec 25 '22 20:12

Bill Seven


1 Answers

Ace.pas defines AdsDDFreeTable as

function AdsDDFreeTable( pucTableName: PAceChar;
                         pucPassword: PAceChar ):UNSIGNED32; {$IFDEF WIN32}stdcall;{$ENDIF}{$IFDEF LINUX}cdecl;{$ENDIF}

The same Ace.pas defines PAceChar:

type
  PAceChar = PAnsiChar;

Therefore, the call to the function should be fairly straightforward:

var
  TableName: AnsiString;
begin
  TableName := 'C:\Data\MyTable.adt`;
  if AdsDDFreeTable(PAnsiChar(TableName), nil) <> ADS_FREETABLEFAILED then
    ShowMessage('Table removed from datadictionary')
  else
    // Call ADSGetLastError to retrieve reason for failure;
end;
like image 51
Ken White Avatar answered Feb 14 '23 08:02

Ken White