[ic] assign Query-Result-Row to Usertag
Peter
peter at pajamian.dhs.org
Thu Oct 22 23:18:46 UTC 2009
On 10/22/2009 07:50 AM, Ingo Buse wrote:
> Hi,
>
> i am having problems understanding the documentation, so maybe u guys may help me out with an example ?
>
> what I want is to forward a result-row of a [query] to my custom made UserTag. I did not really understood the wantarray/hashref stuff.
>
> the query in question also implements a more list and will simply select from products:
>
> [query type=list more=1 ml=10 sql="select * from products where ...."]
> [list]
> [/list]
> [more-list]
> [/more-list]
> [/query]
>
> Now I just want to forward the whole sql-result-row (each product) as hash or array to my UserTag maybe like this:
> [myusertag [item]]
>
> So I can refer to the position or the name of the column in the databases of that item.
>
> UserTag myusertag Routine <<EOR
> sub {
> my ($item, $opt) = @_;
> my $productname = $item->{name};
> my $price = $item->{price};
> ...
> my $description = $item->[3];
> }
>
> So if I extend the Database by a column, I can "automagically" refer to that column in my Usertag (if I do a "select *" offcourse).
>
> Is that possible ?
[sql-calc]$Tag->myusertag($Row)[/sql-calc]
Will work with all of the above except $item->[3].
Peter
More information about the interchange-users
mailing list