Return-Path: owner-postman Received: from localhost (localhost [127.0.0.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id TAA00548 for postgres-redist; Fri, 20 May 1994 19:10:35 -0700 Resent-From: POSTGRES mailing list Resent-Message-Id: <199405210210.TAA00548@nobozo.CS.Berkeley.EDU> X-Authentication-Warning: nobozo.CS.Berkeley.EDU: Host localhost didn't use HELO protocol Sender: owner-postman@postgres.Berkeley.EDU X-Return-Path: owner-postman Received: from charlie.usd.edu (charlie.usd.edu [192.55.228.1]) by nobozo.CS.Berkeley.EDU (8.6.4/8.6.3) with SMTP id TAA00538 for ; Fri, 20 May 1994 19:10:30 -0700 From: SRIRAMK@charlie.usd.edu Date: Fri, 20 May 1994 21:15:03 -0500 (CDT) To: postgres@postgres.Berkeley.EDU CC: SRIRAMK@charlie.usd.edu Message-Id: <940520211503.91c@charlie.usd.edu> Subject: Retrieving tuples based on match cond in C variable Resent-To: postgres-redist@postgres.Berkeley.EDU Resent-Date: Fri, 20 May 94 19:10:35 -0700 Resent-XMts: smtp I need to retrieve tuples based on search where the search criteria to be matched with is contained in a variable. Essentially I have a class called Body with two attributes - msgid of type int4 and line of type text. I need to retrieve all lines corresponding to a msgid where the msgid is accepted from the user into a C variable called msgnum. The function retbody given below is for retrieving tuples whose msgid attribute matches the variable msgnum retbody(msgnum) int msgnum; { PortalBuffer *p; PQsetdb ("maildbtrial1"); PQexec ("begin"); PQexec ("retrieve portal g (BODY.line) where BODY.msgid = msgnum "); The last line in the above code is incorrect. Please let me know how to handle this. I will similarly require to retrieve tuples based on substring match where the condition to be matched is kept in a variable. Please let me have the correct approach for both the above situations. Thanks Sriram Kal ============================================================================== 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. ==============================================================================