예제 #1
0
void CheevoTracker::printSQLException(sql::SQLException& e) {
	std::cout << "# ERR: SQLException in " << __FILE__;
	std::cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << std::endl;
	std::cout << "# ERR: " << e.what();
	std::cout << " (MySQL error code: " << e.getErrorCode();
	std::cout << ", SQLState: " << e.getSQLState() << " )" << std::endl;
}
예제 #2
0
// handling of mysql database exceptions. 
void handleException(sql::SQLException e) {
  cout << "# ERROR: SQLException in " << __FILE__;
  cout << "# ERROR: " << e.what();
  cout << " (MySQL error code: " << e.getErrorCode();
  cout << ", SQLState: " << e.getSQLState() << " )" << endl;
  return; 
}
예제 #3
0
파일: BD.cpp 프로젝트: emilio93/Proyecto217
void BD::manejarExcepcion(sql::SQLException &e, int line,
                          const char *function, const char *file) {
    std::cout << "# ERR: SQLException in " << file;
    std::cout << "(" << function << ") on line " << line;
    std::cout << std::endl << "# ERR: " << e.what();
    std::cout << " (MySQL error code: " << e.getErrorCode();
    std::cout << ", SQLState: " << e.getSQLState() << " )" << std::endl;
}
예제 #4
0
void MySqlImpl::printException(sql::SQLException &e)
{
	cout << "# ERR: SQLException in " << __FILE__
			<< "(" << __FUNCTION__ << ") on line " 
			<< __LINE__ << endl;
	cout<< "# ERR: " << e.what();
	cout << " (MySQL error code: " << e.getErrorCode();
	cout << ", SQLState: " << e.getSQLState() << " )" << endl;
}
예제 #5
0
 void _print_SQLException(sql::SQLException&e ){
     
     std::cout << "ERROR: " << e.what();
     std::cout << " (MySQL error code: " << e.getErrorCode();
     std::cout << ", SQLState: " << e.getSQLState() << ")" << std::endl;
     
     if (e.getErrorCode() == 1047) {
         std::cout << "\nSQL server does not seem to support prepared statements. MYSQL > 5.1 required. ";
     }
 }
예제 #6
0
void MySQL::warning(sql::SQLException e, string file, int line, string func, string query)
{
  if (e.getErrorCode() == 0)
    return ;
  ostringstream msg;
  msg << "WARNING: SQLException in " << file;
  msg << " (" << func << ") on line " << line << endl;
  msg << "WARNING: " << e.what();
  msg << " (MySQL error code: " << e.getErrorCode();
  msg << ", SQLState: " << e.getSQLState() << ")" << endl;
  msg << "WARNING: Query: " << query;
  upo::print_warning(msg.str());
}
예제 #7
0
/**
 * Create an error message related to SQL Exception
 */
void MySQLConnWrapper::manageException(sql::SQLException& e){

	if(e.getErrorCode() != 0){

		std::string msg = "SQL Exception : " + static_cast<std::string>(e.what());
		msg += " (MySQL error code : " + e.getErrorCode();
		msg += ", SQLState : " + e.getSQLState() + " )\n";

		std::cerr << msg << std::endl;

	}

}
db_error::db_error(const sql::SQLException &exc)
: std::runtime_error(exc.what()), _error(exc.getErrorCode())
{
}