List:MySQL++« Previous MessageNext Message »
From:<webmaster Date:October 24 2006 10:22am
Subject:Re: MySQL++ crash on << and more
View as plain text  
Drew M.: I am actually storing the results with the query.store() call, and after all, I
am not using another query object, and I am not sending another query to execute. Only
one query is to be executed.

Warren Young: I have caught the exception. The exceptions what() returns the same error as
before:
Commands out of sync; you can't run this command now.
"If it's not an exception, it may be that you're mixing a library built 
with one build setup with an executable built another way.  That's a 
pretty good way to crash a program."Yes. I actually am mixing another library. Its
WxWidgets, but I have checked and I'm using the right build setups (If you mean
release/debug). Apart from that, WxWidgets is compiled in UNICODE. Maybe that could have
something to do with it.

Ive updated the code to make it a bit clearer:

ofstream ofin;
ofin.open("log.log");

mysqlpp::Query query = con.query();
query.enable_exceptions();

query.execute("SELECT * FROM eqdkp_news");

if (!query.success())
{
    ofin << "Query wasn't succesfull:  " << query.error() << std::endl;
}

mysqlpp::Result res;
try
{
    res = query.store();
}
catch (mysqlpp::Exception &e)
{
    ofin << "exception" << e.what() << " end\n\n";
}
if (res)
{
    ofin.close();
    ofin.open("news.html");
        if (ofin.is_open())
        {
            mysqlpp::Row row;
            while (row = res.fetch_row()) 
            {
                // Probably need to use utf8trans but irrelevant for now.
                ofin << row["news_headline"];
                ofin << row["news_message"];
                ofin << row["news_id"];
                ofin << row["news_date"];
                ofin << row["user_id"];
           }
           ofin.close();
        }
}
else
{
    ofin << "else: " << query.error() << std::endl;
    return;
}

Thread
MySQL++ crash on << and morewebmaster23 Oct
  • Re: MySQL++ crash on << and moreWarren Young23 Oct
Re: MySQL++ crash on << and morewebmaster23 Oct
  • Re: MySQL++ crash on << and moreDrew M.23 Oct
  • Re: MySQL++ crash on << and moreWarren Young23 Oct
Re: MySQL++ crash on << and morewebmaster24 Oct
Re: MySQL++ crash on << and morewebmaster24 Oct