Re: LONG RAW data size
From: Pablo Sanchez <pablo_at_dev.null>
Date: Tue, 25 Feb 2003 20:33:58 -0600
Message-ID: <Xns932DC709918AEpingottpingottbah_at_216.166.71.233>
}
else
{
}
Date: Tue, 25 Feb 2003 20:33:58 -0600
Message-ID: <Xns932DC709918AEpingottpingottbah_at_216.166.71.233>
"Massis Isagholian" <massis_at_isagholian.com> wrote in news:xWU6a.761$Uy4.64672_at_bgtnsc05-news.ops.worldnet.att.net:
> Unfortunately, both single and piecewise fetch operations (with
> OCI8) require priori knowledge of data size (number of bytes) in
> LONG RAW columns. Pre-allocating the 2GB max memory is obviously out
> of the question.
I don't think you need to know the size beforehand. Here's a snippet of code that I wrote with some comments:
/* Ensure that OCI_NEED_DATA is returned */ status = OCIStmtFetch(*l_dbproc.statement_hp,
*l_dbproc.error_hp, (sword ) 1, OCI_FETCH_NEXT, OCI_DEFAULT);
/* In typical situations, this would be in a while-loop but
- we know that XXXX expects the entire chunk rather than piecemeal */
if (status == OCI_NEED_DATA) {
status = OCIStmtGetPieceInfo(*l_dbproc.statement_hp, *l_dbproc.error_hp, (dvoid **) &define_hp, (ub4 *) &type_hp, (ub1 *) &in_out, (ub4 *) &iter, (ub4 *) &idx, (ub1 *) &piece); if (status) { assign_cda_retcode(status); return(status); } status = OCIStmtSetPieceInfo((dvoid *) define_hp, type_hp, *l_dbproc.error_hp, (dvoid *) buf, (ub4 *) &len, piece, (dvoid *) &ind, (ub2 *) &return_code); if (status) { assign_cda_retcode(status); return(status); } status = OCIStmtFetch(*l_dbproc.statement_hp, *l_dbproc.error_hp, (sword ) 1, OCI_FETCH_NEXT, OCI_DEFAULT); if (status != OCI_SUCCESS) { if (status) { assign_cda_retcode(status); return(status); } }
}
else
{
if(status) { assign_cda_retcode(status); return(status); }
}
-- Pablo Sanchez, High-Performance Database Engineering http://www.hpdbe.comReceived on Wed Feb 26 2003 - 03:33:58 CET