Home > database >  ORacle to write blob field error, a great god
ORacle to write blob field error, a great god

Time:10-06

The code is as follows:
Bool ZzOcciDynaset: : blobWrite (Blob Blob, STD: : stringstream * pIStream)
{
If (blob==NULL | | blob - & gt; IsNull ())
{
return false;
}
If (NULL==pIStream)
{
return false;
}
Try
{
Oracle: : accounted: : * pStream=blob Stream - & gt; GetStream ();
PIStream - & gt; Seekg (0, STD: : ios: : end);
Unsigned long filesize=pIStream - & gt; Tellg ();
PIStream - & gt; Seekg (0, STD: : ios: : beg);
If (filesize==0)
{
return false;
}

STD: : string strbuffer;
Strbuffer. Resize (1024);
Unsigned long totalwritten=0;
Unsigned long amtread=0;
While (totalwritten!=filesize)
{
PIStream - & gt; Read ((char *) (strbuffer c_str ()), 1024);
Amtread=pIStream - & gt; Gcount ();
If (amtread==0)
{
break;
}

Computer program here:
pStream - & gt; WriteBuffer ((char *) (strbuffer c_str ()), amtread);
Totalwritten=totalwritten + amtread;
}
Char * c="" (char *);
PStream - & gt; WriteLastBuffer (c, 0);
Blob - & gt; CloseStream (pStream);
}
The catch (oracle: : accounted: : SQLException ex)
{
ZZLOG (eException, "ZzOcciDynaset: : blobWrite (Blob Blob, STD: : stringstream * pIStream) failed! : : ErrorCode: : "+
CommonData: : toString (ex. GetErrorCode ()) + "failed Mesage:" + ex. GetMessage ());
return false;
}
The catch (... )
{
ZZLOG (eException, "ZzOcciDynaset: : blobWrite (Blob Blob, STD: : stringstream * pIStream) failed!" );
return false;
}
return true;
}

CodePudding user response:

To the top, oracle error write blob file, a great god for help!!!!!
  • Related