FireDAC/Access database – cannot create FOREIGN KEY with ON DELETE CASCADE

  Kiến thức lập trình

Delphi win32 app, Access database: migrating from ADO to FireDAC

I’m in the process of migrating my Delphi 12 VCL windows application from MS Access database to PostgreSQL .

My first step is to migrate the provider from ADO to FireDAC.

Using ADO I could create a new table with referentiual integrity towards an existing table using a TADOQuery:

CREATE TABLE Absence ( 
  ID COUNTER, 
  ManID INTEGER, 
  ...(felter udeladt)...
  CONSTRAINT Absence_PK PRIMARY KEY (ID), 
  CONSTRAINT Absence_Men_FK FOREIGN KEY (ManID) REFERENCES Men ON DELETE CASCADE
);

But with a FireDAC TFDQuery I get the error

EMSAccessNativeExceptionexception message : [FireDAC][Phys][ODBC][Microsoft][ODBC Microsoft Access Driver] Syntax error in CONSTRAINT clause.

If I remove “ON DELETE CASCADE” the error is gone.

Can’t FireDAC create cascading delete? I get the feeling reading

text

Is it a limitation of ODBC?

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT