Changeset - b9fc585e2628
[Not reviewed]
0 2 0
HanzZ - 14 years ago 2011-08-12 18:32:53
hanzz.k@gmail.com
print mysql errors
2 files changed with 5 insertions and 0 deletions:
0 comments (0 inline, 0 general)
include/transport/mysqlbackend.h
Show inline comments
 
@@ -111,10 +111,12 @@ class MySQLBackend : public StorageBackend
 
				Statement& operator >> (T& t);
 
			private:
 
				MYSQL_STMT *m_stmt;
 
				MYSQL *m_conn;
 
				std::vector<MYSQL_BIND> m_params;
 
				int m_resultOffset;
 
				int m_offset;
 
				int m_error;
 
				std::string m_string;
 
		};
 

	
 
		MYSQL m_conn;
src/mysqlbackend.cpp
Show inline comments
 
@@ -78,7 +78,9 @@ static LoggerPtr logger = Logger::getLogger("MySQLBackend");
 

	
 
MySQLBackend::Statement::Statement(MYSQL *conn, const std::string &format, const std::string &statement) {
 
	m_resultOffset = -1;
 
	m_conn = conn;
 
	m_offset = 0;
 
	m_string = statement;
 
	m_stmt = mysql_stmt_init(conn);
 
	if (mysql_stmt_prepare(m_stmt, statement.c_str(), statement.size())) {
 
		LOG4CXX_ERROR(logger, statement << " " << mysql_error(conn));
 
@@ -148,6 +150,7 @@ bool MySQLBackend::Statement::execute() {
 
	}
 

	
 
	if (mysql_stmt_execute(m_stmt)) {
 
		LOG4CXX_ERROR(logger, m_string << " " << mysql_error(m_conn));
 
		return false;
 
	}
 
	return true;
0 comments (0 inline, 0 general)