#1 Re: mORMot 1 » External database with remote access Firebird and FireDAC » 2014-02-21 15:04:29

Congratulations for the reply so quickly. I did not expect.
I'll study the code. I am returning many years without programming any help is welcome. Thank you.

#2 mORMot 1 » External database with remote access Firebird and FireDAC » 2014-02-21 14:04:37

vlda
Replies: 3

Hi
I wonder where I find a step by step example to use external database with remote access Firebird 2.5 and FireDAC. I only found examples like this with SQLite below:

Example de Roberto Schneiders
Delphi XE5

uses
  ...RMotSQLite3, mORMot, mORMotHttpServer;
  type
  TSQLPessoa = class(TSQLRecord)
  private
    FIdade: Integer;
    FNome: RawUTF8;
  published
    property Idade: Integer read FIdade write FIdade;
    property Nome: RawUTF8 read FNome write FNome;
  end;
...
  private
    { Private declarations }
    ModeloDados: TSQLModel;
    ModeloServicos:TSQLModel;
    BaseDados: TSQLRestServerDB;
    ServidorHTTP: TSQLHttpServer;
    ServidorServicos: TSQLRestServer;
    procedure ConfigurarLog;
    procedure InicializarBancoDeDados;
    procedure InicializarServicos;
    procedure InicializarServidorHTTP;
  public
    { Public declarations }
  end;

var
  FrmServidor: TFrmServidor;

implementation

{$R *.dfm}

uses uPessoa,  SynCommons, SynZip, uCalculadoraImpl, uCalculadora;

procedure TFrmServidor.InicializarBancoDeDados;
begin
  // Configura Log
  TSQLLog.Family.Level := LOG_VERBOSE;

  // Cria o modelo da base de dados contendo a classe/tabela TSQLPessoa
  ModeloDados := TSQLModel.Create([TSQLPessoa]);

  //Inicializa a base de dados. Se o arquivo não existir, será criado.
  BaseDados := TSQLRestServerDB.Create(ModeloDados, 'BasededadosSQLite.db3');

  // Atualizará o esquema da base de dados de acordo com o modelo. Ex: Tabela nova/Campo novo
  BaseDados.CreateMissingTables(0);
end;

procedure TFrmServidor.InicializarServicos;
begin
  // Test TInterfacedObject
  ModeloServicos := TSQLModel.Create([],'services');
  ServidorServicos := TSQLRestServerFullMemory.Create(ModeloServicos);
  ServidorServicos.ServiceRegister(TCalculadora,[TypeInfo(ICalculadora)], sicShared);
end;

procedure TFrmServidor.InicializarServidorHTTP;
begin
  ServidorHTTP := TSQLHttpServer.Create('8080', [BaseDados, ServidorServicos]);
  Label1.Caption := 'Servidor rodando na porta 8080'
end;

Board footer

Powered by FluxBB