Example #1
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. ";
     }
 }
Example #2
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());
}
/**
 * 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;

	}

}
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;
}
Example #5
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; 
}
Example #6
0
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;
}
Example #7
0
int newError(sql::SQLException &e) {

	int i = e.getErrorCode();
	unsigned int j = 0;
	if(i == 1317) j = 1;
	if(i == 2003) j = 2;
	return j;
}
Example #8
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;
}
db_error::db_error(const sql::SQLException &exc)
: std::runtime_error(exc.what()), _error(exc.getErrorCode())
{
}