Page 1 of 1
how to use UniEncryptor
Posted: Wed 06 Mar 2013 04:12
by densan
I want to encrypt to DataBase field data with unidac & postgresDB.
UniEncryptor and UniQuery paste to Form.
set up UniEncryptor.password
UniQuery.Encryption = pasted UniEncryptor
I practice to :
UniConnection1.Open;
wk_sql := 'INSERT INTO aaa (a1,a2,a3) VALUES(1,''a'',''abc'');';
with uniQuery1 do
begin
Encryption.Fields:='a3';
SQL.Clear;
SQL.Add(wk_sql);
Execute;
Close;
end;
UniConnection1.Close;
postgres aaa table a1:integer,a2:charactor varing,a3:text
But not encrypt to a3 field
hoq use UniQuery.Encryption ?
show me sample (both to insert,select)?

Re: how to use UniEncryptor
Posted: Wed 06 Mar 2013 09:25
by AlexP
Hello,
Encryption is not applied on DML operations (INSERT, UPDATE), in which values are set in query text. In future, we will support encryption in such queries using parameters.
Currently, to use encryption, you should work with DataSet fields, i.e:
Code: Select all
UniConnection1.Open;
with uniQuery1 do
begin
SQL.Text := 'SELECT a1,a2,a3 FROM aaa';
Encryption.Fields:='a3';
Open;
Insert;
FieldByName('a1').AsInsteger := 1;
FieldByName('a2').AsString := 'a';
FieldByName('a3').AsString := 'abc';
Post;
Close;
end;
UniConnection1.Close;
Re: how to use UniEncryptor
Posted: Thu 07 Mar 2013 00:08
by densan
THANK YOU
It is useful because it can be encrypted in the same way as in a variety of common database

Re: how to use UniEncryptor
Posted: Thu 07 Mar 2013 13:35
by AlexP
Hello,
Glad to see that the problem was solved. If you have any other questions, feel free to contact us.
Re: how to use UniEncryptor
Posted: Sun 17 Mar 2013 23:58
by densan
A new problem has occurred
I do not go on a field that is encrypted, so I think that where and order by
Why can not where and order by for a field that is encrypted?
example:
select a3 from aaa where a3='def' → result 0 count
select a1 from aaa order by a3 → I will not order as expected
Re: how to use UniEncryptor
Posted: Mon 18 Mar 2013 10:26
by AlexP
Hello,
select a3 from aaa where a3='def' -> result 0 count
The WHERE condition is handled on the server, and since data is stored in a field being encrypted, this condition will always be False. To filter encrypted data, you can use a local filter, implemented by the Filter and Filtered properties.
select a1 from aaa order by a3 -> I will not order as expected
As well as the WHERE condition, the ORDER BY sorting is performed on the server side, and you will retrieve not the result you are expecting on encrypted fields. To sort such fields, you also need to use local sorting. For this, you should specify an appropriate field name in the IndexFieldNames property.
Re: how to use UniEncryptor
Posted: Mon 18 Mar 2013 23:54
by densan
All right.
Indexednames or filters that the local side,
I would do would not be used the index of Server DB Table?
Re: how to use UniEncryptor
Posted: Tue 19 Mar 2013 09:49
by AlexP
Hello,
As I wrote earlier, when using these properties and methods, sorting and filtering are performed locally, therefore indexes created in the table are not taken into account