problem with PQExecParams
От | prasanna mavinakuli |
---|---|
Тема | problem with PQExecParams |
Дата | |
Msg-id | 20050831120810.28291.qmail@webmail47.rediffmail.com обсуждение исходный текст |
Ответы |
Re: problem with PQExecParams
|
Список | pgsql-hackers |
<p> <br /> Hi,<br /><br /> Problem Description:<br /> <br /> We need to insert binary data to tables and retrieve the<br /> Same-(data type is bytea).<br /> We are using PQExecParams for inserting and retrieving<br /> Data.<br /> Tablecontains other than binary data also.<br /><br /> When we tried to fetch the integer data (type-int2)<br /> We are notable to get anything from that result set(alws value is zero).but Pqexec returns the desired value<br /><br /> Questions:<br/><br /> 1)how can we get the integer value from the result set which is got from executing PQexecParams;<br/> (the sample code is given below)<br /><br /> 2)if it's not possible then how can we get the BINARY valuesusing<br /> Pqexec <br /><br /> Here is the code snapshot:<br /><br /> string query="select intval from dummy whereintval=7;";<br /> <br /> res1=PQexecParams(conn,query.c_str(),0,NULL,NULL,NULL,NULL,1);<br /> for(unsigned char i=0;i<4;i++)<br /> {<br /> printf("%d \n",(PQgetvalue(res1,0,0)[i]));<br/> //prints 0000 here <br /> }<br /> <br /> cout<<"value from pqexec params ****"<<atoi(PQgetvalue(res1,0,0))<<endl; //prints 0 here<br /> <br /> cout<<"using pqexec ***"<<endl;<br /> res1=PQexec(conn,"select intval fromdummy where intval=7;");//prints 7 below.<br /> cout<<"value from pqexec params ****"<<atoi(PQgetvalue(res1,0,0))<<endl;<br/><br /><br /> Prasanna. <br /><br /><a href="http://adworks.rediff.com/cgi-bin/AdWorks/sigclick.cgi/www.rediff.com/signature-home.htm/1507191490@Middle5?PARTNER=3"><img border="0"hspace="0" src="http://adworks.rediff.com/cgi-bin/AdWorks/sigimpress.cgi/www.rediff.com/signature-home.htm/1963059423@Middle5?OAS_query=null&PARTNER=3" vspace="0"/></a>
В списке pgsql-hackers по дате отправления: