agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: SRIRAMK@charlie.usd.edu
To: postgres@postgres.Berkeley.EDU
Cc: SRIRAMK@charlie.usd.edu
Subject: Retrieving tuples based on match cond in C variable
Date: Fri, 20 May 1994 21:15:03 -0500 (CDT)
Message-ID: <940520211503.91c@charlie.usd.edu> (raw)

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.
==============================================================================



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: postgres@postgres.berkeley.edu
  Cc: SRIRAMK@charlie.usd.edu
  Subject: Re: Retrieving tuples based on match cond in C variable
  In-Reply-To: <940520211503.91c@charlie.usd.edu>

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

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