Bug #13031 Wrong member initialization in Query
Submitted: 7 Sep 2005 5:59 Modified: 7 Sep 2005 23:43
Reporter: Dmitriy Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL++ Severity:S2 (Serious)
Version:mysql++-2.0.4 OS:Windows (Windows)
Assigned to: CPU Architecture:Any

[7 Sep 2005 5:59] Dmitriy
Description:
Access violation in this code: (query.h, line 188-198)
[code]
	Query(Connection* c, bool te = true) :
	std::ostream(&sbuffer_), ///!!! error sbuffer_ not initialized yet!
	OptionalExceptions(te),
	Lockable(false),
	def(this),
	conn_(c),
	success_(false)
	{
		success_ = true;
	}
[/code]

There is wrong members initialization in this code 

How to repeat:
Compile in Visual Studio .NET 2003 with STLPort library; try any code such as:
[code]
Connection con;
Query q = con.query();
[/code]
there is an access violation thrown.

Suggested fix:
add before class Query:

[code]
class QueryBuffer
{
protected:
    /// \brief String buffer for storing assembled query
    std::stringbuf sbuffer_;
};
[/code]

and modify Query:

[code]
class Query : public QueryBuffer, public std::ostream,
		public OptionalExceptions, public Lockable
[/code]

also remove sbuffer_ declaration from Query class.
[7 Sep 2005 23:43] MySQL Verification Team
Currently MySQL++ isn't maintained for our developers.
Thank you for the bug report.