Yes.
It's actually an app that uses postgres to store info and I'm using
Rebol to login and verify its config.

Thanks
John

-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Nenad Rakocevic
Sent: Wednesday, June 28, 2006 4:59 PM
To: [EMAIL PROTECTED]
Subject: [REBOL] Re: subquery in a loop


Try this :

sql: {
        select name, epid, active
        from v_ev_cus_prof
        where
                Active =3D 'true'
        and epid in (
                select epid
                from v_ev_cus_snmp_contact
                where snmp_host =3D '10.1.0.20'
        )
}

get-info: func [line][
        read rejoin [
                pgsql://xxxx:xxxx@
                trim/all line
                ":5555/mcdb?"
                sql
        ]
]

utilip: read/lines %/opt/nms/scripts/ip.txt

foreach line utilip [print get-info line]

;----------- end -----------

The only important modification here, is the addition of 'trim/all=20
function to clean up your 'line content read from file (may contain=20
blanks or other unwanted characters).

If you still getting an error in open-proto function, add this line at=20
the beginning of your script :

        trace/net on

Then publish here the output so we can analyze this deeper.

Btw, you really have so much Postgresql servers, each running on port=20
5555 (not the default pgsql port) ?

Regards,
--
DocKimbel


John Blake wrote:
> 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.
>=20
> utilip: read/lines %/opt/nms/scripts/ip.txt
> foreach line utilip [
>              print line
>              query: func [line] [read join
> pgsql://xxxx:[EMAIL PROTECTED]:5555/mcdb? "select name, epid, active from
> v_ev_cus_prof where Active =3D3D 'true' and epid in (select epid from
> v_ev_cus_snmp_contact where snmp_host =3D3D '10.1.0.20')"]
>             query line
>            print query
> ]
>=20
> The output is;
> connecting to: line
> ** Access Error: Cannot connect to line
> ** Where: open-proto
> ** Near: read join pgsql://xxxx:[EMAIL PROTECTED]:5555/mcdb? {select name,
epid,
> active from v_ev_cus_prof where Active =3D3D 'true'...
>=20
> So it's using "line" instead of the ip.
>=20
> The "print line" printouts the actual IP which is ok.
>=20
> Thoughts?
>=20
> John
>=20

--=20
To unsubscribe from the list, just send an email to=20
lists at rebol.com with unsubscribe as the subject.

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to