Overview
Features
Download
Documentation
Community
Add-Ons & Services

RecordSet question

Please post support and help requests here.

RecordSet question

Postby eswanson » 03 Feb 2009, 03:12

We really like this product and the suite of classes that are include. I have a question about the recordset class.

We have a class like such:

class CDbRecordset
public:
CDbRecordset()
{
m_pRecordset = NULL;
return;
}
~CDbRecordset()
{
if(m_pRecordset != NULL)
{
delete m_pRecordset;
m_pRecordset = NULL;
}

setStatement(Session& pSession, Stdstring & strSqlStmt)
{

m_pRecordset = new RecordSet(*pSession, strSqlStmt);

}

string getstringval(int iCol){}
getintval(int iCol){}

movenext(){}
moveprev(){}
movefirst(){}

bool IsEof()
{
}
private:

Poco::Data::RecordSet * m_pRecordset;
};

main
{
CDbRecordset objRecordset;
Session session();
objRecordset.SetStatement(session,"select * from Temp");
objRecordset.movefirst();
objRecordset.GetStringVal(0);

}

[code][/code]


When the program exits, it crashes because it is having an exception while cleaning up the recordset object in the odbc code.

Is there anything I can do to prevent this crash? We are trying to replace adorecordset object with the Poco Recordset.

Thanks

Eric
eswanson
 
Posts: 13
Joined: 29 Jan 2009, 16:01

Re: RecordSet question

Postby alex » 03 Feb 2009, 03:32

eswanson wrote:When the program exits, it crashes because it is having an exception while cleaning up the recordset object in the odbc code.
Is there anything I can do to prevent this crash? We are trying to replace adorecordset object with the Poco Recordset.


The Session is destroyed before CDbRecordset. Try swapping the declarations:

Code: Select all
main
{
  Session session();
  CDbRecordset objRecordset;
  ...
}


HTH
alex
 
Posts: 1130
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: RecordSet question

Postby eswanson » 10 Feb 2009, 16:14

that did the trick, thanks for the suggestion.

Thanks

Eric
eswanson
 
Posts: 13
Joined: 29 Jan 2009, 16:01


Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron