Recent

Author Topic: zeos + lazarus read committed (firebird)  (Read 3037 times)

3rdshiftcoder

  • New member
  • *
  • Posts: 24
zeos + lazarus read committed (firebird)
« on: September 26, 2015, 11:20:46 pm »
Hi-

can someone glance at this really quick if you use fb with zeos and lazarus?

I'd really like to use lazarus equivalent to isql-fb:
read committed with no record_version.

THX!

In isql-fb I have:

set transaction read write wait isolation level read committed no record_version

then I do an update and not commit it yet (auto-commit is not on)

in lazarus i use the zconnection with these properties and set to read committed:

isc_tpb_concurrency
isc_tpb_wait
isc_tpb_no_rec_version

I do the pending change in isql-fb first (it is an update).

then I set connected to false in zconnection and then put it to true and activate the zquery.

I get a no wait transaction error. I thought I told it to wait in two different clients.

not sure what I am missing.  it behaves as expected with 2 isql-fb clients.

also I have this code oncommit:

Code: [Select]
procedure TForm1.SaveChanges;
begin
// Saves edits done by user, if any.


  with ZConnection1 do
  begin
    if AutoCommit then
    begin
      StartTransaction;
    // Only if we are within a started transaction;
    // otherwise you get "Operation cannot be performed on an inactive dataset"
      try
      ZQuery1.ApplyUpdates; //Pass user-generated changes back to database...

      Commit; //... and commit them using the transaction.
      //SQLTransaction1.Active now is false
  except
     MessageDlg('Error', 'A database error has occurred. Technical error message: ' +
        'foo', mtError, [mbOK], 0);
     Rollback;
  end;
    Datasource1.DataSet.Refresh;
    end;
  end;
end;

procedure TForm1.ZConnection1Commit(Sender: TObject);
begin
  SaveChanges;
end;
                       


3rdshiftcoder

  • New member
  • *
  • Posts: 24
Re: zeos + lazarus read committed (firebird)
« Reply #1 on: September 27, 2015, 01:28:40 am »
Hi-

I am using firebird 2.5, zeosdbo 7.1.4, lazarus 1.4.2, linux fedora

thanks!

3rdshiftcoder

  • New member
  • *
  • Posts: 24
Re: zeos + lazarus read committed (firebird)
« Reply #2 on: September 27, 2015, 02:29:58 am »
Hi-

"In any isolation levels the locking conflict always occurs when two transactions try to edit the same able record."

http://www.devrace.com/en/fibplus/articles/3292.php

I am trying to edit the same record BUT what about when using:

set transaction read write wait isolation level record committed no record_version in isql.

it lets you either rollback or commit first client if second client has newer TID with no error message.

It is this exact same scenario that I can't reproduce in lazarus with firebird and ZEOS.  >:D

i am done fooling around tonight. At least I know about the quote above now for almost all scenarios.

thanks very much,
jim


3rdshiftcoder

  • New member
  • *
  • Posts: 24
Re: zeos + lazarus read committed (firebird)
« Reply #3 on: September 27, 2015, 09:05:23 pm »
Hi-

I think I figured out my problem!

I tried to specify just write instead of both READ AND WRITE in the zconnection properties.
the properties look like this:

this time I put in BOTH:

isc_tpb_read  AND isc_tpb_write. I had just isc_tpb_write and it didn't work.

sorry  :-[,
jim