Subject: HELP!!

From: [email-masked] (Sudheer R. Vangati)
Date: Tue, 23 Jun 92 06:17:17 -0700

Hi!
Is it possible to store a tuple to a variable and use that variable in 
a retrieve command?
Example:

#define MAX_SIZE 512

char *buffer[MAX_SIZE];

buffer[i] = PQgetvalue(p, t+i, j);

/* buffer[i] now has (let's say) the tuple 'Word Processing'.*/

/* Is it possible to execute the following command and if not what is the alternative apart
from using the actual attribute value in PQexec.*/

PQexec ("retrieve portal Tportal (PROJECT.APPLICATION, PROJECT.VERSION,PROJECT.ARCHITECTURE, PROJECT.INSTALLER, PROJECT.VENDOR) where PROJECT.TYPE=\"buffer[i]\"");

I am not gettin any error , except that the value returned to PQntuplesGroup (a,k) is 0 which
is understandable because the retrieve command in PQexec is looking for "buffer[i]" in
the database and does not find it..

Any help is greatly appreciated.
Thanx in advance.

---

From: <[email-masked]>
Date: Tue, 23 Jun 92 08:20:36 PDT

> Is it possible to store a tuple to a variable and use that variable in 

sure.  you should change your example to be

    char *myresult, *qryres;
    char myquery[512];

    myresult = PQgetvalue(p, t+i, j);

    /* myresult now has (let's say) the string 'Word Processing'.*/
    sprintf(myquery, "retrieve (t.all) where t.name = \"%s\"", myresult);
    qryres = PQexec(myquery);

					mike olson
					project sequoia 2000
					uc berkeley
					[email-masked]