Changeset 6
- Timestamp:
- Jan 20, 2015, 12:31:24 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormRecord.lfm
r5 r6 19 19 Align = alTop 20 20 BorderSpacing.Around = 4 21 BevelOuter = bvNone 21 22 TabOrder = 0 22 23 end -
trunk/Forms/UFormTables.lfm
r4 r6 1 object Form Main: TFormMain2 Left = 6 441 object FormTables: TFormTables 2 Left = 659 3 3 Height = 660 4 Top = 4204 Top = 342 5 5 Width = 978 6 Caption = ' MyData'6 Caption = 'Tables' 7 7 ClientHeight = 660 8 8 ClientWidth = 978 -
trunk/Forms/UFormTables.pas
r4 r6 11 11 type 12 12 13 { TForm Main}13 { TFormTables } 14 14 15 TForm Main= class(TForm)15 TFormTables = class(TForm) 16 16 AAdd: TAction; 17 17 AShowFields: TAction; … … 53 53 54 54 var 55 Form Main: TFormMain;55 FormTables: TFormTables; 56 56 57 57 implementation … … 62 62 {$R *.lfm} 63 63 64 { TForm Main}64 { TFormTables } 65 65 66 procedure TForm Main.ListView1Data(Sender: TObject; Item: TListItem);66 procedure TFormTables.ListView1Data(Sender: TObject; Item: TListItem); 67 67 begin 68 68 if (Item.Index >= 0) and (Item.Index < Database.Tables.Count) then … … 74 74 end; 75 75 76 procedure TForm Main.ListView1SelectItem(Sender: TObject; Item: TListItem;76 procedure TFormTables.ListView1SelectItem(Sender: TObject; Item: TListItem; 77 77 Selected: Boolean); 78 78 begin … … 80 80 end; 81 81 82 procedure TForm Main.UpdateInterface;82 procedure TFormTables.UpdateInterface; 83 83 begin 84 84 AModify.Enabled := Assigned(ListView1.Selected); … … 88 88 end; 89 89 90 procedure TForm Main.AAddExecute(Sender: TObject);90 procedure TFormTables.AAddExecute(Sender: TObject); 91 91 var 92 92 NewTable: TTable; … … 102 102 end; 103 103 104 procedure TForm Main.AModifyExecute(Sender: TObject);104 procedure TFormTables.AModifyExecute(Sender: TObject); 105 105 begin 106 106 if Assigned(ListView1.Selected) then begin … … 113 113 end; 114 114 115 procedure TForm Main.ARemoveExecute(Sender: TObject);115 procedure TFormTables.ARemoveExecute(Sender: TObject); 116 116 begin 117 117 if Assigned(ListView1.Selected) then begin … … 124 124 end; 125 125 126 procedure TForm Main.AShowFieldsExecute(Sender: TObject);126 procedure TFormTables.AShowFieldsExecute(Sender: TObject); 127 127 var 128 128 NewRecords: TRecords; … … 166 166 end; 167 167 168 procedure TForm Main.AShowRecordsExecute(Sender: TObject);168 procedure TFormTables.AShowRecordsExecute(Sender: TObject); 169 169 begin 170 170 if Assigned(ListView1.Selected) then begin … … 175 175 end; 176 176 177 procedure TForm Main.FormActivate(Sender: TObject);177 procedure TFormTables.FormActivate(Sender: TObject); 178 178 begin 179 Core.Init;180 179 end; 181 180 182 procedure TForm Main.FormClose(Sender: TObject; var CloseAction: TCloseAction);181 procedure TFormTables.FormClose(Sender: TObject; var CloseAction: TCloseAction); 183 182 begin 184 Core.Done;183 Database.Save; 185 184 end; 186 185 187 procedure TForm Main.FormShow(Sender: TObject);186 procedure TFormTables.FormShow(Sender: TObject); 188 187 begin 189 Database := Core.Database;190 188 ReloadList; 191 189 end; 192 190 193 procedure TForm Main.ReloadList;191 procedure TFormTables.ReloadList; 194 192 begin 195 193 ListView1.Items.Count := Database.Tables.Count; 196 194 ListView1.Repaint; 197 FormMain.UpdateInterface;195 UpdateInterface; 198 196 end; 199 197 -
trunk/MyData.lpi
r4 r6 78 78 </Item3> 79 79 </RequiredPackages> 80 <Units Count="1 1">80 <Units Count="16"> 81 81 <Unit0> 82 82 <Filename Value="MyData.lpr"/> … … 86 86 <Filename Value="Forms/UFormTables.pas"/> 87 87 <IsPartOfProject Value="True"/> 88 <ComponentName Value="Form Main"/>88 <ComponentName Value="FormTables"/> 89 89 <HasResources Value="True"/> 90 90 <ResourceBaseClass Value="Form"/> … … 105 105 </Unit3> 106 106 <Unit4> 107 <Filename Value=" UDatabaseXML.pas"/>108 <IsPartOfProject Value="True"/> 109 <UnitName Value="U DatabaseXML"/>107 <Filename Value="DbEngines/UEngineXML.pas"/> 108 <IsPartOfProject Value="True"/> 109 <UnitName Value="UEngineXML"/> 110 110 </Unit4> 111 111 <Unit5> … … 154 154 <UnitName Value="UDataTypes"/> 155 155 </Unit10> 156 <Unit11> 157 <Filename Value="DbEngines/UEngineMySQL.pas"/> 158 <IsPartOfProject Value="True"/> 159 <UnitName Value="UEngineMySQL"/> 160 </Unit11> 161 <Unit12> 162 <Filename Value="DbEngines/UEngineSQLite.pas"/> 163 <IsPartOfProject Value="True"/> 164 <UnitName Value="UEngineSQLite"/> 165 </Unit12> 166 <Unit13> 167 <Filename Value="Forms/UFormMain.pas"/> 168 <IsPartOfProject Value="True"/> 169 <ComponentName Value="FormMain"/> 170 <ResourceBaseClass Value="Form"/> 171 <UnitName Value="UFormMain"/> 172 </Unit13> 173 <Unit14> 174 <Filename Value="Forms/UFormConnect.pas"/> 175 <IsPartOfProject Value="True"/> 176 <ComponentName Value="FormConnect"/> 177 <ResourceBaseClass Value="Form"/> 178 <UnitName Value="UFormConnect"/> 179 </Unit14> 180 <Unit15> 181 <Filename Value="Forms/UFormDatabases.pas"/> 182 <IsPartOfProject Value="True"/> 183 <ComponentName Value="FormDatabases"/> 184 <ResourceBaseClass Value="Form"/> 185 <UnitName Value="UFormDatabases"/> 186 </Unit15> 156 187 </Units> 157 188 </ProjectOptions> … … 163 194 <SearchPaths> 164 195 <IncludeFiles Value="$(ProjOutDir)"/> 165 <OtherUnitFiles Value="Forms "/>196 <OtherUnitFiles Value="Forms;DbEngines"/> 166 197 <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> 167 198 </SearchPaths> -
trunk/MyData.lpr
r4 r6 8 8 {$ENDIF}{$ENDIF} 9 9 Interfaces, // this includes the LCL widgetset 10 Forms, UFormTables, UDatabase, UCore, Common, U DatabaseXML, UFormTable,11 UFormRecords, UFormRecord, UFormFields, UFormField, UDataTypes 12 { you can add units after this };10 Forms, UFormTables, UDatabase, UCore, Common, UEngineXML, UFormTable, 11 UFormRecords, UFormRecord, UFormFields, UFormField, UDataTypes, UEngineMySQL, 12 UEngineSQLite, UFormMain, UFormConnect, UFormDatabases; 13 13 14 14 {$R *.res} … … 19 19 Application.CreateForm(TCore, Core); 20 20 Application.CreateForm(TFormMain, FormMain); 21 Application.CreateForm(TFormTables, FormTables); 21 22 Application.CreateForm(TFormTable, FormTable); 22 23 Application.CreateForm(TFormRecords, FormRecords); … … 24 25 Application.CreateForm(TFormFields, FormFields); 25 26 Application.CreateForm(TFormField, FormField); 27 Application.CreateForm(TFormConnect, FormConnect); 28 Application.CreateForm(TFormDatabases, FormDatabases); 26 29 Application.Run; 27 30 end. -
trunk/UCore.lfm
r4 r6 13 13 top = 136 14 14 Bitmap = { 15 4C690 8000000200000002000000061C66E0061C66E0061C66E0061C66E0061C615 4C6909000000200000002000000061C66E0061C66E0061C66E0061C66E0061C6 16 16 6E0061C66E0061C66E0061C66E0061C66E0061C66E0061C56E0048B05E0947AF 17 17 5D4E47AE5C7946AD5B9A47AD5BB046AC5AB045AA589A44A9577944A7564E43A6 … … 1037 1037 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FDFDFDFFFDFDFDFFFDFDFDFFFFFF 1038 1038 FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FDFDFDFFFDFD 1039 FDFFFDFDFDFFFFFFFF00FFFFFF00 1039 FDFFFDFDFDFFFFFFFF00FFFFFF0000000000000000000000000000000001A099 1040 8F37A69F9385A9A196D2A9A195E2AAA296FFAAA296FFAAA296FFAAA296FFAAA2 1041 96FFAAA296FFAAA296FFAAA296FFAAA296FFAAA296FFA9A195E2A9A196D2A69F 1042 9385A0998F370000000100000000000000000000000000000000000000000000 1043 00000000000000000000000000000000000000000003A79F9489AAA396FFB7AE 1044 A3FFC8BFB4FFD9D1C6FFDDD5CAFFF1E9DFFFF0E8DEFFF0E8DEFFF0E8DEFFF0E8 1045 DEFFF0E8DEFFF0E8DEFFF0E8DEFFF0E8DEFFF1E9DFFFDDD5CAFFD9D1C6FFC8BF 1046 B4FFB7AEA3FFAAA296FFA79F9489000000030000000000000000000000000000 1047 000000000000000000000000000000000004A69E93B2B5ADA1FFDED5CBFFE9E1 1048 D7FFE7DFD5FFE6DED4FFE5DDD3FFE5DDD3FFE4DCD2FFE4DCD2FFE4DCD2FFE4DC 1049 D2FFE4DCD2FFE4DCD2FFE4DCD2FFE4DCD2FFE5DDD3FFE5DDD3FFE6DED4FFE7DF 1050 D5FFE9E1D7FFE2DAD0FFB5ADA1FFA69E93B20000000400000000000000000000 1051 00000000000000000000000000000000000DA9A296FFE0D6CDFFE0D6CCFFDED5 1052 CBFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4 1053 CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4CAFFDDD4 1054 CAFFDED5CBFFDFD6CCFFE0D6CDFFA9A296FF0000000D00000000000000000000 1055 000000000000000000000000000000000015A69F93FFECE5DDFFD5CCC2FFD5CC 1056 C2FFD6CDC3FFD7CEC3FFD7CEC4FFD7CEC4FFD7CEC4FFD7CEC4FFD7CEC4FFD7CE 1057 C4FFD7CEC4FFD7CEC4FFD7CEC4FFD7CEC4FFD7CEC4FFD7CEC4FFD7CEC3FFD6CD 1058 C3FFD5CCC2FFD5CCC2FFECE5DDFFA69F93FF0000001500000000000000000000 1059 000000000000000000000000000000000016A69E93FFFFFCF5FFEAE3DBFFD3C9 1060 C0FFCDC3B9FFCEC5BAFFCEC5BBFFCFC6BBFFCFC6BCFFCFC6BCFFCFC6BCFFCFC6 1061 BCFFCFC6BCFFCFC6BCFFCFC6BCFFCFC6BCFFCFC6BBFFCEC5BBFFCEC5BAFFCDC3 1062 B9FFD3C9C0FFEAE3DBFFFFFCF5FFABA499FF0000001600000000000000000000 1063 000000000000000000000000000000000016A69F93FFCFC8BFFFF8F4ECFFFFFA 1064 F4FFF8F2EBFFE9E2DAFFE3DAD3FFD7CFC6FFD4CBC2FFD4CBC2FFD4CBC2FFD4CB 1065 C2FFD4CBC2FFD4CBC2FFD4CBC2FFD4CBC2FFD7CFC6FFE3DAD3FFE9E2DAFFF8F2 1066 EBFFFFFAF4FFF4F0E8FFCFC8BFFFA69F93FF0000001600000000000000000000 1067 000000000000000000000000000000000016A7A093FFC7BEB6FFC6BFB4FFD2CB 1068 C2FFE2DBD3FFF0EAE2FFF3EEE7FFFDFAF3FFFDF9F2FFFDF8F2FFFCF8F1FFFCF8 1069 F1FFFCF8F1FFFCF8F1FFFDF8F2FFFDF9F2FFFDF9F3FFF3EEE7FFEFEAE2FFE2DC 1070 D3FFD3CCC3FFC7BFB6FFC8BFB7FFA7A093FF0000001600000000000000000000 1071 000000000000000000000000000000000016A69F94FFC8C0B8FFC9C2B8FFCCC3 1072 BAFFCEC6BDFFD2C8BFFFD5CBC3FFD9CEC6FFDCD2CAFFE0D6CEFFE3D9D2FFE8DD 1073 D6FFEADED7FFE5DAD3FFE1D7CFFFDDD4CCFFDACFC7FFD6CCC4FFD3C9C0FFCFC7 1074 BEFFCDC4BBFFCAC2B9FFCAC1B9FFA69F94FF0000001600000000000000000000 1075 000000000000000000000000000000000016A59E93FFC9C1B9FFCAC3B9FFCDC5 1076 BCFFD0C8BFFFD4CBC2FFD7CEC6FFDBD1C9FFDED5CDFFE2D8D0FFE5DBD4FFE9DE 1077 D7FFEADFD8FFE6DCD5FFE3D9D1FFDFD6CEFFDCD2CAFFD8CFC7FFD5CCC3FFD1C9 1078 C0FFCEC6BDFFCBC3BAFFCBC3BAFFA69F93FF0000001600000000000000000000 1079 000000000000000000000000000000000014918B80B8B6AEA4FFCBC4BAFFCEC6 1080 BDFFD1C9C0FFD4CBC2FFD7CEC6FFDBD1C9FFDED5CDFFE2D8D0FFE5DBD4FFE9DE 1081 D7FFEBDFD8FFE6DCD5FFE3D9D1FFDFD6CEFFDCD2CAFFD8CFC7FFD5CCC3FFD1C9 1082 C0FFCFC7BEFFCDC5BCFFBFB7ADFF928C80B40000001400000000000000000000 1083 000000000000000000000000000000000010928C82B5B4ACA3FFB5ADA2FFC9C1 1084 B8FFD3CBC2FFD6CDC4FFD9D0C8FFDDD3CBFFDFD6CFFFE3D9D1FFE6DCD5FFEADF 1085 D8FFECE0D9FFE7DDD6FFE4DAD2FFE0D7D0FFDDD4CCFFDAD1CAFFD7CEC5FFD3CC 1086 C2FFD3CBC1FFC6BDB3FF7A7B7DFF7F8081FF0000001200000000000000000000 1087 000000000000000000000000000000000010A29A8FFFF1EBE4FFB7AFA6FFA59C 1088 91FFABA298FFBBB2A9FFC5BAB1FFD1C8BFFFD5CBC2FFE1D7CFFFE8DED7FFECE1 1089 DAFFEEE2DBFFE9DFD8FFE6DDD5FFD9D1CBFFD2CDC7FFCFC8C4FFBFB7B0FFB8AE 1090 A5FFB3A99FFF787A7BFFC4C2C0FFB4B2AFFF777777FF00000006000000000000 1091 000000000000000000000000000000000014A09A8EFFD3CBC3FFF6F1EAFFEFE9 1092 E3FFDAD5CDFFCAC2BAFFBCB3ABFFB4ABA1FFB4AAA1FFB6ACA3FFB8AEA6FFBAB0 1093 A6FFBBB0A8FFB9AEA6FFB8AEA8FFB8B2AFFFB3772CFFB3772CFFCECCC9FFE4DF 1094 D9FF78797BFFC2C1BFFFAFADABFFA19E9CFF777778FF00000011000000000000 1095 000000000000000000000000000000000016A09A8FFFC8C0B7FFC7C0B6FFD4CD 1096 C4FFE4DDD6FFF2EDE5FFF6F1EAFFFFFCF5FFFFFBF4FFFFFBF4FFFEFAF3FFFDFA 1097 F3FFFDFAF3FFFFFBF5FFFFFFFFFFB1752BFFFFEECCFFFFEAC7FFB4782EFF737B 1098 83FFC1C1C2FFAFADABFF9F9B9AFF737375FF0000003700000011000000000000 1099 000000000000000000000000000000000016A09A8EFFC9C1B8FFC9C2B8FFCCC4 1100 BBFFCEC6BDFFD2C9C0FFD5CCC4FFD9CFC7FFDCD3CBFFE1D6CEFFE4D9D2FFE9DD 1101 D6FFEADFD8FFE6DEDAFFE5E1E0FFAF762EFFFFD699FFFFD093FFFBDAB3FFB77A 1102 31FFAAAEB3FF9C9B9CFF6E7073FFA8A094FF0000002200000006000000000000 1103 000000000000000000000000000000000016A0998FFFCAC2B9FFCAC3B9FFCDC5 1104 BCFFD0C8BFFFD4CBC2FFD7CEC6FFDBD1C9FFDED5CDFFE2D8D0FFE5DBD4FFE9DE 1105 D8FFECE2DDFFE9E3E3FFAD7229FFFFECC8FFAB7431FFFFD296FFFFCC8CFFF6D4 1106 A8FFB87C33FF686F78FFD3CCC4FFA39C92FF0000001600000000000000068888 1107 88FF8A8A8AFF0000000600000000000000148B867CB8B7AFA4FFCBC5BAFFCEC6 1108 BDFFD1C9C0FFD4CBC2FFD7CEC6FFDBD1C9FFDED5CDFFE2D8D0FFE5DBD4FFEADF 1109 D9FFEDE5E3FFAF7329FFFFE3BAFFFFCD8FFFFFE9CBFFAA7431FFFFCF90FFFDC8 1110 86FFF2CC9DFFB87C34FFBEBBB9FF8B877FB60000001400000006858686FFC6C3 1111 C1FFB4B2B0FF777778FF00000006000000108D877DB5B5ACA4FFB5ADA2FFC9C1 1112 B8FFD3CBC2FFD6CDC4FFD9D0C8FFDDD3CBFFDFD6CEFFE3D9D1FFE6DCD5FFEBE0 1113 DAFFEFE7E6FFB0762EFFFFDCAEFFFCC887FFFCC988FFFFE5C0FFAB7533FFFECB 1114 8BFFFBC580FFEBC390FFB77C35FF888883AD00000015858586FFC4C2C0FFB0AE 1115 ABFFA29E9CFF787878FF00000011000000109B958BFFF2ECE4FFB8AFA6FFA59C 1116 91FFABA298FFBBB2A9FFC5BAB1FFD1C8BFFFD5CBC2FFE5DBD3FFE8DED7FFEDE3 1117 DDFFF0EAE8FFB07730FFFED6A2FFF8C481FFF7C482FFF9C582FFFFDFB5FFAC76 1118 35FFFBC885FFF7C079FFEFC48DFFBA7F37FF7F868FFFC3C3C4FFAFAEACFFA09D 1119 9BFF767676FF0000003700000011000000149A958AFFD3CCC3FFF6F1EAFFEFE9 1120 E3FFDAD5CDFFCAC2BAFFBCB3ABFFB4ABA1FFB4AAA1FFB6ACA2FFB8AEA6FFBBB1 1121 A8FFBEB6B4FFB17832FFFCCF96FFF6C17DFFF5C17EFFF5C17DFFF7C27DFFFDD8 1122 A9FFAC7737FFF9C37EFFF4BD72FFDCAF74FFB97F37FFABB0B6FF9E9D9EFF7576 1123 78FF0000003D0000001C00000006000000169A9589FFC8C0B7FFC7C0B6FFD4CD 1124 C4FFE4DDD6FFF2EDE5FFF6F1EAFFFFFCF5FFFFFBF4FFFFFBF4FFFEFAF3FFFEFB 1125 F5FFFFFFFFFFB07731FFFAC888FFF4BE79FFF3BE79FFF3BE79FFF3BE79FFF5BF 1126 79FFFBD19CFFAD7939FFF7C078FFF3BA6DFFD29E57DFBB813AFF6D7580FF0000 1127 003D0000001C0000000600000000000000169A948AFFC9C1B8FFC9C2B8FFCCC4 1128 BBFFCEC6BDFFD2C9C0FFD5CCC4FFD9CFC7FFDCD3CBFFE1D6CEFFE4D9D2FFE9DE 1129 D9FFEEE7E6FFB17832FFF6C27BFFF1BC73FFF0BB73FFF0BB73FFF0BB73FFF0BB 1130 73FFF2BC73FFF7CB8EFFAD7A3BFFF4BD72FFEFB667FFCF994DE1BB8441FF0000 1131 002200000006000000000000000000000016999389FFCAC2B9FFCAC3B9FFCDC5 1132 BCFFD0C8BFFFD4CBC2FFD7CEC6FFDBD1C9FFDED5CDFFE2D8D0FFE5DBD4FFEAE0 1133 D9FFEFE7E5FFB37830FFF6BC6EFFF0B96FFFEEB76EFFEEB76EFFEEB76EFFEEB7 1134 6EFFEEB76EFFF0B86EFFF5C380FFAE7B3EFFF2B96EFFECB360FFD09645E4B985 1135 45FF00000006000000000000000000000016999489FFC8C1B7FFCBC4BAFFCEC6 1136 BDFFD0C8BFFFD4CBC2FFD7CEC6FFDBD1C9FFDED5CDFFE2D8D0FFE5DBD4FFECE1 1137 DAFFF3E8E3FF8C9196FFB47A33FFF2B766FFEEB668FFECB468FFECB468FFECB4 1138 68FFECB468FFECB468FFEEB668FFF1BB72FFB07D40FFECB15DFFEEB15BFFB885 1139 46FF0000001100000000000000000000001588847BC1A09B91FFC8C1B7FFD2CA 1140 C1FFD3CBC2FFD7CEC5FFD9D0C8FFDDD3CBFFDFD6CEFFE3D9D1FFE7DDD6FFF0E4 1141 DDFF8C8C8AFFE3E4E6FFD0D4DDFFB57A34FFEFB562FFEBB363FFEAB263FFEAB2 1142 63FFEAB263FFEAB263FFEAB263FFECB465FFF1B868FFB58244FFB88445FF0000 1143 00370000001100000000000000000000000D0000002E78736BA8979187FFA19B 1144 91FFB1AAA1FFC5BCB4FFCBC3BAFFE3D8D0FFE5DCD4FFEADFD7FFEEE3DCFFF7EA 1145 E3FF8E8D8BFFD6D4D4FFC1C2C4FFB0B5BBFFB97F39FFEFB35DFFECB25FFFECB2 1146 5FFFECB25FFFECB25FFFECB25FFFEEB460FFB68244FF00000048000000370000 1147 001C00000006000000000000000000000004000000130000002B0000003E4745 1148 406D737068A78B877DDF8E8980EA948F85FF938E84FF928E83FF928D83FF938E 1149 83FF8F8C8AFF8A8785FFB7B6B4FFA6A5A6FF777C84FFBB8440FFB78344FFB683 1150 45FFB68345FFB68345FFB68345FFB88445FF0000003D00000022000000110000 1151 000600000000000000000000000000000000000000030000000B000000160000 1152 00200000002D000000370000003E000000410000004300000043000000488F8C 1153 8BFFD7D5D4FF878682FF84837FFF7F7D7DFF0000004800000043000000430000 1154 0043000000430000004300000043000000370000001C00000006000000000000 1155 0000000000000000000000000000000000000000000000000000000000010000 1156 00050000000B000000110000001400000016000000160000001600000025ABA8 1157 A7C6868481FF0000004800000043000000370000002200000016000000160000 1158 0016000000160000001600000016000000110000000600000000000000000000 1159 0000000000000000000000000000000000000000000000000000000000000000 1160 00000000000000000000000000000000000000000000000000000000000D0000 1161 002B000000340000002200000016000000110000000600000000000000000000 1162 0000000000000000000000000000000000000000000000000000000000000000 1163 0000000000000000000000000000000000000000000000000000000000000000 1164 0000000000000000000000000000000000000000000000000000000000040000 1165 000D0000000F0000000600000000000000000000000000000000000000000000 1166 0000000000000000000000000000000000000000000000000000000000000000 1167 0000000000000000000000000000 1040 1168 } 1041 1169 end -
trunk/UCore.pas
r3 r6 22 22 private 23 23 Initialized: Boolean; 24 procedure InitEngines; 24 25 public 25 Database: TDatabase; 26 Databases: TDatabases; 27 Engines: TDatabaseEngines; 26 28 procedure LoadConfig; 27 29 procedure SaveConfig; … … 36 38 37 39 uses 38 U DatabaseXML, UFormTables;40 UEngineXML, UEngineMySQL, UEngineSQLite, UFormTables, UFormConnect, UFormDatabases; 39 41 40 42 {$R *.lfm} … … 44 46 procedure TCore.DataModuleCreate(Sender: TObject); 45 47 begin 46 Database := TDatabaseXML.Create; 48 Databases := TDatabases.Create; 49 Engines := TDatabaseEngines.Create; 47 50 end; 48 51 49 52 procedure TCore.AExitExecute(Sender: TObject); 50 53 begin 51 Form Main.Close;54 FormTables.Close; 52 55 end; 53 56 54 57 procedure TCore.DataModuleDestroy(Sender: TObject); 55 58 begin 56 Database.Free; 59 Engines.Free; 60 Databases.Free; 61 end; 62 63 procedure TCore.InitEngines; 64 var 65 NewEngine: TDatabaseEngine; 66 begin 67 Engines.Clear; 68 69 NewEngine := Engines.RegisterEngine('XML file', TDatabaseXML); 70 with NewEngine.DataTypes do begin 71 RegisterType('String', ftString); 72 RegisterType('Integer', ftInteger); 73 RegisterType('Date and time', ftDateTime); 74 RegisterType('Boolean', ftBoolean); 75 RegisterType('Float', ftFloat); 76 end; 77 78 NewEngine := Engines.RegisterEngine('MySQL', TDatabaseMySQL); 79 with NewEngine.DataTypes do begin 80 RegisterType('String', ftString); 81 RegisterType('Integer', ftInteger); 82 RegisterType('Date and time', ftDateTime); 83 RegisterType('Boolean', ftBoolean); 84 RegisterType('Float', ftFloat); 85 end; 86 87 NewEngine := Engines.RegisterEngine('SQLite', TDatabaseSQLite); 88 with NewEngine.DataTypes do begin 89 RegisterType('String', ftString); 90 RegisterType('Integer', ftInteger); 91 RegisterType('Date and time', ftDateTime); 92 RegisterType('Boolean', ftBoolean); 93 RegisterType('Float', ftFloat); 94 end; 57 95 end; 58 96 59 97 procedure TCore.LoadConfig; 98 var 99 I: Integer; 100 NewDatabase: TDatabase; 60 101 begin 61 Database.ConnectionString := XMLConfig1.GetValue('ConnectionString', 'file://' + ExtractFileDir(Application.ExeName) + '/data.xml'); 102 Databases.Count := XMLConfig1.GetValue('Database/Count', 0); 103 for I := 0 to Databases.Count - 1 do begin 104 NewDatabase := TDatabase.Create; 105 NewDatabase.Name := XMLConfig1.GetValue('Database/Item' + IntToStr(I) + '/Name', ''); 106 NewDatabase.ConnectionString := XMLConfig1.GetValue('Database/Item' + IntToStr(I) + '/ConnectionString', ''); 107 NewDatabase.Engine := Core.Engines.FindByName(XMLConfig1.GetValue('Database/Item' + IntToStr(I) + '/Engine', '')); 108 Databases[I] := NewDatabase; 109 end; 110 //Databases.ConnectionString := XMLConfig1.GetValue('ConnectionString', 'file://' + ExtractFileDir(Application.ExeName) + '/data.xml'); 62 111 end; 63 112 64 113 procedure TCore.SaveConfig; 114 var 115 I: Integer; 65 116 begin 66 XMLConfig1.SetValue('ConnectionString', Database.ConnectionString); 117 XMLConfig1.SetValue('Database/Count', Databases.Count); 118 for I := 0 to Databases.Count - 1 do begin 119 XMLConfig1.SetValue('Database/Item' + IntToStr(I) + '/Name', TDatabase(Databases[I]).Name); 120 XMLConfig1.SetValue('Database/Item' + IntToStr(I) + '/ConnectionString', TDatabase(Databases[I]).ConnectionString); 121 XMLConfig1.SetValue('Database/Item' + IntToStr(I) + '/Engine', TDatabase(Databases[I]).Engine.Name); 122 end; 67 123 end; 68 124 … … 70 126 begin 71 127 if not Initialized then begin 128 InitEngines; 129 FormConnect.Init; 72 130 Initialized := True; 73 131 LoadConfig; 74 Database.Load; 75 FormMain.ReloadList; 132 FormDatabases.ReloadList; 76 133 end; 77 134 end; … … 79 136 procedure TCore.Done; 80 137 begin 81 Database.Save;82 138 SaveConfig; 83 139 end; -
trunk/UDataTypes.pas
r4 r6 6 6 7 7 uses 8 Classes, SysUtils, UDatabase ;8 Classes, SysUtils, UDatabase, Contnrs; 9 9 10 10 type … … 111 111 TFieldMapPosition = class(TFieldTypeSpecific) 112 112 end; 113 114 113 115 114 const … … 263 262 end; 264 263 265 266 267 264 end. 268 265 -
trunk/UDatabase.pas
r4 r6 10 10 type 11 11 TTable = class; 12 TDatabaseEngine = class; 12 13 13 14 TFieldType = (ftString, ftInteger, ftDateTime, ftBoolean, ftFloat, ftImage, … … 109 110 Tables: TTables; 110 111 ConnectionString: string; 112 Engine: TDatabaseEngine; 111 113 constructor Create; 112 114 destructor Destroy; override; … … 115 117 end; 116 118 119 TDatabases = class(TObjectList) 120 121 end; 122 123 TDatabaseClass = class of TDatabase; 124 125 { TDataType } 126 127 TDataType = class 128 Name: string; 129 FieldType: TFieldType; 130 end; 131 132 TDataTypes = class(TObjectList) 133 function RegisterType(Name: string; FieldType: TFieldType): TDataType; 134 end; 135 136 { TDatabaseEngine } 137 138 TDatabaseEngine = class 139 Name: string; 140 DataTypes: TDataTypes; 141 DatabaseClass: TDatabaseClass; 142 constructor Create; 143 destructor Destroy; override; 144 end; 145 146 { TDatabaseEngines } 147 148 TDatabaseEngines = class(TObjectList) 149 function RegisterEngine(Name: string; DatabaseClass: TDatabaseClass): TDatabaseEngine; 150 function FindByName(Name: string): TDatabaseEngine; 151 end; 152 117 153 118 154 implementation … … 120 156 uses 121 157 UDataTypes; 158 159 { TDatabaseEngines } 160 161 function TDatabaseEngines.RegisterEngine(Name: string; 162 DatabaseClass: TDatabaseClass): TDatabaseEngine; 163 begin 164 Result := TDatabaseEngine.Create; 165 Result.Name := Name; 166 Result.DatabaseClass := DatabaseClass; 167 Add(Result); 168 end; 169 170 function TDatabaseEngines.FindByName(Name: string): TDatabaseEngine; 171 var 172 I: Integer; 173 begin 174 I := 0; 175 while (I < Count) and (TDatabaseEngine(Items[I]).Name <> Name) do Inc(I); 176 if I < Count then Result := TDatabaseEngine(Items[I]) 177 else Result := nil; 178 end; 179 180 { TDataTypes } 181 182 function TDataTypes.RegisterType(Name: string; FieldType: TFieldType): TDataType; 183 begin 184 Result := TDataType.Create; 185 Result.Name := Name; 186 Result.FieldType := FieldType; 187 Add(Result); 188 end; 189 190 { TDatabaseEngine } 191 192 constructor TDatabaseEngine.Create; 193 begin 194 DataTypes := TDataTypes.Create; 195 end; 196 197 destructor TDatabaseEngine.Destroy; 198 begin 199 DataTypes.Free; 200 inherited Destroy; 201 end; 122 202 123 203 { TValues }
Note:
See TracChangeset
for help on using the changeset viewer.