List:MySQL++« Previous MessageNext Message »
From:Vincent Jacques Date:May 1 2008 11:42am
Subject:Query::store does not throw in cas of spelling mistake
View as plain text  
Hello all,

[using mysql++ v3.0.2]

In the user manual, section 3.5, I read "By default, MySQL++ uses 
exceptions to signal errors."

But the following code does not throw anything, despite the spelling 
mistake in the name of the table:

     mysqlpp::Connection conn( /* Correct credentials here */ );

     mysqlpp::Query query = conn.query();
     query << "SELECT * FROM a_non_existing_table";

     mysqlpp::StoreQueryResult res = query.store();

When I look to the code of
StoreQueryResult Query::store(const char*, size_t)
I see:

	if (res) {
         	/* handling of normal case */
	}
	else {
		copacetic_ = conn_->driver()->result_empty();
		if (copacetic_) {
			/* ... */
			return StoreQueryResult();
		}
		else if (throw_exceptions()) {
			throw BadQuery(error(), errnum());
		}
		else {
			return StoreQueryResult();
		}
	}

In that case, copacetic_ is true, but it seems to me that it should be 
false, so that an exception is thrown.

Excuse me if my question is a newbee's one :)

Many thanks for your feedback,
-- 
Vincent Jacques

"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème."
         Devise Shadock

Thread
Query::store does not throw in cas of spelling mistakeVincent Jacques1 May
  • Re: Query::store does not throw in cas of spelling mistakeWarren Young1 May
    • Re: Query::store does not throw in cas of spelling mistakeVincent Jacques1 May