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

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: 2007-08-07 22:40:37
Message-ID: 1186526437.329947.95800@22g2000hsm.googlegroups.com (view raw or flat)
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;
}


pgsql-odbc by date

Next:From: usaneeDate: 2007-08-08 08:08:54
Subject: How to insert data pass by parameter
Previous:From: Anumula, RahulDate: 2007-08-06 06:35:59
Subject: 32 bit ODBC driver for PostgreSQl

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group