// 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; }
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; }
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; }
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; }
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. "; } }
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; } }