-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMarioDB.pas
More file actions
88 lines (76 loc) · 2.56 KB
/
MarioDB.pas
File metadata and controls
88 lines (76 loc) · 2.56 KB
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
unit MarioDB;//V0.01
//A unit with DataBase Related Methods
interface
uses
Windows, SysUtils, Classes, DB, IBCustomDataSet, IBDatabase;
////////Procedures that use's basic units////////
Procedure MatIBBasicSQL(SelectFieldZ,DatabazeName, Extra:String;MyDataSet:TIBDataSet);
Procedure MatIBFieldList(MyFieldByName:String;var MyList:TStringList;MyDataSet:TDataSet);
Procedure MatIBFieldListConditional(MyFieldByName:String;var MyList:TStringList;MyDataSet:TIBDataSet;Fieldz,WhereFieldz,Conditionz,Databaze:String);
implementation
Procedure MatIBBasicSQL(SelectFieldZ,DatabazeName, Extra:String;MyDataSet:TIBDataSet);
Begin
Try
MyDataSet.DisableControls;
MyDataSet.Active := False;
MyDataSet.SelectSQL.Clear;
MyDataSet.SelectSQL.Add('select '
+ SelectFieldZ
+ ' from '
+ DataBazeName
+ ' '
+ Extra);
MyDataSet.Open;
Finally
MyDataSet.EnableControls;
End;
End;
//What It Dows
//Retrieves A List from a selected field in a DataSet
Procedure MatIBFieldList(MyFieldByName:String;var MyList:TStringList;MyDataSet:TDataSet);
begin
Try
with MyDataSet do
Begin
MyDataSet.DisableControls;
MyList.Sorted := True;
MyList.Duplicates := dupIgnore;
MyDataSet.First;
while not Eof do
Begin
MyList.Add(MyDataSet.FieldByName(MyFieldByName).AsString);
MyDataSet.Next;
End;
End;
Finally
MyDataSet.EnableControls;
End;
End;
Procedure MatIBFieldListConditional(MyFieldByName:String;var MyList:TStringList;MyDataSet:TIBDataSet;Fieldz,WhereFieldz,Conditionz,Databaze:String);
Begin
Try
MyDataSet.DisableControls;
//Call up the new condition in the DataSet
MyDataSet.Active := False;
MyDataSet.SelectSQL.Clear;
MyDataSet.SelectSQL.Add('select '
+ Fieldz
+ ' from '
+ Databaze
+ ' Where '
+ WhereFieldz
+ ' LIKE '''
+ Conditionz
+ ''' ');
MyDataSet.Open;
MatIBFieldList(MyFieldByName,MyList,MyDataSet);
Finally
//Reset the Dataset
MyDataSet.Active := False;
MyDataSet.SelectSQL.Clear;
MyDataSet.SelectSQL.Add('select * from '
+ Databaze);
MyDataSet.EnableControls;
End;
End;
End.