pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Constantin Teodorescu <teo@flex.ro>
To: SUMA R <suma.r@tatainfotech.com>
Cc: pgsql-interfaces@postgreSQL.org
Subject: Re: [INTERFACES] Regarding selction of query
Date: Wed, 11 Aug 1999 14:27:06 +0000
Message-ID: <37B1883A.47B6D51@flex.ro> (raw)
References: <Pine.LNX.4.04.9908111910550.1789-100000@blrmail.in.tatainfotech.com>

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



view thread (2+ messages)

Message-ID: <37B1883A.47B6D51@flex.ro>
Permalink:  ../37B1883A.47B6D51@flex.ro/
Also on:    postgresql.org/message-id/37B1883A.47B6D51@flex.ro

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: teo@flex.ro, suma.r@tatainfotech.com
  Subject: Re: [INTERFACES] Regarding selction of query
  In-Reply-To: <37B1883A.47B6D51@flex.ro>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox