Hello All,
I have strange problem with libodbc++ ( 0.2.3 or 0.2.2 ).
i'm using mysql-4.0.14 , MyODBC-3.51.06 and unixODBC-2.2.6
configured with following options
1.MySQL
../configure --prefix=/usr/local/test --with-openssl
--with-mysqld-user=root --enable-thread-safe-client --with-pthread
--enable-shared
2.unixODBC
../configure --prefix=/usr/local/test --sysconfdir=/etc
--enable-threads=yes
3.MyODBC
../configure --prefix=/usr/local/test
--with-mysql-libs=/usr/local/MailQubeBuild/lib/mysql
--with-mysql-includes=/usr/local/MailQubeBuild/include/mysql
--with-unixODBC=/usr/local/MailQubeBuild --enable-thread-safe
4.libodbc
../configure --prefix=/usr/local/test
--with-odbc=/usr/local/MailQubeBuild --enable-threads
OS is a Red Hat 7.3
and problem is that when i'm trying to write to database - all is ok
but when i try to read i get empty resultsets
here is a test code which fails :
void _perform_test()
{
int iCnt = 0;
long lID = 0;
odbc::Statement* stmt = NULL;
odbc::ResultSet* rset = NULL;
std::string csQuery;
LogLineToLogServer(MQ_LOG_NOTICE, "[80200] !!!!!!!!!!!!!! Testing DB
!!!!!!!!!!!!!!");
odbc::PreparedStatement* rs=connDBConnection->prepareStatement
("create table tmp__ ( testfld int(1))TYPE=INNODB ;");
try {
rs->executeUpdate();
}
catch (odbc::SQLException& e ) {
LogLineToLogServer(MQ_LOG_NOTICE, "[12011] Database exception %s",
e.getMessage().c_str() );
if( rs ) delete rs;
}
rs=connDBConnection->prepareStatement ("insert into tmp__
values(1)");
try {
rs->executeUpdate();
}
catch (odbc::SQLException& e ) {
LogLineToLogServer(MQ_LOG_NOTICE, "[12011] Database exception %s",
e.getMessage().c_str() );
if( rs ) delete rs;
}
csQuery += "SELECT * FROM tmp__";
try {
stmt=connDBConnection->createStatement();
}
catch (odbc::SQLException& e ) {
LogLineToLogServer(MQ_LOG_NOTICE, "[12011] Database exception %s",
e.getMessage().c_str() );
if( stmt ) delete stmt;
}
try {
rset=stmt->executeQuery(csQuery);
while(rset->next()) {
lID = rset->getLong ( "testfld" );
iCnt++;
}
}
catch (odbc::SQLException& e ) {
LogLineToLogServer(MQ_LOG_NOTICE, "[12011] Database exception %s",
e.getMessage().c_str() );
if( rs ) { delete rset; rset = NULL; }
if( stmt ) { delete stmt; stmt = NULL; }
}
rs=connDBConnection->prepareStatement ("drop table tmp__");
try {
rs->executeUpdate();
}
catch (odbc::SQLException& e ) {
LogLineToLogServer(MQ_LOG_NOTICE, "[12011] Database exception %s",
e.getMessage().c_str() );
if( rs ) delete rs;
return 0;
}
if( iCnt != 1 || lID != 1 )
LogLineToLogServer(MQ_LOG_NOTICE, "[80200] !!!!!!!!!!!!!! ERROR
!!!!!!!!!!!!!!");
else
LogLineToLogServer(MQ_LOG_NOTICE, "[80200] !!!!!!!!!!!!!! TEST
PASSED !!!!!!!!!!!!!!");
}
and problem is that each time i get ERROR :)
so may be someone can help me?
best wishes,
decho