Page 1 of 1

[solved] Unable to use ZeosLib with multiple connections

Posted: 14.08.2012, 12:27
by Sorien
When i try to query for data changed during another connection, zeos components will not return correct data

steps to reproduce problem:

#1, 1st connection calls query like
SELECT DISTINCT(data) FROM test_table

and result is 1, 2, 3, 4, 5

Code: Select all

query:= TZReadOnlyQuery.Create(nil);
query.Connection := ZConnection1;
query.SQL.Text:= 'SELECT DISTINCT(data) FROM test_table';
query.Open;

while not query.Eof do begin
  Memo1.Lines.Add(query.Fields[0].AsString);
  query.Next;
end;

query.Close;
#2, 2nd connection/external editor updates data to 1, 9, 3, 4, 5

#3, when i execute first query(code block) again from 1st connection it will return 1, 2, 3, 4, 5 instead of 1, 9, 3, 4, 5 query will not return fresh data but cached.

tested with mysql and firebird connections using egonhugeist branch revision 1338 and 1645, old DBX components don't have this problem

Posted: 15.08.2012, 09:43
by marsupilami
Hello Sorien,

which transaction isolation level did you set in the first connection component? I tried this with Firebird 2.1 and a transaction isolation of tiReadCommitted and things worked as expected.
Best regards,

Jan

Posted: 15.08.2012, 09:53
by EgonHugeist
Sorien,

i answered your pm. i think Jan is right here.. IF the external editor OR Zeos(no AutoCommit) using "sessions" then it is impossible to see the changes between the two apps.

Michael

Posted: 15.08.2012, 10:39
by Sorien
its working, ty guys