[ic] Accessing $Db or $Sql in Jobs?

Ethan Rowe ethan at endpoint.com
Fri Jan 7 13:33:25 EST 2005

>>>>>>The $Db and $Sql objects aren't available at the global level.  You can
>>>>>>effectively access the $Db object for a particular table at the global
>>>>>>level, however, via:
>>>>>>my $dbh = database_exists_ref( $tablename );
>>>>>>$dbh = $dbh->ref();
>>>>>>From there, $dbh gives you access to functions like query().
For the record, to get access to the equivalent of $Sql at the global level:

my $db = ::database_exists_ref( $some_tablename )
    or die("Couldn't get a handle to the table '$some_tablename'!");

my $dbh = $db->dbh();

Then you can use the grand DBI functions like
my $sth = $dbh->prepare( "SELECT something FROM somewhere WHERE somehow 
= ?" );

At least, that's what a code read of the SQL_Ledger perl module suggests...

Ethan Rowe
End Point Corporation
ethan at endpoint.com

More information about the interchange-users mailing list