[ic] Query Tag - how do I get a single value?

Mark Gibson interchange-users@icdevgroup.org
Tue Nov 19 09:57:00 2002


Hi,
	I'm using PostgreSQL 7.2.3 with Interchange 4.8.6.
I've written some custom functions for the database server, and I know
they work within 'psql' and via DBI/DBD::Pg ok.

The functions return a single integer value,
so when I do:

	$Tag->query("SELECT custom_function('$body')");

I would like to get back a single scalar value from this call,
but I can't work out how to do it. I've only just started to learn
Perl, and have worked out I can do it with DBI as follows:

	my ($result) = $dbh->selectrow_array(...)

But how do I do this with $Tag->query(), the documentation
for [query] is quite confusing, and lacks examples of this type.

Alternatively, can I use DBI directly within a UserTag?
I've tried this, but get told some commands are unsafe.
ie. my $dbh = DBI->connect(...)

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