www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Strange bug


This code is from dbi.mysql.mysqldatabase . I have commented few lines and
later when I try to fetch some rows I get access violation in libmysql.dll .
But if I uncoment the line with mysql_error or change it to something like "int
a=0; if(a) mysql_error(connection);" it works. You guys have any ideas what
could cause this? A linker error maybe?

override MysqlResult query (char[] sql) {
		mysql_real_query(connection, toCString(sql), sql.length);
		MYSQL_RES* results = mysql_store_result(connection);
		if (results is null) {
		        //Cout("query(): ");
			throw new DBIException("Unable to query the MySQL database.", sql);
		assert (results !is null);
		return new MysqlResult(results);
Oct 01 2007