|
|
sybperl-l Archive
Up Prev Next
From: Rob Fenstermacher <fence at bwn dot net>
Subject: RE: Multiple connections with CTlib
Date: Feb 19 2000 9:58PM
yes, just open two (or more) connections. You can re-use the second connection as many times as you like.
have a good one
Robert
----------
From: m-grady@uiuc.edu[SMTP:m-grady@uiuc.edu]
Reply To: SYBPERL-L@list.cren.net
Sent: Saturday, February 19, 2000 1:14 PM
To: SybPerl Discussion List
Subject: Multiple connections with CTlib
I'm writing a program that will keep an LDAP database synchronized with
a Sybase registry database. I'll be looking for anything that has changed
since a given timestamp, and generating LDIF statements to update the LDAP
database based on that.
So one thing I'll need to handle is that a person has multiple different
address fields, and there is another field which specifies which of those
address fields is the 'preferred address' for that given person. The LDAP
database will track each of the address fields, but also stash the preferred
address in the standard LDAP attribute for address.
So if I open a connection to Sybase and query for all changes (against an
audit table of some kind), I'll get back a set of results, and I'll probably
want to process them as they come (rather than retrieving all into memory).
If the audit trail shows that address2 for a person changed, I also have
to know if the 'preferred address' is address2, and generate an additional
update to the LDAP preferred address attribute. So, while processing the
result set from one query, I need to go out and do another query. (Unlees
I separately note all these additional queries I'll need to make, and then
go and do them only after I've finished processing the audit trail result
set.)
So, with CTlib, how do I do this? Do I just use the ct_connect call a
second time ($dbh2 = new etc.)? And I assume the best thing to do is go
ahead and open this connection from the start, and just re-use this connection
for each additional query I need to make while processing the result set of
the other connection?
--
Michael A. Grady m-grady@uiuc.edu
Senior Research Programmer http://ljordal.cso.uiuc.edu
University of Illinois (217) 244-1253 phone
Computing & Communications Services Office (217) 244-7089 fax
Rm. 1514 DCL, 1304 W. Springfield Ave Urbana, IL 61801
|