X-Original-To: pgsql-general-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 6D828D1EA15; Tue, 20 Apr 2004 20:13:09 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42183-04; Tue, 20 Apr 2004 20:13:08 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id E3A39D1CCD5; Tue, 20 Apr 2004 20:13:06 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i3KND5Sx003379; Tue, 20 Apr 2004 23:13:05 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i3KMosXe098111; Tue, 20 Apr 2004 22:50:54 GMT From: pavel_sorokin@lycos.com (Pavel Sorokin) X-Newsgroups: comp.databases.postgresql.interfaces.odbc, comp.databases.postgresql.ports.cygwin, comp.databases.postgresql.general, microsoft.public.vc.database Subject: Problem updating a large binary field (PostgreSQL, ODBC, VC++) Date: 20 Apr 2004 15:50:56 -0700 Organization: http://groups.google.com Lines: 57 Message-ID: <1797ce91.0404201450.418fec79@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-abuse@google.com To: "pgsql-general@postgresql.org.pgsql-odbc"@postgresql.org X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/965 X-Sequence-Number: 60207 Hello, I created a table where a record consists of a single field of type lo. I'm trying to add a new record and store the contents of a file in it. However, when I call CRecordset.Update() I get the following exception: "SetPos with data_at_exec not yet supported". My table doesn't get updated. Environment: PostgreSQL 7.4.1 on Cygwin, Visual C++ .Net 2003, ODBC driver 3.520. I pasted my code below (the line that causes the error is marked). Anyone knows why it doesn't work, and if there's any other way to do what I want? TIA, Pavel CDatabase db; CMyTable table(&db); table.Open(); char* FileName = "c:\\test.txt"; CFile f; CByteArray ByteArray; if (f.Open(FileName, CFile::modeRead, &e )) { CByteArray ByteArray; long size = f.GetLength(); ByteArray.SetSize(size); BYTE *p = ByteArray.GetData(); ZeroMemory(p, size); long result = f.Read(p, size); table.AddNew(); if(!(table.m_data.m_hData)) { ::GlobalFree(table.m_data.m_hData); table.m_data.m_hData = GlobalAlloc(GMEM_MOVEABLE,size); if(table.m_data.m_hData) // GlobalAlloc could return NULL... { table.m_data.m_dwDataLength = size; LPVOID p2 = ::GlobalLock(table.m_data.m_hData); memcpy(p2, p, size); ::GlobalUnlock(table.m_data.m_hData); table.m_data.m_dwDataLength = ::GlobalSize(table.m_data.m_hData); // mark the record for the update table.SetFieldDirty(&(table.m_data), true); table.SetFieldNull(&(table.m_data), false); } else { AfxMessageBox("Couldn't allocate memory"); } } table.Update(); // <-- THIS DOESN'T WORK!