Re: Stack Overflow on Insert
Dave Edwinson <[email protected]> Fri, 24 May 2002 09:24:39 -0500
| Newsgroups | gmane.comp.windows.devel.oledb.devel |
|---|---|
| Message-ID | <A147FA3CB028D311A6C000805F65319E1E3929@PARAMETRICA01> |
At what point are you updating the table? Without explicitly calling the update of the recordset, you load up memory with all the changes until the UpdateBatch method is executed. This is particularly a problem if you open the recordset using a LockBatch type of parameter. To resolve this, you could issue the update with each record added, or key the updatebatch method to execute after a certain number of records have been added. Dave Edwinson Product Development Manager ParaMetrica Inc. Voice (651) 730-5005 x202 Fax (651) 730-9200 www.parametrica.com -----Original Message----- From: Jeff Nygren [mailto:[email protected]] Sent: Friday, May 24, 2002 9:09 AM To: [email protected] Subject: Re: Stack Overflow on Insert Hi, Kim, Yes and yes. ;-) Is there an issue with the ATL conversion macros? Thank you for taking a look at this. Here are the 'guts' of my sample app. Jeff Nygren hr = DBOutputCommand.CreateAccessor(nOutputCols, &pszColumnBuf[1], sizeof(TCHAR)*nOutputCols*256); // (I skipped pszColumnBuf[0] just so index matches column ordinal. Yes I allocated an extra array element.) for (ULONG lCol = 1; lCol <= nOutputCols; lCol++) DBOutputCommand.AddBindEntry(lCol, DBTYPE_WSTR, 256, &pszColumnBuf[lCol]); hr = DBOutputCommand.Open(m_DBOutputSession, sQuery, &PropertySet); // Loop through records for (nRecordNum = 0; nRecordNum < NUMROWS; nRecordNum++) { // Loop through columns of output database for (int iColumn = 0; iColumn < NUMCOLS; iColumn++) wcsncpy((WCHAR*)pszColumnBuf[iColumn + 1], (WCHAR*)T2OLE(strValue), 128); if (S_OK == (hr = DBOutputCommand.Insert())) { m_nRecordCount = nRecordNum+1; UpdateData(FALSE); YieldCPU(); } } // End of input record loop Hi Jeff, Are you using any of the ATL conversion macros in the loop? W2A, A2W, etc? Could you post the code for LoadAccessorBuffers? Best regards, Kim -----Original Message----- From: Jeff Nygren [mailto:[email protected]] Sent: den 23 maj 2002 18:50 To: [email protected] Subject: Re: Stack Overflow on Insert I don't think so, the code is pretty simple and straight-forward. Jeff Nygren Is there any possibility of a recursive loop going on? -----Original Message----- From: Jeff Nygren [mailto:[email protected]] Sent: 23 05 2002 15:50 To: [email protected] Subject: [OLEDB_DEV] Stack Overflow on Insert I have some code that adds records to a MS Access database. If I try to add too many records, I get a stack overflow. I'm guessing there is something more I need to do, but I don't know what it is. My code is basically: ... You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor lists at http://discuss.develop.com. You can read messages from the OLEDB_DEV archive, unsubscribe from OLEDB_DEV, or subscribe to other DevelopMentor lists at http://discuss.develop.com.