Re: [INTERFACES] Regarding selction of query

From: Constantin Teodorescu <teo(at)flex(dot)ro>
To: SUMA R <suma(dot)r(at)tatainfotech(dot)com>
Cc: pgsql-interfaces(at)postgreSQL(dot)org
Subject: Re: [INTERFACES] Regarding selction of query
Date: 1999-08-11 14:27:06
Message-ID: 37B1883A.47B6D51@flex.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

SUMA R wrote:
>
> Hi,
> In the pgtclsh shell iam able to connect to the database and exec the
> queries what i require, ex inserting, deleting etc.
>
> How can i use the pg_select? . for ex
>
> pg_exec connection "select * from emp"
>
> will get executed , but what will happen to the results of select.
>
> I want the result of the above query to a string.
> Iam new to this postgres

set dbc [pg_connect mydatabase]
pg_select $dbc "select name,age from people" rec {
puts "$rec(name) has $rec(age) years"
}
or
set pgres [pg_exec $dbc "insert into people(name,age) values('teo',36)"]
pg_result $pgres -clear

--
Constantin Teodorescu
FLEX Consulting Braila, ROMANIA

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 1999-08-11 14:46:18 Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL
Previous Message Bruce Momjian 1999-08-11 14:14:09 Re: [HACKERS] libpgtcl and array fields return format - PROPOSAL