|Subject||Re: [firebird-support] Locking records in stored procs|
On Fri, 12 Nov 2004 22:08:27 +1100, Helen Borrie <helebor@...> wrote:
> At 09:09 AM 12/11/2004 +0100, I wrote:
> > > You'll have to be a bit more explicit about what you are doing in the SP.
> > >
> You replied
> > As I've said before, the Delphi application works with DB2 on an
> >AS400. The idea is to try to emulate as much as I can the DB2 portion
> >with Firebird, so future releases of the application only need
> >recompiling against different libraries to work with DB2 or Firebird.
> OK, this is usually a gamble. No two DBMSs implement SPs the same
> way. DB2 imitates Oracle to a degree, so you can make DB2 SPs work quite
> like Oracle's.
> >The original application has a stored procedure that reads a record
> >and locks it. Then this record is procesed by the application and the
> >results of the process are saved again in the record using another
> >stored procedure, unlocking the record. It's important that no other
> >user reads the record and begins processing it until the first user
> >ends his work.
> I assume then that your SP processes one single record. That was one
> purpose of my question. It is a different story if you have a SP that is
> processing multiple records. But what you are telling us here is still far
> too vague. Does the first SP do anything else except this locking?
Searchs thru a table based on the parameters, finds the record (only
one), locks it and returns his contents.
> > I want to emulate this behaviour without writing Delphi code, simply
> >writing an equivalent stored procedure, to get the same code working
> >with DB2 and Firebird.
> I don't understand this. According to your description, the client calls
> one stored procedure, does some work, and then calls another stored
> procedure. You need Delphi code to call stored procedures.
Yes. But all the callings to SP in the application are done through a
library (a custom VCL component). When we use DB2 we link against a
version of the library and when we use FireBird we link against
another version of the library. So all the code of the main
application (the one that I don't want to change) remains the same.