-
Notifications
You must be signed in to change notification settings - Fork 0
/
ConnectionModule.pas
53 lines (38 loc) · 944 Bytes
/
ConnectionModule.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
unit ConnectionModule;
interface
uses
Aurelius.Drivers.Interfaces,
Aurelius.SQL.SQLite,
Aurelius.Schema.SQLite,
Aurelius.Drivers.SQLite,
System.SysUtils, System.Classes, Data.DB, Aurelius.Bind.Dataset;
type
TSQLiteSQLiteConnection = class(TDataModule)
private
public
class function CreateConnection: IDBConnection;
class function CreateFactory: IDBConnectionFactory;
end;
var
nomedb:string;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
uses
Aurelius.Drivers.Base;
{$R *.dfm}
{ TMyConnectionModule }
class function TSQLiteSQLiteConnection.CreateConnection: IDBConnection;
begin
nomedb:='Estoque.db';
Result := TSQLiteNativeConnectionAdapter.Create(nomedb);
end;
class function TSQLiteSQLiteConnection.CreateFactory: IDBConnectionFactory;
begin
Result := TDBConnectionFactory.Create(
function: IDBConnection
begin
Result := CreateConnection;
end
);
end;
end.