|
|
Sponsor |
Problem updating a large binary field (PostgreSQL, ODBC, VC++): msg#00117db.postgresql.odbc
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! ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Dealing with Insert Problems with Access, Jeff Eckermann |
|---|---|
| Next by Date: | Trouble creating a DSN-file, Kelvin Varst |
| Previous by Thread: | Any W2K issues around odbc driver install?, Fred Parkinson |
| Next by Thread: | Trouble creating a DSN-file, Kelvin Varst |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|