Home > Back-end >  Delphi requirements are as follows: of all the data listed in the table data type, besides int, all
Delphi requirements are as follows: of all the data listed in the table data type, besides int, all

Time:10-08

//database data encryption Schema database Name, Name: in order to query the Name of the table
Procedure TOperationDM. DataOperations (Schema: String; Name: String);
Var
I, j, k: Integer;
StrSql, allSql: String;
Counts: Integer;
The list: TStringList;
StrType: Sting;

The begin
List:=TStringList. Create;
OperationADOCon. Close;
OperationADOCon. The ConnectionString:=TOper. ReadParamdb;
OperationADOCon. Open;
Try
With ADOQuery1 do
The begin
StrSql:='SELECT DATA_TYPE FROM information_schema. ` COLUMNS `'
+ 'WHERE TABLE_SCHEMA LIKE "' + Schema + '"'
'+' AND TABLE_NAME LIKE "+ Name + '"';

ADOQuery1. Close;
ADOQuery1. SQL. The Clear;
SQL. The Add (strSql);
ADOQuery1. Open;
Counts:=ADOQuery1. RecordCount;
If (counts & gt; 0) then
The begin
For I:=0 to do counts - 1
The begin
List. The Add (ADOQuery1 fieldbyName (' DATA_TYPE). AsString) are identical.
end;
For j:=0 to the list. Do the Count - 1
The begin
StrType:=list [j];
If (Trim (strType) & lt;> 'int') then//judgement, in addition to data type int all other types of data encryption
The begin
//the data type of the data is encrypted operation (the problem is how to obtain the corresponding value, please expert advice, I just contact the Delphi it has much higher step clear)

end;
end;
end;
end;
The finally
OperationADOCon. Close;
ADOQuery1. SQL. The Clear;
ADOQuery1. Close;
end;
end;

CodePudding user response:

Tears, please directly

CodePudding user response:

Since using ADO,
Directly use the TADOQuery to
SELECT the name of the table of all fields
In TField type and value,
Such As Fields [0]. DataType and Fields [0]. AsString (or As other types)
. You will find that the ADO Connection provides a lot of information related to the Schema,

CodePudding user response:

Thank you, I try, I can solve

CodePudding user response:

Below the part of the complete basic call encryption program, but to the data type, column name, to come out of the part of the query 10 data, but when I value, the program will keep the first repeat 10 times in the list, what reason, is so write, before I
For I:=0 to do counts - 1
The begin
List. The Add (ADOQuery1 fieldbyName (' DATA_TYPE). AsString + "=" + ADOQuery1. FieldbyName (' column_name). AsString) are identical.
end;

The counts is here I ADOQuery1. RecordCount value

CodePudding user response:

Encrypted storage, encryption method, a lot of custom rules with key, or use MD5 encryption method and so on have been mature case, as for the display when do you want to encrypt the demand, only encryption key fields, rather than what things are encrypted, tired not tired, do you have any need?
Repeat 10 times saved to the list? Didn't see you Next, move the pointer?

CodePudding user response:

Write the next is ok, I also just learning, also notice much time

CodePudding user response:

Master, ask you a question, for example, I now have a list, the list is the data in the '001', '003', '001', '005' how can I give the grouping list

CodePudding user response:

Or query the data in the list and then to write the grouping algorithm, either at the time of data query in the SQL group (this method is more convenient and quick), then inserted into the list

CodePudding user response:

write a case, not just the Delphi, a lot of places a bit around it to

CodePudding user response:

Use TStringList, it is a parameter Objects, you can put the content of the group after the second layer,

Such as you have such data:

'001', '000012'
'002', '000063'
'001', '000015'

You want to use the first Field to the group, which is

Under the '001' has a content of the List for '000012' and '000015'
Under the '002' has a content of the List for '000063'

That's so write:

1. 001, remove it within the List, insert '000012'
001, 2. Didn't find a new List, insert '000012' and '001' with inserted into the group List

Such as group a List called GList: TStringList;
Content List call List: TStringList;

The code above is

Str1:='001';
Str2:='000012';
.
Index:=GList IndexOf (Str1);
If Index>=0 then//found
TStringList (GList. Objects [Index]). The Add (Str2)
The else//didn't find
The begin
List:=TStringList. Create;
List. The Add (Str2);
GList. AddObject (Str1, a List);
end;

Don't know if this is the so-called group of you mean?
If not, please you speak understand the meaning of the group,

CodePudding user response:

I now this thing has been resolved, thank you!
There is a problem, that is, a list of data in the list {' 001=2 ', '002=3', '001=4', '003=6'}
In front of the equal sign is number, behind the equals sign is scoring, Delphi TStringList is written so to
I want to get a new list of list {' 001=6 ', '002=3', '003=6'}, which means that if the number of the scores, not equal to direct the new list is this one

CodePudding user response:

CodePudding user response:

Master, when you are infested, holy dragon head no tail

CodePudding user response:

There is no need to make a list of the list, do the action at a time before the cycle to judge your list is not to go, there are together, not inserted

CodePudding user response:

To write a small example out
  • Related