[REBOL] subquery in a loop
From: jblake:arsenaldigital at: 28-Jun-2006 14:29
Ok,
I've been hitting my head over this the past 2 days and I've finally
decided to go to the group.
I'm reading in a list of ip's from a file and need to sql to each of
those ip's.
I have it outputting the ips correctly but I can't get it to connect to
each one.
Its not using the "variable" of the ip.
I'm trying to use a function now.
utilip: read/lines %/opt/nms/scripts/ip.txt
foreach line utilip [
print line
query: func [line] [read join
pgsql://xxxx:xxxx-line:5555/mcdb? "select name, epid, active from
v_ev_cus_prof where Active = 'true' and epid in (select epid from
v_ev_cus_snmp_contact where snmp_host = '10.1.0.20')"]
query line
print query
]
The output is;
connecting to: line
** Access Error: Cannot connect to line
** Where: open-proto
** Near: read join pgsql://xxxx:xxx-line:5555/mcdb? {select name, epid,
active from v_ev_cus_prof where Active = 'true'...
So it's using "line" instead of the ip.
The "print line" printouts the actual IP which is ok.
Thoughts?
John