#1 2015-04-23 12:07:55

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

create table without ID

Hi!

I have a database table with only two columns, they are a compound key, but I don't have any ID column as a primary key. If I execute CreateMissingTables I get an exception EMySQLNativeException [AnyDAC][Phys][MySQL] "Unknown column ID in field list".

  VirtualTableExternalRegister(FSQLModel, TMyDatabaseTableExt, FSQLConnectionProperties, 'MyDatabaseTable');
  FRestServer.CreateMissingTables();  

How can I handle this? Thank you for your help!

Offline

#2 2015-04-23 12:40:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,206
Website

Re: create table without ID

The ORM expects an INTEGER primary key.
By default, it is named "ID", but you can use any other name (e.g. "Key" or "Ident") in the external table.

It does not support compound key.
See http://synopse.info/files/html/Synopse% … l#MNDX_317

This is a restriction due to SQLite3, which we use as kernel.
So you NEED at least an integer primary key, even if you use other fields as primary key in your code.

Offline

#3 2015-04-23 12:44:07

cypriotcalm
Member
Registered: 2015-02-18
Posts: 122

Re: create table without ID

Ok, thanks!

Offline

Board footer

Powered by FluxBB