[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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
suppressed

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.