Re: OCI: Array Interface - multiple inserts

From: Alexander Kuznetsov <Alexander.Kuznetsov_at_marshmc.com>
Date: 16 Oct 2002 11:07:57 -0700
Message-ID: <ac5bc7c1.0210161007.4159010f_at_posting.google.com>


Hi Ole,

for every field you'll need

- one OCIBind structure
- one array of values
- possibly one array of indicatiors
- possibly one array of actual lengthes

an excerpt from working code:

ret = OCIBindByPos(m_pStmthp,

			&(pBind[colNum]),
			m_pErrhp, 
			(colNum+1), //parameter position 1, 2, 3, ...
			(dvoid*)(m_pColumns[i].pData),
//pData is an array of values
			bindLen[colNum],
			bindType[colNum],
			(dvoid*)(pInd[colNum]),
			(ub2*)((bindType[colNum] == SQLT_STR) ?
					pLen[colNum] : 0),
			(ub2 *) 0, (ub4) 0, (ub4 *) 0, 
			OCI_DEFAULT)

 Hansen <oha_at_unispeed.com> wrote in message news:<3DAD1BD2.5060600_at_unispeed.com>...
> Hi,
>
> I would like to speed up my inserts but I have some difficulties
> understanding the OCI Array Interface.
>
> I have say 1000 statements that all should be inserted into the same table.
>
> Should I build an array of structs holding the values to be inserted,
> ie. I must allocate 1000 structs for the statements and then bind every
> statement to its own struct?
>
> Should I have a bind handle for every struct or for every field in the
> struct?
>
> If someone could show me an example I would be very happy.
>
> Thanks in advance!
>
> Br,
>
> Ole Hansen
Received on Wed Oct 16 2002 - 20:07:57 CEST

Original text of this message