[ic] SQL Statements within Usertags
Stefan Hornburg
interchange-users@icdevgroup.org
Thu Jan 16 08:13:00 2003
On Thu, 16 Jan 2003 12:56:24 +0000
Rich Doughty <rich@opusvl.com> wrote:
> On 16 Jan 2003, Stefan Hornburg wrote:
> > On Thu, 16 Jan 2003 12:29:03 +0000
> > Rich Doughty <rich@opusvl.com> wrote:
> >
> > > On 16 Jan 2003, Stefan Hornburg wrote:
> > > > On Thu, 16 Jan 2003 09:52:35 +0000
> > > > Rich Doughty <rich@opusvl.com> wrote:
> > > >
> > > > > whats the "recommended" way of executing SQL within a usertag? I've been
> > > > > using $Tag->sql (...), but is there any way of accessing the DB connection
> > > > > object for example, and avoiding the $Tag->sql (...) overhead?
> > > >
> > > > I often use the following technique:
> > > >
> > > > [perl tables=foo]
> > > > $set = $Db{foo}->query('select question,answer from foo');
> > > > for (@$set) {
> > > > ($question, $answer) = @$_;
> > > > ...
> > > > }
> > > > [/perl]
> > > >
> > >
> > > cheers.
> > >
> > > were using mysql exclusively, so can the table name be arbitrary, or does it
> > > have to be one of the explicitly registered tables (products, userdb - in
> > > our case)?
> >
> > To my knowledge, any query in the example above would work in your case, regardless of
> > the tables= and $Db parameter.
>
> I'm getting an error $Db {products} undefined.
> keys (%Db) returns empty, although %Db *is* defined.
Please post your erroneous code.
Bye
Racke