| Jeff Abrahamson on 5 Aug 2004 14:25:03 -0000 |
|
On Thu, Aug 05, 2004 at 10:00:14AM -0400, Phil Lawrence wrote:
> So... that led me to use a URI like this:
> .../package_name.proc_name?x=A%2CB%2CC&x=1&x=2
>
> obviously resulting in the array: ('A,B,C', 1, 2)
If you have a hash
('A' => 1, 'B'=>2, 'C' => 3)
you could use a function like the following (untested)
sub hash_to_plsql {
my $href = $_;
my %h = %{$href};
my $s = "?x=";
for my $key (keys %hash) {
$s .= "$key%2C";
}
# remove final %2C, could be more elegant
chop($s);chop($s);chop($s);
for my $key (keys %hash) {
my $val = $h{$key};
$s .= "&x=$val";
}
return $s;
}
If you're talking sql, composing the string is surely not the limiting
factor in how fast your program runs or the resources it uses.
--
Jeff
Jeff Abrahamson <http://www.purple.com/jeff/> 215/837-2287
GPG fingerprint: 1A1A BA95 D082 A558 A276 63C6 16BF 8C4C 0D1D AE4B
A cool book of games, highly worth checking out:
http://www.amazon.com/exec/obidos/ASIN/1931686963/purple-20
Attachment:
signature.asc
|
|