Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Oracle OCI 7 question
First off, I am using OCI7 cos I have a gun to my head. FTX does not support
8.
Given the table (And I know this sound familar)
FILES
FILENAME VARCHAR(255)
FILECONTENT LONG RAW
I am trying to update 2 records at a time using arrays and a piecewise
operation.
so I do
oparse
obindps
oexn(aCursor,2)
while(continueProcessing == true)
{
switch (result)
{
// Successful Fetched the whole lot case CI7_SUCCESS: { continueProcessing = false; break; } case 3129: {
// Get Information About Piece
result = OCI7_getpi(aCursor,&piece);
// If This is the first Piece
// set Pointer to be the next LONG or LONG RAW in the
DataObject. if (piece==OCI_FIRST_PIECE) { // Set Address for the piece pointerToCurrentRow = column.getData() + (nextRow * column.getColumnSize()); nextPiece = 0; nextRow++; } unsigned long dataLeftToWrite = dataLengths[nextRow-1] - (nextPiece * iPieceSize); length = iPieceSize; if(dataLeftToWrite < iPieceSize) { length = dataLeftToWrite; piece = OCI_LAST_PIECE; }
// Set The Data To be used to populate the Piece
pointerToCurrentPiece = pointerToCurrentRow + (nextPiece * iPieceSize); nextPiece++; result = OCI7_setpi(aCursor,piece,pointerToCurrentPiece,&length); break; }
FIRST_TIME_THROUGH = false;
// Do Next Execute
if(continueProcessing == true)
{
result =
OCI7_executeArrayStatement(aCursor,inDataObject.getNumberOfRows());
}
}
I know that all the code is not here but enough to grasp the idea.
This works fine for insert but not for updates.
My question is: When updating two records at once in a piecewise operation do you set OCI_LAST_PIECE once a the end of the whole piece operation.
E.g if writting two records, one record 10 and the other of 9 bytes in 6 byte chunks would the logic be
record 1:ABCDEFGHIJ
record 2:12456789
oexn (signals 3129)
getpi
setpi piece=2 length=6
oexn
setpi piece=3 length=4
oexn
getpi
setpi piece=2 length=6
oexn
setpi piece=3 length=3
oexn
Code examples would be good.
Thanks
Iain
.
Received on Wed Feb 27 2002 - 00:44:19 CST