Subject | Re: [ib-support] Re: building a mini-IBReplicator |
---|---|
Author | Helen Borrie |
Post date | 2003-04-05T12:59:02Z |
At 10:38 AM 5/04/2003 +0000, you wrote:
Assume you have a SP in the target database, with input parameters parm1,
parm2, parm3. This SP takes these parameters, massages them and inserts
rows into various target tables...
You have two separate database connections: one to the source DB, one to
the target DB. You have a transaction: hook it up to both connections
(ib_connection and ib_connection1).
Start this transaction
Open a query on the source database:
select blah1, blah2, blah3 from sourcetable
prepare the SP on the target database in a statement object (ib_dsql)
starting at the first row of the query:
take the values blah1, blah2 and blah3 and pass them to the input
parameters of the SP
execute the SP
go to the next row of the query
After the last row of the query, commit the work.
That's it.
cheers
heLen
> > I know you are using IBO, so why not run a multi-database<mopping the tears from my eyes>
> > transaction?
>
>gulp
>
>Is this possible ?
>
>I didn't know it...
>This would be a smart solution...Erm, not what I described.
>
> > Create an SP on the target database to receive parameters
> > which are passed to it, via a prepared executable statement in your
> > application, from a query on the source database.
>
>something like
>
>//update
>
>start transaction
>try
> update table 1 of database A with <data>
> update table 2 of database B with <data>
> commit;
>except
> rollback
>end;
Assume you have a SP in the target database, with input parameters parm1,
parm2, parm3. This SP takes these parameters, massages them and inserts
rows into various target tables...
You have two separate database connections: one to the source DB, one to
the target DB. You have a transaction: hook it up to both connections
(ib_connection and ib_connection1).
Start this transaction
Open a query on the source database:
select blah1, blah2, blah3 from sourcetable
prepare the SP on the target database in a statement object (ib_dsql)
starting at the first row of the query:
take the values blah1, blah2 and blah3 and pass them to the input
parameters of the SP
execute the SP
go to the next row of the query
After the last row of the query, commit the work.
That's it.
> > You can also automate this in a variety of ways, using theIn the IBO4 distribution...helpfile is on the website.
>replication components in IBO...
>
>again I never heard of these components.
cheers
heLen