[ic] assign Query-Result-Row to Usertag

Rick Bragg lists at gmnet.net
Thu Oct 22 18:41:05 UTC 2009

On Thu, 2009-10-22 at 16:50 +0200, 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 ?
> --
> Ingo

That could be a bit dangerous.  For example somebody adds a blob field
to the table for large binary files... I think it's always best to
always SELECT only, what, you, need FROM tables.

This message has been scanned for viruses and
dangerous content by Green Mountain Network, and is
believed to be clean.

More information about the interchange-users mailing list