Subject: Retrieving tuples based on match cond in C variable

From: [email-masked]
Date: Fri, 20 May 1994 21:15:03 -0500 (CDT)

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 "[email-masked]"

   If this fails, send mail to "[email-masked]" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================