From: | "Mavinakuli, Prasanna (STSD)" <prasanna(dot)b-m(at)hp(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | PQexecParams-Problem |
Date: | 2005-08-31 14:12:24 |
Message-ID: | E84C4F56CA80174D8834825116CF247F0110364D@bgeexc05.asiapacific.cpqcorp.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
Problem Description:
We need to insert binary data to tables and retrieve the
Same-(data type is bytea).
We are using PQExecParams for inserting and retrieving
Data.
Table contains other than binary data also.
When we tried to fetch the integer data (type-int2)
We are not able to get anything from that result set(alws value is
zero).but Pqexec returns the desired value
Questions:
1)how can we get the integer value from the result set which is got from
executing PQexecParams;
(the sample code is given below)
2)if it's not possible then how can we get the BINARY values using
Pqexec
Here is the code snapshot:
string query="select intval from dummy where intval=7;";
res1=PQexecParams(conn,query.c_str(),0,NULL,NULL,NULL,NULL,1);
for(unsigned char i=0;i<4;i++)
{
printf("%d \n",(PQgetvalue(res1,0,0)[i]));
//prints 0000 here
}
cout<<"value from pqexec params
****"<<atoi(PQgetvalue(res1,0,0))<<endl; //prints 0 here
cout<<"using pqexec ***"<<endl;
res1=PQexec(conn,"select intval from dummy where
intval=7;");//prints 7 below.
cout<<"value from pqexec
**"<<atoi(PQgetvalue(res1,0,0))<<endl;
Prasanna.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-08-31 14:20:04 | Re: or kills performance |
Previous Message | Greg Sabino Mullane | 2005-08-31 13:19:00 | Re: How do I copy part of table from db1 to db2 (and rename the columns)? |