Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Long data and SQLPutData ?


  • 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: Tue, 07 Aug 2007 15:40:37 -0700
  • Message-id: <1186526437(dot)329947(dot)95800(at)22g2000hsm(dot)googlegroups(dot)com>

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;
}




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group