Skip to Content.
Sympa Menu

freetds - [freetds] Problem with dbrpcparam

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "martin martin" <acevedoma AT hotmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Problem with dbrpcparam
  • Date: Thu, 21 Apr 2005 13:54:28 +0000

Hello, I have some problems passing binary data to stored procedures using db-lib. The parameter is a SYBIMAGE(IMAGE TYPE IN SQLSERVER)

I made something like this

....
ifstream archivo(filename,ios::in|ios::binary|ios::ate);
size=archivo.tellg();
buffer=new char[size];
archivo.seekg(0,ios::beg);
archivo.read(buffer,size);
archivo.close();

hReturn=dbrpcparam(m_dbproc,btName,0,SYBIMAGE,-1,size,(BYTE *) buffer)==SUCCEED;

....
....

if(hReturn && dbrpcsend(m_dbproc)==SUCCEED){
cout<<"Comando enviado"<<endl;
if(dbsqlok(m_dbproc)==SUCCEED){
......
......


the program hangs at dbrpcsend

I changed SYBIMAGE by SYBVARBINARY and it worked but only for files with small size, a 18 bytes images was sended well to the server but a 100KB images was not.
The server received the images very well in second case, in both case the parameter in the server was an IMAGE

CREATE PROCEDURE spVarcharSimple
@par varchar(255)
,@par2 int
,@par3 float
,@par4 as image --problem here
AS
--TESTING PARAMETERS
SELECT @par as resultado
, @par2 as resultado2
,@par3 as resultado3
,@par4 as resultado4
......

Any ideas? Thanks....






Archive powered by MHonArc 2.6.24.

Top of Page