[ic] Database access within an ActionMap

Mark Gibson interchange-users@icdevgroup.org
Mon Jan 27 05:02:00 2003


Hi,
	I'm having problems accessing the database within an ActionMap sub.

Previously I was running a query within a page using:

[perl tables="mytable"]

	my $db=$Db{mytable};

	my $ary = $db->query{'SELECT ...'};

	... do stuff with $ary ...

[/perl]

I've decided to move this functionality out of the page into an ActionMap -
which seem a much better/cleaner solution.

Only I can't seem to find a database handle,
$Db{mytable} doesn't return anything when used in an ActionMap!

I've tried the following, as suggested on the mailing list for DB access 
within a usertag, but it didn't work either:
my $db = ::database_exists_ref('products')

How can I get a handle on the database from within an ActionMap?

(Interchange 4.9.5, PostgreSQL 7.3, Perl 5.8.0)

Cheers
-- 
Mark Gibson <gibsonm@cromwell-tools.co.uk>
Web Developer
Cromwell Group Holdings Ltd