Dynamically created tables in DataAbstract Server

I’m starting a new delphi project and I have the need to be able to dynamically create tables on the DataAbstract server, to be later consumed client side.
I need to create the tables on the server as if they where created in schema modeler, but at runtime, without the need to use schema modeler and thus recompile the DAServer and DAClient executables.

Hello,

Maybe you could consider such a variant: load schema from file on the server in the DataService.onActivate event:

procedure TDataService.DataAbstractServiceActivate(const aClientID: TGUID;
aSession: TROSession; const aMessage: IROMessage);
begin
Schema.LoadFromFile(‘Schema.daSchema’);
end;

And you could either define your tables in SM outside of DA server, or create them dynamically like this:

with Schema.Datasets.Add do
begin
Name:=NewDatasetName;
with Statements.Add do
begin
TargetTable:=TargetTable;
StatementType:=stAutoSQL;
Connection:=ConnectionName;
end;
with Fields.Add do
begin
// Add dataset fields here
end;
end;

Schema.SaveToFile(‘Schema.daSchema’);

In both cases you wouldn’t have need to recompile server and client, if you load tables dynamically on the client.

Hope this helps.