Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: m-grady at uiuc dot edu
Subject: Multiple connections with CTlib
Date: Feb 19 2000 8:14PM

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

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                  
Senior Research Programmer         
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