Hi All,

Wrote in august to the support list but no answer:

https://groups.yahoo.com/neo/groups/firebird-support/conversations/topics/129585

So, I want to try the new API (looks more easier to use than the old) but got an exception with the TPB:

invalid format for transaction parameter block
-wrong version of transaction parameter block

See the attached example. No exception if build and pass the TPB in an "array of Byte" (see in the commented out code).

What I am doing wrong with IXpbBuilder?

Gabor
program FB3_OOAPI_TPB;

{$IFDEF FPC}
  {$MODE DELPHI}
{$ENDIF}

uses Firebird;

var
  master:IMaster;
  dispatcher:IProvider;
  attachment:IAttachment;
  status:IStatus;
  transaction_rw:ITransaction;
  util:Firebird.IUtil;
  s:ansistring;
  tpb:IXpbBuilder;
//  TPB:array of Byte;
  DPB:IXpbBuilder;

begin
  try
    master:=fb_get_master_interface;
    dispatcher:=master.getDispatcher;
    status:=master.getStatus;
    util:=master.getUtilInterface;

    DPB:=util.getXpbBuilder(status,IXpbBuilder.DPB,nil,0);
    DPB.insertString(status,isc_dpb_user_name,'SYSDBA');
    DPB.insertString(status,isc_dpb_password,'masterkey');
    attachment:=dispatcher.attachDatabase(status,'employee',DPB.getBufferLength(status),DPB.getBuffer(status));

    tpb:=util.getXpbBuilder(status,IXpbBuilder.TPB,nil,0);
    tpb.insertTag(status,isc_tpb_version3);
    tpb.insertTag(status,isc_tpb_read_committed);
    tpb.insertTag(status,isc_tpb_no_rec_version);
    tpb.insertTag(status,isc_tpb_wait);
    tpb.insertTag(status,isc_tpb_write);
    transaction_rw:=attachment.startTransaction(status,tpb.getBufferLength(status),tpb.getBuffer(status));

(*
    SetLength(TPB, 5);
    TPB[0]:=isc_tpb_version3;
    TPB[1]:=isc_tpb_read_committed;
    TPB[2]:=isc_tpb_no_rec_version;
    TPB[3]:=isc_tpb_wait;
    TPB[4]:=isc_tpb_write;
    transaction_rw:=attachment.startTransaction(status,Length(TPB),@TPB[0]);
*)

  except
   on e:FbException do
    begin
      SetLength(s,2000);
      SetLength(s,util.formatStatus(PAnsiChar(s),2000,e.getStatus));
      WriteLn('Exception: ',AnsiString(s));
   end;
  end;
end.
------------------------------------------------------------------------------
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to