[ic] Tag->query in a usertag

Ron Phipps interchange-users@interchange.redhat.com
Fri Apr 19 02:47:00 2002


> From: interchange-users-admin@interchange.redhat.com
[mailto:interchange-
> users-admin@interchange.redhat.com] On Behalf Of Kyle Cook
> 
> At 05:01 PM 4/18/02, you wrote:
> >I'm attempting to write a routine that will return a list of quantity
> >break fields that contain data.  I have the following code that works
> >correctly in a [perl] section, but will not function correctly in a
> >usertag.  The query tag is supposed to return a reference to an array
of
> >hash references.  I have tested that this indeed works in a [perl]
> >section.
> 
> 
> <SNIP>
> 
> Ron,
> 
> Here is how I'd access the sql via a usertag:
> 
> 
> my $db = Vend::Data::database_exists_ref('pricing');
> my $dbh = $db->[$Vend::Table::DBI::DBI];
> my $sql = "SELECT " . $available_breaks .
>          " FROM pricing WHERE sku ='" . $code . "';";
> my $sth = $dbh->prepare($sql);
> $sth->execute();
> if ($sth) {
>          my $sql_results = $sth->fetchrow_hashref();
> }
> else {
>          # No results! may wish to log error
>          # and send back some default.
> }
> 
> 

Thanks for the example Kyle, I'll give this a try and hopefully get
further then before.  I'm still wondering why the Tag->query does not
work in the usertag, but perhaps that's for another day.

Take it easy,
-Ron