AnyDAC
ContentsIndexHome
PreviousUpNext
Additional migration hints

Few additional BDE application migration considerations.

Group
Links
Hint 1

Some properties should be removed completely, because AnyDAC does not have the analogues:

  • SessionName should be removed completely. But be careful, your application may be using multiple same named connections in different sessions.
  • PrivateDir should be removed completely.

 

Hint 2

Although AnyDAC has analogue to the BDE's TTable named TADTable, it is a good idea to replace all TTable's with TADQuery's right at the migration. 

 

Hint 3

BDE application with persistent fields must be adjusted additionally. BDE does not provide or use persistent fields Origin and ProviderFlagsproperties, and queries DB dictionary to get the unique identifying fields. AnyDAC provides and uses persistent fields Origin and ProviderFlags properties. When Origin is empty (as it is in BDE application), then AnyDAC will use field name. But default value of ProviderFlags does not include pfInKey, and AnyDAC will not query DB for PK fields. So, it will fail to get unique identifying fields and you must take one of the additional actions:

 

Hint 4

Constructions, like a: 

 

Screen.Cursor := crSQLWait;
try
  ......
finally
  Screen.Cursor := crDefault;
end;

 

Should be replaced with: 

 

uses
  uADStanFactory, uADGUIxIntf;
  ......
var
  oWait: IADGUIxWaitCursor;
  ......
  ADCreateInterface(IADGUIxWaitCursor, oWait);
  oWait.StartWait;
  try
    ......
  finally
    oWait.StopWait;
  end;

 

Hint 5

AnyDAC does not have a BDE API analogues. So, every code directly using the BDE API should be recoded using only AnyDAC API. There is no direct solution. 

 

Hint 6

Many third party products, like a reporting or m-tier libraries, require a DAC adapter unit. In most cases it exists for BDE and does not exists for AnyDAC, while we are working to add most used ones. So, either develop one yourself (taking the BDE adapter as template), or contact us. 

 

Hint 7

EDBEngineError is the BDE specific exception class. AnyDAC has an analogue - the EADDBEngineException class. When handling the BDE exceptions, the programmer uses the ErrorCode property to get an error kind. AnyDAC has the property kind, which returns an enumerated value. 

For example, change the following code: 

 

if E is EDBEngineError then
begin
  case EDBEngineError(E).Errors[0].ErrorCode of
    DBIERR_KEYVIOL: MetaBaseDBError(SMb_DataSetInvalidPKeyValue, E);
end;

 

into: 

 

if E is EADDBEngineException then
begin
  case EADDBEngineException(E).Kind of
    ekUKViolated: MetaBaseDBError(SMb_DataSetInvalidPKeyValue, E);
end;

 

Hint 8

The TDataMove and TADDataMove are very different in many ways. You will need serious rework on any advanced code using the TDataMove. 

 

Hint 9

The TADConnection.OnLogin event is incompatible with the TDatabase.OnLogin event parameters list. So, for example, you will need to replace the following handler: 

 

procedure TMyDataModule.dbLogin(Connection: TDEConnection; LoginParams:
TStrings);
begin
  LoginParams.Values['USER NAME'] := 'me';
  LoginParams.Values['PASSWORD'] := 'pwd';
end;

 

with this one: 

 

procedure TMyDataModule.dbLogin (AConnection: TADCustomConnection;
  const AConnectionDef: IADStanConnectionDef);
begin
  AConnectionDef.UserName := 'me';
  AConnectionDef.Password := 'pwd';
end;
What do you think about this topic? Send feedback!