-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathSimpleInterface.pas
112 lines (101 loc) · 4.36 KB
/
SimpleInterface.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
unit SimpleInterface;
interface
uses
System.Classes,
System.Generics.Collections,
Data.DB,
System.TypInfo,
{$IFNDEF CONSOLE}
{$IFDEF FMX}
FMX.Forms,
{$ELSE}
Vcl.Forms,
{$ENDIF}
{$ENDIF}
System.SysUtils;
type
iSimpleDAOSQLAttribute<T : class> = interface;
iSimpleDAO<T : class> = interface
['{19261B52-6122-4C41-9DDE-D3A1247CC461}']
{$IFNDEF CONSOLE}
function Insert: iSimpleDAO<T>; overload;
function Update : iSimpleDAO<T>; overload;
function Delete : iSimpleDAO<T>; overload;
{$ENDIF}
function Insert(aValue : T) : iSimpleDAO<T>; overload;
function Update(aValue : T) : iSimpleDAO<T>; overload;
function Delete(aValue : T) : iSimpleDAO<T>; overload;
function LastID : iSimpleDAO<T>;
function LastRecord : iSimpleDAO<T>;
function Delete(aField : String; aValue : String) : iSimpleDAO<T>; overload;
function DataSource( aDataSource : TDataSource) : iSimpleDAO<T>;
function Find(aBindList : Boolean = True) : iSimpleDAO<T>; overload;
function Find(var aList : TObjectList<T>) : iSimpleDAO<T> ; overload;
function Find(aId : Integer) : T; overload;
function Find(aKey : String; aValue : Variant) : iSimpleDAO<T>; overload;
function SQL : iSimpleDAOSQLAttribute<T>;
{$IFNDEF CONSOLE}
function BindForm(aForm : TForm) : iSimpleDAO<T>;
{$ENDIF}
end;
iSimpleDAOSQLAttribute<T : class> = interface
['{5DE6F977-336B-4142-ABD1-EB0173FFF71F}']
function Fields (aSQL : String) : iSimpleDAOSQLAttribute<T>; overload;
function Where (aSQL : String) : iSimpleDAOSQLAttribute<T>; overload;
function OrderBy (aSQL : String) : iSimpleDAOSQLAttribute<T>; overload;
function GroupBy (aSQL : String) : iSimpleDAOSQLAttribute<T>; overload;
function Join (aSQL : String) : iSimpleDAOSQLAttribute<T>; overload;
function Join : String; overload;
function Fields : String; overload;
function Where : String; overload;
function OrderBy : String; overload;
function GroupBy : String; overload;
function Clear : iSimpleDAOSQLAttribute<T>;
function &End : iSimpleDAO<T>;
end;
iSimpleRTTI<T : class> = interface
['{EEC49F47-24AC-4D82-9BEE-C259330A8993}']
function TableName(var aTableName: String): ISimpleRTTI<T>;
function ClassName (var aClassName : String) : iSimpleRTTI<T>;
function DictionaryFields(var aDictionary : TDictionary<string, variant>) : iSimpleRTTI<T>;
function DictionaryTypeFields(var aDictionary: TDictionary<string, TFieldType>): iSimpleRTTI<T>;
function ListFields (var List : TList<String>) : iSimpleRTTI<T>;
function Update (var aUpdate : String) : iSimpleRTTI<T>;
function Where (var aWhere : String) : iSimpleRTTI<T>;
function Fields (var aFields : String) : iSimpleRTTI<T>;
function FieldsInsert (var aFields : String) : iSimpleRTTI<T>;
function Param (var aParam : String) : iSimpleRTTI<T>;
function DataSetToEntityList (aDataSet : TDataSet; var aList : TObjectList<T>) : iSimpleRTTI<T>;
function DataSetToEntity (aDataSet : TDataSet; var aEntity : T) : iSimpleRTTI<T>;
function PrimaryKey(var aPK : String) : iSimpleRTTI<T>;
{$IFNDEF CONSOLE}
function BindClassToForm (aForm : TForm; const aEntity : T) : iSimpleRTTI<T>;
function BindFormToClass (aForm : TForm; var aEntity : T) : iSimpleRTTI<T>;
{$ENDIF}
end;
iSimpleSQL<T> = interface
['{1590A7C6-6E32-4579-9E60-38C966C1EB49}']
function Insert (var aSQL : String) : iSimpleSQL<T>;
function Update (var aSQL : String) : iSimpleSQL<T>;
function Delete (var aSQL : String) : iSimpleSQL<T>;
function Select (var aSQL : String) : iSimpleSQL<T>;
function SelectId(var aSQL: String): iSimpleSQL<T>;
function Fields (aSQL : String) : iSimpleSQL<T>;
function Where (aSQL : String) : iSimpleSQL<T>;
function OrderBy (aSQL : String) : iSimpleSQL<T>;
function GroupBy (aSQL : String) : iSimpleSQL<T>;
function Join (aSQL : String) : iSimpleSQL<T>;
function LastID (var aSQL : String) : iSimpleSQL<T>;
function LastRecord (var aSQL : String) : iSimpleSQL<T>;
end;
iSimpleQuery = interface
['{6DCCA942-736D-4C66-AC9B-94151F14853A}']
function SQL : TStrings;
function Params : TParams;
function ExecSQL : iSimpleQuery;
function DataSet : TDataSet;
function Open(aSQL : String) : iSimpleQuery; overload;
function Open : iSimpleQuery; overload;
end;
implementation
end.