Skip to content

Commit 11f2cf3

Browse files
committed
* Remoção de mais Hints e Warnings
1 parent 17b0d90 commit 11f2cf3

2 files changed

Lines changed: 36 additions & 22 deletions

File tree

config/Config.SQLite.FireDAC.pas

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ interface
1111
{$ENDIF}
1212

1313
uses
14+
System.JSON, System.SysUtils, System.Generics.Collections,
15+
Data.DB,
1416
{$IF CompilerVersion > 33.0}
1517
FireDAC.Phys.SQLiteWrapper.Stat, FireDAC.Stan.ExprFuncs,
1618
FireDAC.Phys.SQLiteDef, FireDAC.Stan.Intf, FireDAC.Phys, FireDAC.Phys.SQLite,
19+
FireDAC.Stan.Param,
1720
{$IFEND}
1821
{$IFDEF Android}
1922
System.IOUtils,
2023
{$ENDIF}
21-
FireDAC.Comp.Client, System.JSON, System.SysUtils
24+
FireDAC.Comp.Client
2225

2326
{$IFDEF HAS_FMX}
2427
, FMX.Forms, FMX.Edit, FMX.ComboEdit, FMX.StdCtrls, FMX.ExtCtrls,
@@ -114,7 +117,7 @@ function TSQLiteConfig.getValue(pKey: string): string;
114117
SQL.Add('SELECT CFG_Value');
115118
SQL.Add(' FROM Config');
116119
SQL.Add(' WHERE CFG_Key = :CFG_Key');
117-
ParamByName('CFG_Key').Value := pKey;
120+
ParamByName('CFG_Key').AsString := pKey;
118121
Open;
119122
Result := Fields.Fields[0].AsString;
120123
Close;
@@ -142,7 +145,10 @@ function TSQLiteConfig.LoadConfig: TJSONObject;
142145

143146
procedure TSQLiteConfig.LoadForm(aForm: TForm);
144147
var
145-
I, J: integer;
148+
{$IFNDEF HAS_FMX}
149+
J: integer;
150+
{$ENDIF}
151+
I: integer;
146152
JSONTela: TJSONObject;
147153
begin
148154
JSONTela := LoadConfig;
@@ -186,7 +192,10 @@ procedure TSQLiteConfig.LoadForm(aForm: TForm);
186192

187193
procedure TSQLiteConfig.SaveForm(aForm: TForm);
188194
var
189-
I, J: integer;
195+
{$IFNDEF HAS_FMX}
196+
J: integer;
197+
{$ENDIF}
198+
I: integer;
190199
JSONTela: TJSONObject;
191200
begin
192201
JSONTela := TJSONObject.Create;
@@ -231,7 +240,6 @@ procedure TSQLiteConfig.SaveForm(aForm: TForm);
231240

232241
procedure TSQLiteConfig.UpdateConfig(aJSON: TJSONObject);
233242
var
234-
JSONVal: TJSONValue;
235243
I: integer;
236244
begin
237245
// exemplo entrada
@@ -246,13 +254,13 @@ procedure TSQLiteConfig.UpdateConfig(aJSON: TJSONObject);
246254
SQL.Add('SELECT CFG_Key, CFG_Value');
247255
SQL.Add(' FROM Config');
248256
SQL.Add(' WHERE CFG_Key = :CFG_Key');
249-
ParamByName('CFG_Key').Value := aJSON.Pairs[I].JsonString.ToString.Replace
257+
ParamByName('CFG_Key').AsString := aJSON.Pairs[I].JsonString.ToString.Replace
250258
('"', '', [rfReplaceAll]);
251259
Open;
252260
Edit;
253-
Fields.Fields[0].Value := aJSON.Pairs[I].JsonString.ToString.Replace('"',
261+
Fields.Fields[0].AsString := aJSON.Pairs[I].JsonString.ToString.Replace('"',
254262
'', [rfReplaceAll]);
255-
Fields.Fields[1].Value := aJSON.Pairs[I].JsonValue.ToString.Replace('"',
263+
Fields.Fields[1].AsString := aJSON.Pairs[I].JsonValue.ToString.Replace('"',
256264
'', [rfReplaceAll]);
257265
Post;
258266
if FDataSet.CachedUpdates then
@@ -270,11 +278,11 @@ procedure TSQLiteConfig.UpdateConfig(aKey, aValue: string);
270278
SQL.Add('SELECT CFG_Key, CFG_Value');
271279
SQL.Add(' FROM Config');
272280
SQL.Add(' WHERE CFG_Key = :CFG_Key');
273-
ParamByName('CFG_Key').Value := aKey;
281+
ParamByName('CFG_Key').AsString := aKey;
274282
Open;
275283
Edit;
276-
Fields.Fields[0].Value := aKey;
277-
Fields.Fields[1].Value := aValue;
284+
Fields.Fields[0].AsString := aKey;
285+
Fields.Fields[1].AsString := aValue;
278286
Post;
279287
if FDataSet.CachedUpdates then
280288
ApplyUpdates;

config/Config.SQLite.Zeos.pas

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ interface
1414
{$IFDEF Android}
1515
System.IOUtils,
1616
{$ENDIF}
17-
System.JSON, System.SysUtils,
17+
System.JSON, System.SysUtils, System.Generics.Collections,
18+
Data.DB,
1819
ZConnection, ZDataSet
1920

2021
{$IFDEF HAS_FMX}
@@ -98,7 +99,7 @@ function TSQLiteConfig.getValue(pKey: string): string;
9899
SQL.Add('SELECT CFG_Value');
99100
SQL.Add(' FROM Config');
100101
SQL.Add(' WHERE CFG_Key = :CFG_Key');
101-
ParamByName('CFG_Key').Value := pKey;
102+
ParamByName('CFG_Key').AsString := pKey;
102103
Open;
103104
Result := Fields.Fields[0].AsString;
104105
Close;
@@ -129,7 +130,10 @@ function TSQLiteConfig.LoadConfig: TJSONObject;
129130

130131
procedure TSQLiteConfig.LoadForm(aForm: TForm);
131132
var
132-
I, J: integer;
133+
{$IFNDEF HAS_FMX}
134+
J: integer;
135+
{$ENDIF}
136+
I: integer;
133137
JSONTela: TJSONObject;
134138
begin
135139
JSONTela := LoadConfig;
@@ -173,7 +177,10 @@ procedure TSQLiteConfig.LoadForm(aForm: TForm);
173177

174178
procedure TSQLiteConfig.SaveForm(aForm: TForm);
175179
var
176-
I, J: integer;
180+
{$IFNDEF HAS_FMX}
181+
J: integer;
182+
{$ENDIF}
183+
I: integer;
177184
JSONTela: TJSONObject;
178185
begin
179186
JSONTela := TJSONObject.Create;
@@ -218,7 +225,6 @@ procedure TSQLiteConfig.SaveForm(aForm: TForm);
218225

219226
procedure TSQLiteConfig.UpdateConfig(aJSON: TJSONObject);
220227
var
221-
JSONVal: TJSONValue;
222228
I: integer;
223229
begin
224230
// exemplo entrada
@@ -233,13 +239,13 @@ procedure TSQLiteConfig.UpdateConfig(aJSON: TJSONObject);
233239
SQL.Add('SELECT CFG_Key, CFG_Value');
234240
SQL.Add(' FROM Config');
235241
SQL.Add(' WHERE CFG_Key = :CFG_Key');
236-
ParamByName('CFG_Key').Value := aJSON.Pairs[I].JsonString.ToString.Replace
242+
ParamByName('CFG_Key').AsString := aJSON.Pairs[I].JsonString.ToString.Replace
237243
('"', '', [rfReplaceAll]);
238244
Open;
239245
Edit;
240-
Fields.Fields[0].Value := aJSON.Pairs[I].JsonString.ToString.Replace('"',
246+
Fields.Fields[0].AsString := aJSON.Pairs[I].JsonString.ToString.Replace('"',
241247
'', [rfReplaceAll]);
242-
Fields.Fields[1].Value := aJSON.Pairs[I].JsonValue.ToString.Replace('"',
248+
Fields.Fields[1].AsString := aJSON.Pairs[I].JsonValue.ToString.Replace('"',
243249
'', [rfReplaceAll]);
244250
Post;
245251
if FDataSet.CachedUpdates then
@@ -257,11 +263,11 @@ procedure TSQLiteConfig.UpdateConfig(aKey, aValue: string);
257263
SQL.Add('SELECT CFG_Key, CFG_Value');
258264
SQL.Add(' FROM Config');
259265
SQL.Add(' WHERE CFG_Key = :CFG_Key');
260-
ParamByName('CFG_Key').Value := aKey;
266+
ParamByName('CFG_Key').AsString := aKey;
261267
Open;
262268
Edit;
263-
Fields.Fields[0].Value := aKey;
264-
Fields.Fields[1].Value := aValue;
269+
Fields.Fields[0].AsString := aKey;
270+
Fields.Fields[1].AsString := aValue;
265271
Post;
266272
if FDataSet.CachedUpdates then
267273
ApplyUpdates;

0 commit comments

Comments
 (0)