Re: [INTERFACES] Regarding selction of query - Mailing list pgsql-interfaces

From Constantin Teodorescu
Subject Re: [INTERFACES] Regarding selction of query
Date
Msg-id 37B1883A.47B6D51@flex.ro
Whole thread Raw
In response to Regarding selction of query  (SUMA R <suma.r@tatainfotech.com>)
List 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


pgsql-interfaces by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] libpgtcl and array fields return format - PROPOSAL
Next
From: Tom Lane
Date:
Subject: Re: [INTERFACES] libpgtcl and array fields return format - PROPOSAL