Return-Path: owner-postman Received: from localhost.Berkeley.EDU (localhost.Berkeley.EDU [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with SMTP id TAA03779 for postgres-redist; Sun, 27 Aug 1995 19:19:10 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199508280219.TAA03779@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost.Berkeley.EDU didn't use HELO protocol Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from localhost (slip-3-10.ots.utexas.edu [128.83.204.42]) by nobozo.CS.Berkeley.EDU (8.6.10/8.6.3) with ESMTP id TAA03656 for ; Sun, 27 Aug 1995 19:19:07 -0700 Received: (from pcole@localhost) by localhost (8.6.11/8.6.9) id VAA03978; Sun, 27 Aug 1995 21:25:58 -0500 Date: Sun, 27 Aug 1995 21:25:57 -0500 (CDT) From: Paul Cole To: Casey Claiborne , postgres@postgres.Berkeley.EDU Subject: Re: res results from PQexec() In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-To: postgres-redist@postgres.Berkeley.EDU Resent-Date: Sun, 27 Aug 95 19:19:10 -0700 Resent-XMts: smtp I played around with your code snippet. I found a couple things that my version of postgres doesn't like right off the bat. Your class was called "user" and you had "user" as a data member as well. My postgres <4.2a> doesn't like "user" at all in any queries whatsoever. Must be a reserved word I guess? Secondly you specified your query as append template (template.name = blah, template.address = blah, template.city = blah, template.state = blah) My postgres doesn't like that either. It dislikes your qualification of the data members with the class. You've already qualified it by saying "append class_name" so.. append template (name = blah, address = blah, city = blah, state = blah) is quite sufficient. other than that I found no problems. I ran the test with: -------------------- >destroydb testdb >createdb testdb > > monitor testdb Welcome to the POSTGRES terminal monitor Go * create TEMPLATE (name = text, address = text, city = text, state = text ) \g * \q > > ./test_libpq > > monitor testdb Welcome to the POSTGRES terminal monitor Go * retrieve (TEMPLATE.all) \g Query sent to backend is "retrieve (TEMPLATE.all) " --------------------------------------------------------- | name | address | city | state | --------------------------------------------------------- | Joe Schmoe | 1234 NoWhere Drive| BFE City | Junk | --------------------------------------------------------- Enjoy! --Paul Cole --pcole@ccwf.cc.utexas.edu ======================================= ======================================= the source for test_libpq follows: ---------------------------------- #include #include "libpq.h" struct struct_user { char name[20]; char address[50]; char city[20]; char state[10]; }; typedef struct struct_user user; user TEST_USER = { "Joe Schmoe", "1234 NoWhere Drive", "BFE City", "Junk" }; int main(void) { char* res; char tempdata[600]; sprintf(tempdata, "append TEMPLATE (name = \"%s\", address=\"%s\", city=\"%s\", state=\"%s\") ", TEST_USER.name, TEST_USER.address, TEST_USER.city, TEST_USER.state); PQsetdb("testdb"); PQexec("begin"); res = PQexec(tempdata); if (*res == 'E') { printf("this did not work 1 \n"); PQexec("end"); exit(0); } if (*res == 'I') { printf("this did not work 2 \n"); PQexec("end"); exit(0); } PQexec("end"); PQfinish(); /* * even though I still don't know what this REALLY does * PQfinish() isn't even defined in my libpq.h. *shrug* */ return (0); } ============================================================================== 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. ============================================================================== URL: http://s2k-ftp.CS.Berkeley.EDU:8000/postgres/