agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
(no subject)
2+ messages / 2 participants
[nested] [flat]

* (no subject)
@ 1994-09-16 23:08  Praveen Mamnani <pmamnani@cs.nmsu.edu>
  0 siblings, 1 reply; 2+ messages in thread

From: Praveen Mamnani @ 1994-09-16 23:08 UTC (permalink / raw)
  To: legacy

From: pmamnani@cs.nmsu.edu (Praveen Mamnani)
To: postgres@postgres.berkeley.edu
Subject: "append", using libpq ?

	
I am writing some programs in C using Libpq. I am doing basic
things as, creating a database, inserting some records(classes), 
and retrieving the data.
The reference manual shows the insertion of class using the copy 
command (from stdin). I wanted to execute the query append to 
insert the instances of some classes. I tried PQexec("append..."), 
but this does not seem to work. I am not sure that libpq allows
execution of such queries using PQexec. If not, then is there
another way instead of using copy command and PQputline.

Your help would be very appreciated.

Thanks,

Oops, one more thing. If you have some basic examples of appending
and retrieving data from a database, I would really appreciate if 
I can get some of them.

Thank you .

Praveen.

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* libpq append
@ 1994-09-16 23:31  Paul M. Aoki <aoki@cs.berkeley.edu>
  parent: Praveen Mamnani <pmamnani@cs.nmsu.edu>
  0 siblings, 0 replies; 2+ messages in thread

From: Paul M. Aoki @ 1994-09-16 23:31 UTC (permalink / raw)
  To: Praveen Mamnani <pmamnani@cs.nmsu.edu>; +Cc: legacy

pmamnani@cs.nmsu.edu (Praveen Mamnani) writes:
> I tried PQexec("append..."), 
> but this does not seem to work. I am not sure that libpq allows
> execution of such queries using PQexec.

it does, and by-and-large it works.  (this example maximizes 
minimality rather than correctness.)

faerie:postgres (7)> cat foo.c
main()
{
  (void) PQsetdb("foo");
  (void) PQexec("create bar (x=int4)");
  (void) PQexec("append bar (x=5)");
  (void) PQfinish();
}
faerie:postgres (8)> cc foo.c /private/devel/postgres/lib/libpq.a
faerie:postgres (9)> a.out 
faerie:postgres (10)> monitor -c 'retrieve (bar.all)' foo
---------------
| x           |
---------------
| 5           |
---------------
faerie:postgres (11)> 

there are examples of retrieving rows in the reference manual and 
under src/regress.
--
  Paul M. Aoki          |  University of California at Berkeley
  aoki@CS.Berkeley.EDU  |  Dept. of EECS, Computer Science Division (#1776) 
                        |  Berkeley, CA 94720-1776

==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~1994-09-16 23:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1994-09-16 23:08  Praveen Mamnani <pmamnani@cs.nmsu.edu>
1994-09-16 23:31 ` libpq append Paul M. Aoki <aoki@cs.berkeley.edu>

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