Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 25E549FB682 for ; Tue, 7 Aug 2007 19:40:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 98890-04 for ; Tue, 7 Aug 2007 19:40:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from floppy.pyrenet.fr (news.pyrenet.fr [194.116.145.2]) by postgresql.org (Postfix) with ESMTP id DC34B9FB402 for ; Tue, 7 Aug 2007 19:40:39 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 14FBC31440; Wed, 8 Aug 2007 00:40:38 +0200 (MET DST) From: "lothar.behrens@lollisoft.de" X-Newsgroups: pgsql.interfaces.odbc Subject: Long data and SQLPutData ? Date: Tue, 07 Aug 2007 15:40:37 -0700 Organization: http://groups.google.com Lines: 60 Message-ID: <1186526437.329947.95800@22g2000hsm.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Complaints-To: groups-abuse@google.com User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; de-de) AppleWebKit/312.8.1 (KHTML, like Gecko) Safari/312.6,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 jedi.behrens.de:3128 (squid/2.5.STABLE5) Complaints-To: groups-abuse@google.com Injection-Info: 22g2000hsm.googlegroups.com; posting-host=87.180.71.126; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 To: pgsql-odbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200708/12 X-Sequence-Number: 9129 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; }