From: | "lothar(dot)behrens(at)lollisoft(dot)de" <lothar(dot)behrens(at)lollisoft(dot)de> |
---|---|
To: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Long data and SQLPutData ? |
Date: | 2007-08-07 22:40:37 |
Message-ID: | 1186526437.329947.95800@22g2000hsm.googlegroups.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Hi,
I need some advice how to update a BLOB column. Reading it with
SQLGetData seems to be easier :-)
Do I need the commented code to 'shift' the bigger memory block into
the bound buffer while calling
SQLParamData and SQLPutData ?
I do set multiple column data before I do a SQLSetPos. So I have bound
columns therefore.
Do I get trouble, when I update some BLOB columns in between ?
Are there other issues with that code ?
Thanks, Lothar
Here I have code developed yet:
lbErrCodes LB_STDCALL lbQuery::setBinaryData(int column,
lb_I_BinaryData* value) {
// Declare a binary buffer to send 5000 bytes of data at a time.
SQLCHAR BinaryPtr[5000];
SQLINTEGER longDataLen;
SQLRETURN rc, retcode;
// The size may be more than 5000
longDataLen = SQL_LEN_DATA_AT_EXEC(value->getSize());
rc = SQLBindCol(hstmt, column, SQL_C_BINARY, (void *)BinaryPtr, 0,
&longDataLen);
retcode = SQLSetPos(hstmt, 1, SQL_UPDATE, SQL_LOCK_NO_CHANGE);
if (retcode == SQL_NEED_DATA)
{
retcode = SQLParamData(hstmt, (void **) &BinaryPtr);
while(retcode == SQL_NEED_DATA)
{
/*
//This code should be here to 'shift' the
datapieces.
void* peace = value->getNextDataPiece(5000);
long len = value->getCurrentPieceSize();
memcpy(BinaryPtr, piece, len);
*/
retcode = SQLPutData(hstmt, BinaryPtr, SQL_NTS);
/* check for error here */
retcode = SQLParamData(hstmt, (void **) &BinaryPtr);
}
}
return ERR_NONE;
}
From | Date | Subject | |
---|---|---|---|
Next Message | usanee | 2007-08-08 08:08:54 | How to insert data pass by parameter |
Previous Message | Anumula, Rahul | 2007-08-06 06:35:59 | 32 bit ODBC driver for PostgreSQl |