<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <title>
      myOffice Email Message
    </title>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <meta name="date" content="2002-11-01">
  <style type="text/css">
  </style>
  </head>
  <body>
    <span style=
      "color:#FF0000 "><b><span style=
      "font-family:MS Sans Serif ">[Reply]</span></b></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">HI Phil, et al ..</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">The main point is that the IB/Firebird generator mechanism does not function inside a transaction.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">The best way to hanlde it is to give yourself a bet both ways.</span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "color:#000000 ">Use a trigger like this, so that if you specify a pk value, it is supplied, otherwise one is created.</span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">create trigger trMYTABLE for MYTABLE </span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">active before insert position 0</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">as begin</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">if (new.id is null) then new.id=gen_id(genANY,1);</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">end;</span></span></span>
    <p>
      <span style=
      "color:#000000 "><span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; ">and in code I have a library routine(s) to get the generator value.</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">function GetNewID : integer;</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">begin</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">  with TIBQuery.create(nil) do try</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">   .. // connect to database etc</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">    sql.add('select gen_id(genANY,1) newid from rdb$database');</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">    open;</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">    result:=fieldbyname('newid').asInteger;</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">    finally</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">      free; </span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">    end;</span></span></span>
    <p>
      <span style=
      "color:#000080 "><span style=
      "font-family:Courier,monospace "><span style=
      "font-size:9pt; ">end;</span></span></span>
    <p>
      <span style=
      "color:#000000 "><span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; ">For those interested, the above query references the rdb$database table, a system table with ever only one record. This is done to satisfy the SQL92 query syntax when accessing the gen_id function - a built in IB/Firebird (only) function.</span></span></span>
    <p>
      <span style=
      "color:#000000 "><span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; ">HTH</span></span></span>
    <p>
      <span style=
      "color:#000000 "><span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; ">Gary</span></span></span>
    <p>
      <span style=
      "color:#000000 "><span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; ">A</span></span></span><span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#FF0000 "><b>t 11:26 on 14/01/2005 you wrote </b></span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;To  : delphi@ns3.123.co.nz</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;CC  : </span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;From: Phil Middlemiss, phil@tumonz.co.nz</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Content Type: text/plain</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Attached: </span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Thanks to all who replied. In the end I did the inevitable (Johns</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;suggestion) and now fetch a new ID first and include it in the INSERT</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;operation rather than have the trigger.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Phil.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;----- Original Message ----- </span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;From: "Steve Aish" &lt;Steve.Aish@twoa.ac.nz&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;To: &lt;delphi@ns3.123.co.nz&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Sent: Friday, January 14, 2005 10:55 AM</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Subject: Re: [DUG] concurrent Interbase Transactions</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; The way I handle this is to insert the record and then immediately do a</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; search for the record I just inserted.  This will give you the value</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; just inserted.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; e.g.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; insert into debtor_trans (accountnumber, amount, transdate, ...)</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; trigger fires and fills in the unique seq_no</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; select max(seq_no) from debtor_trans where accountnumber =</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; accountnumber and amount = amount and  transdate ...</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; this will return the seq_no from the record you just inserted.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; I don't know if this is the best or most efficient way of doing this</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; but it has always worked for me.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; Steve</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; &gt;&gt;&gt; phil@tumonz.co.nz 14/01/2005 10:16:37 a.m. &gt;&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; MessageI was kind of hoping to avoid that, but it's not a biggie.  Is</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; there no way to fetch the record that has just been added within a</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; transaction?</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; Cheers,</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; Phil.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   ----- Original Message ----- </span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   From: JC</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   To: 'NZ Borland Developers Group - Delphi List'</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   Sent: Friday, January 14, 2005 9:27 AM</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   Subject: RE: [DUG] concurrent Interbase Transactions</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   Hi Phil</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   It might be safer to have the generator giving you a new unique</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; number (on request, not in a trigger) and to use and insert that with</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; the data in the ExeQuery.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   As you indicated, when implemented in a trigger then your fetch, to</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; get this value, may come too late and you end up with somebody else's</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; number.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   Cheers,</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   John</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     -----Original Message-----</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     From: delphi-bounces@ns3.123.co.nz</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; [mailto:delphi-bounces@ns3.123.co.nz] On Behalf Of Phil Middlemiss</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Sent: Friday, 14 January 2005 8:42 a.m.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     To: NZ Borland Developers Group - Delphi List</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Subject: [DUG] concurrent Interbase Transactions</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Hi everyone - hope you all had a good break. Looks like summer has</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; finally arrived (now that everyone's back at work)! Anyway...</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     I'm using Firebird (and transactions) for the first time. I'm</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; connecting to a remote database via the Firebird Server with no</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; problems, but I have a question about transactions:</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     When I insert a new record, I use a trigger and a generator to</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; generate a new unique ID for the new record - I also query the generator</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; to see what the new value is that was returned by the trigger. The code</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; snippet is as follows:</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;         orderTransaction.Active := True;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;         with orderQuery do //insert the record</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;           begin</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;           ExecQuery;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;           with IBCurrentGeneratorValueQuery do // this query fetches</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; the current value of the generator</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             try</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             Transaction := orderTransaction;  // share the same</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; transaction as the order</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             Open;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             result:=FieldByName('newID').asInteger; // get the</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; generator value</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             except</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             result:=-1;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;             end;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;           orderTransaction.Commit;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;           end;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     The question is, if multiple clients access the database server at</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; the same time, will IBCurrentGeneratorValueQuery still return the</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; correct value, or if another concurrent transaction on another thread</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; increments the generator, will this query return the wrong value?</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     When I was using MySQL (with PHP) I could use mysql_insert_id() to</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; query the new key value. I guess that if I could get hold of the newly</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; inserted row I could just get the field value, but the same concurrency</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; issue applies and I'm not sure how to get the record I just inserted.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Cheers,</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Phil.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     ---</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Incoming mail is certified Virus Free.</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Checked by AVG anti-virus system (http://www.grisoft.com).</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;     Version: 6.0.832 / Virus Database: 566 - Release Date: 10/01/2005</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; --------------------------------------------------------------------------</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;----</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   _______________________________________________</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   Delphi mailing list</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   Delphi@ns3.123.co.nz</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;   http://ns3.123.co.nz/mailman/listinfo/delphi</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; _______________________________________________</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; Delphi mailing list</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; Delphi@ns3.123.co.nz</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt; http://ns3.123.co.nz/mailman/listinfo/delphi</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;_______________________________________________</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Delphi mailing list</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;Delphi@ns3.123.co.nz</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;http://ns3.123.co.nz/mailman/listinfo/delphi</span></span></span>
    <p>
      <span style=
      "font-family:MS Sans Serif "><span style=
      "font-size:10pt; "><span style=
      "color:#008000 ">&gt;</span></span></span><p>
  <font face=arial size = 1 color = Navy><DIV style="WIDTH: 260px; HEIGHT: 50px"><MARQUEE id=marquee1 style="WIDTH: 260px; HEIGHT: 200px" trueSpeed scrollAmount=5 scrollDelay=20 direction=right behavior=slide loop=1 border="2"><hr><table><tr><td><FONT color=black size=4 face = "helvetica,verdana,arial">Gary Benner </FONT></td></tr><tr><td><FONT face="arial, arial, helvetica, sans-serif" color=black size=2>e-Engineer, Lecturer, and Software Developer</FONT></td></tr><br>
<tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=#000099 size=2><B><A HREF="http://www.123.co.nz" style="text-decoration:none; color:blue">123 Internet Limited</A></B></FONT></td></tr><tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=#000099 size=2><B><A HREF="http://www.waiariki.ac.nz" style="text-decoration:none; color:#993333">Waiariki Institute of Technology</A></B></FONT></td></tr><tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=#CECE00 size=2><B><A HREF="http://www.sunshinebags.co.nz" style="text-decoration:none; color:#CECE00">Sunshine Garden Bag Co.</A></B></FONT></td></tr><tr><td bgcolor=><FONT face="arial, arial, helvetica, sans-serif" color=red size=2><B><A HREF="http://www.sommnet.com" style="text-decoration:none; color:red" >Sommnet.com Limited</A></B></FONT></td></tr><tr><td><font face = "helvetica,verdana,arial" size = 1>Mob: 021 966 992</font></td></tr><tr><td><font face = "helvetica,verdana,arial" size = 1>Email: <A href="mailto:gary@123.co.nz" >gary@123.co.nz</A> </font></td></tr></table></MARQUEE></DIV><br>
<br>
Ref#: 41006<br>
<br>
</body>
</html>