[ic] Getting database handle in UserTag

Carl Bailey carl at triangleresearch.com
Fri Jul 21 13:57:43 EDT 2006

Quoting Mike Heins:

> In a global UserTag, it is:
> 	my $db = dbref('products')
> 		or die "no products table";
> 	my $dbh = $db->dbh()
> 		or die "not a DBI table";
> In a catalog UserTag, there is no reliable way to do it
> because of Safe restrictions.

We have successfully used the following in catalog UserTags:

     my $db  = Vend::Data::database_exists_ref('products')
        or return sprintf("Table %s is not available", 'products');
     my $dbh = $db->dbh();

It may not be "proper" but it has worked successfully for years, which 
has been reliable enough for our purposes.

Carl Bailey
Triangle Research, Inc.
tel: +1.919.401.6588

More information about the interchange-users mailing list