refactor THD::raise_condition() family
to remove Sql_condition* raise_condition(const Sql_condition *cond) { Sql_condition *raised= raise_condition(cond->get_sql_errno(), cond->get_sqlstate(), cond->get_level(), *cond, cond->get_message_text()); return raised; }
This commit is contained in:
parent
a398fcbff6
commit
b73b736506
@ -3269,7 +3269,7 @@ void my_message_sql(uint error, const char *str, myf MyFlags)
|
|||||||
{
|
{
|
||||||
if (unlikely(MyFlags & ME_FATAL))
|
if (unlikely(MyFlags & ME_FATAL))
|
||||||
thd->is_fatal_error= 1;
|
thd->is_fatal_error= 1;
|
||||||
(void) thd->raise_condition(error, NULL, level, str);
|
(void) thd->raise_condition(error, "\0\0\0\0\0", level, str);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mysql_audit_general(0, MYSQL_AUDIT_GENERAL_ERROR, error, str);
|
mysql_audit_general(0, MYSQL_AUDIT_GENERAL_ERROR, error, str);
|
||||||
|
@ -965,10 +965,8 @@ Internal_error_handler *THD::pop_internal_handler()
|
|||||||
void THD::raise_error(uint sql_errno)
|
void THD::raise_error(uint sql_errno)
|
||||||
{
|
{
|
||||||
const char* msg= ER_THD(this, sql_errno);
|
const char* msg= ER_THD(this, sql_errno);
|
||||||
(void) raise_condition(sql_errno,
|
(void) raise_condition(sql_errno, "\0\0\0\0\0",
|
||||||
NULL,
|
Sql_condition::WARN_LEVEL_ERROR, msg);
|
||||||
Sql_condition::WARN_LEVEL_ERROR,
|
|
||||||
msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void THD::raise_error_printf(uint sql_errno, ...)
|
void THD::raise_error_printf(uint sql_errno, ...)
|
||||||
@ -981,20 +979,16 @@ void THD::raise_error_printf(uint sql_errno, ...)
|
|||||||
va_start(args, sql_errno);
|
va_start(args, sql_errno);
|
||||||
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
|
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
(void) raise_condition(sql_errno,
|
(void) raise_condition(sql_errno, "\0\0\0\0\0",
|
||||||
NULL,
|
Sql_condition::WARN_LEVEL_ERROR, ebuff);
|
||||||
Sql_condition::WARN_LEVEL_ERROR,
|
|
||||||
ebuff);
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void THD::raise_warning(uint sql_errno)
|
void THD::raise_warning(uint sql_errno)
|
||||||
{
|
{
|
||||||
const char* msg= ER_THD(this, sql_errno);
|
const char* msg= ER_THD(this, sql_errno);
|
||||||
(void) raise_condition(sql_errno,
|
(void) raise_condition(sql_errno, "\0\0\0\0\0",
|
||||||
NULL,
|
Sql_condition::WARN_LEVEL_WARN, msg);
|
||||||
Sql_condition::WARN_LEVEL_WARN,
|
|
||||||
msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void THD::raise_warning_printf(uint sql_errno, ...)
|
void THD::raise_warning_printf(uint sql_errno, ...)
|
||||||
@ -1007,10 +1001,8 @@ void THD::raise_warning_printf(uint sql_errno, ...)
|
|||||||
va_start(args, sql_errno);
|
va_start(args, sql_errno);
|
||||||
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
|
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
(void) raise_condition(sql_errno,
|
(void) raise_condition(sql_errno, "\0\0\0\0\0",
|
||||||
NULL,
|
Sql_condition::WARN_LEVEL_WARN, ebuff);
|
||||||
Sql_condition::WARN_LEVEL_WARN,
|
|
||||||
ebuff);
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1021,10 +1013,8 @@ void THD::raise_note(uint sql_errno)
|
|||||||
if (!(variables.option_bits & OPTION_SQL_NOTES))
|
if (!(variables.option_bits & OPTION_SQL_NOTES))
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
const char* msg= ER_THD(this, sql_errno);
|
const char* msg= ER_THD(this, sql_errno);
|
||||||
(void) raise_condition(sql_errno,
|
(void) raise_condition(sql_errno, "\0\0\0\0\0",
|
||||||
NULL,
|
Sql_condition::WARN_LEVEL_NOTE, msg);
|
||||||
Sql_condition::WARN_LEVEL_NOTE,
|
|
||||||
msg);
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1040,21 +1030,20 @@ void THD::raise_note_printf(uint sql_errno, ...)
|
|||||||
va_start(args, sql_errno);
|
va_start(args, sql_errno);
|
||||||
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
|
my_vsnprintf(ebuff, sizeof(ebuff), format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
(void) raise_condition(sql_errno,
|
(void) raise_condition(sql_errno, "\0\0\0\0\0",
|
||||||
NULL,
|
Sql_condition::WARN_LEVEL_NOTE, ebuff);
|
||||||
Sql_condition::WARN_LEVEL_NOTE,
|
|
||||||
ebuff);
|
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sql_condition* THD::raise_condition(uint sql_errno,
|
Sql_condition* THD::raise_condition(const Sql_condition *cond)
|
||||||
const char* sqlstate,
|
|
||||||
Sql_condition::enum_warning_level level,
|
|
||||||
const Sql_user_condition_identity &ucid,
|
|
||||||
const char* msg)
|
|
||||||
{
|
{
|
||||||
|
uint sql_errno= cond->get_sql_errno();
|
||||||
|
const char *sqlstate= cond->get_sqlstate();
|
||||||
|
Sql_condition::enum_warning_level level= cond->get_level();
|
||||||
|
const char *msg= cond->get_message_text();
|
||||||
|
|
||||||
Diagnostics_area *da= get_stmt_da();
|
Diagnostics_area *da= get_stmt_da();
|
||||||
Sql_condition *cond= NULL;
|
Sql_condition *raised= NULL;
|
||||||
DBUG_ENTER("THD::raise_condition");
|
DBUG_ENTER("THD::raise_condition");
|
||||||
DBUG_ASSERT(level < Sql_condition::WARN_LEVEL_END);
|
DBUG_ASSERT(level < Sql_condition::WARN_LEVEL_END);
|
||||||
|
|
||||||
@ -1082,22 +1071,18 @@ Sql_condition* THD::raise_condition(uint sql_errno,
|
|||||||
sql_errno= ER_UNKNOWN_ERROR;
|
sql_errno= ER_UNKNOWN_ERROR;
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
msg= ER_THD(this, sql_errno);
|
msg= ER_THD(this, sql_errno);
|
||||||
if (sqlstate == NULL)
|
if (!*sqlstate)
|
||||||
sqlstate= mysql_errno_to_sqlstate(sql_errno);
|
sqlstate= mysql_errno_to_sqlstate(sql_errno);
|
||||||
|
|
||||||
if ((level == Sql_condition::WARN_LEVEL_WARN) &&
|
if ((level == Sql_condition::WARN_LEVEL_WARN) && really_abort_on_warning())
|
||||||
really_abort_on_warning())
|
|
||||||
{
|
{
|
||||||
/*
|
/* FIXME: push_warning and strict SQL_MODE case. */
|
||||||
FIXME:
|
|
||||||
push_warning and strict SQL_MODE case.
|
|
||||||
*/
|
|
||||||
level= Sql_condition::WARN_LEVEL_ERROR;
|
level= Sql_condition::WARN_LEVEL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_fatal_error &&
|
if (!is_fatal_error &&
|
||||||
handle_condition(sql_errno, sqlstate, &level, msg, &cond))
|
handle_condition(sql_errno, sqlstate, &level, msg, &raised))
|
||||||
DBUG_RETURN(cond);
|
goto ret;
|
||||||
|
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case Sql_condition::WARN_LEVEL_NOTE:
|
case Sql_condition::WARN_LEVEL_NOTE:
|
||||||
@ -1122,8 +1107,7 @@ Sql_condition* THD::raise_condition(uint sql_errno,
|
|||||||
With wsrep we allow converting BF abort error to warning if
|
With wsrep we allow converting BF abort error to warning if
|
||||||
errors are ignored.
|
errors are ignored.
|
||||||
*/
|
*/
|
||||||
if (!is_fatal_error &&
|
if (!is_fatal_error && no_errors &&
|
||||||
no_errors &&
|
|
||||||
(wsrep_trx().bf_aborted() || wsrep_retry_counter))
|
(wsrep_trx().bf_aborted() || wsrep_retry_counter))
|
||||||
{
|
{
|
||||||
WSREP_DEBUG("BF abort error converted to warning");
|
WSREP_DEBUG("BF abort error converted to warning");
|
||||||
@ -1134,7 +1118,7 @@ Sql_condition* THD::raise_condition(uint sql_errno,
|
|||||||
if (!da->is_error())
|
if (!da->is_error())
|
||||||
{
|
{
|
||||||
set_row_count_func(-1);
|
set_row_count_func(-1);
|
||||||
da->set_error_status(sql_errno, msg, sqlstate, ucid, cond);
|
da->set_error_status(sql_errno, msg, sqlstate, *cond, raised);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1149,10 +1133,13 @@ Sql_condition* THD::raise_condition(uint sql_errno,
|
|||||||
if (likely(!(is_fatal_error && (sql_errno == EE_OUTOFMEMORY ||
|
if (likely(!(is_fatal_error && (sql_errno == EE_OUTOFMEMORY ||
|
||||||
sql_errno == ER_OUTOFMEMORY))))
|
sql_errno == ER_OUTOFMEMORY))))
|
||||||
{
|
{
|
||||||
cond= da->push_warning(this, sql_errno, sqlstate, level, ucid, msg,
|
raised= da->push_warning(this, sql_errno, sqlstate, level, *cond, msg,
|
||||||
da->current_row_for_warning());
|
cond->m_row_number);
|
||||||
}
|
}
|
||||||
DBUG_RETURN(cond);
|
ret:
|
||||||
|
if (raised)
|
||||||
|
raised->copy_opt_attributes(cond);
|
||||||
|
DBUG_RETURN(raised);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -4801,45 +4801,17 @@ private:
|
|||||||
@param msg the condition message text
|
@param msg the condition message text
|
||||||
@return The condition raised, or NULL
|
@return The condition raised, or NULL
|
||||||
*/
|
*/
|
||||||
Sql_condition*
|
Sql_condition* raise_condition(uint sql_errno, const char* sqlstate,
|
||||||
raise_condition(uint sql_errno,
|
Sql_condition::enum_warning_level level, const char* msg)
|
||||||
const char* sqlstate,
|
|
||||||
Sql_condition::enum_warning_level level,
|
|
||||||
const char* msg)
|
|
||||||
{
|
{
|
||||||
return raise_condition(sql_errno, sqlstate, level,
|
Sql_condition cond(NULL, // don't strdup the msg
|
||||||
Sql_user_condition_identity(), msg);
|
Sql_condition_identity(sql_errno, sqlstate, level,
|
||||||
|
Sql_user_condition_identity()),
|
||||||
|
msg, get_stmt_da()->current_row_for_warning());
|
||||||
|
return raise_condition(&cond);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
Sql_condition* raise_condition(const Sql_condition *cond);
|
||||||
Raise a generic or a user defined SQL condition.
|
|
||||||
@param ucid - the user condition identity
|
|
||||||
(or an empty identity if not a user condition)
|
|
||||||
@param sql_errno - the condition error number
|
|
||||||
@param sqlstate - the condition SQLSTATE
|
|
||||||
@param level - the condition level
|
|
||||||
@param msg - the condition message text
|
|
||||||
@return The condition raised, or NULL
|
|
||||||
*/
|
|
||||||
Sql_condition*
|
|
||||||
raise_condition(uint sql_errno,
|
|
||||||
const char* sqlstate,
|
|
||||||
Sql_condition::enum_warning_level level,
|
|
||||||
const Sql_user_condition_identity &ucid,
|
|
||||||
const char* msg);
|
|
||||||
|
|
||||||
Sql_condition*
|
|
||||||
raise_condition(const Sql_condition *cond)
|
|
||||||
{
|
|
||||||
Sql_condition *raised= raise_condition(cond->get_sql_errno(),
|
|
||||||
cond->get_sqlstate(),
|
|
||||||
cond->get_level(),
|
|
||||||
*cond/*Sql_user_condition_identity*/,
|
|
||||||
cond->get_message_text());
|
|
||||||
if (raised)
|
|
||||||
raised->copy_opt_attributes(cond);
|
|
||||||
return raised;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void push_warning_truncated_priv(Sql_condition::enum_warning_level level,
|
void push_warning_truncated_priv(Sql_condition::enum_warning_level level,
|
||||||
|
@ -217,7 +217,7 @@ Sql_condition::set_builtin_message_text(const char* str)
|
|||||||
*/
|
*/
|
||||||
const char* copy;
|
const char* copy;
|
||||||
|
|
||||||
copy= strdup_root(m_mem_root, str);
|
copy= m_mem_root ? strdup_root(m_mem_root, str) : str;
|
||||||
m_message_text.set(copy, strlen(copy), error_message_charset_info);
|
m_message_text.set(copy, strlen(copy), error_message_charset_info);
|
||||||
DBUG_ASSERT(! m_message_text.is_alloced());
|
DBUG_ASSERT(! m_message_text.is_alloced());
|
||||||
}
|
}
|
||||||
@ -727,7 +727,7 @@ void push_warning(THD *thd, Sql_condition::enum_warning_level level,
|
|||||||
if (level == Sql_condition::WARN_LEVEL_ERROR)
|
if (level == Sql_condition::WARN_LEVEL_ERROR)
|
||||||
level= Sql_condition::WARN_LEVEL_WARN;
|
level= Sql_condition::WARN_LEVEL_WARN;
|
||||||
|
|
||||||
(void) thd->raise_condition(code, NULL, level, msg);
|
(void) thd->raise_condition(code, "\0\0\0\0\0", level, msg);
|
||||||
|
|
||||||
/* Make sure we also count warnings pushed after calling set_ok_status(). */
|
/* Make sure we also count warnings pushed after calling set_ok_status(). */
|
||||||
thd->get_stmt_da()->increment_warning();
|
thd->get_stmt_da()->increment_warning();
|
||||||
|
@ -443,7 +443,6 @@ private:
|
|||||||
const char *msg, ulong current_row_for_warning)
|
const char *msg, ulong current_row_for_warning)
|
||||||
: Sql_condition_identity(value), m_mem_root(mem_root)
|
: Sql_condition_identity(value), m_mem_root(mem_root)
|
||||||
{
|
{
|
||||||
DBUG_ASSERT(mem_root != NULL);
|
|
||||||
DBUG_ASSERT(value.get_sql_errno() != 0);
|
DBUG_ASSERT(value.get_sql_errno() != 0);
|
||||||
DBUG_ASSERT(msg != NULL);
|
DBUG_ASSERT(msg != NULL);
|
||||||
set_builtin_message_text(msg);
|
set_builtin_message_text(msg);
|
||||||
@ -746,10 +745,8 @@ private:
|
|||||||
|
|
||||||
@return a pointer to the added SQL-condition.
|
@return a pointer to the added SQL-condition.
|
||||||
*/
|
*/
|
||||||
Sql_condition *push_warning(THD *thd,
|
Sql_condition *push_warning(THD *thd, const Sql_condition_identity *identity,
|
||||||
const Sql_condition_identity *identity,
|
const char* msg, ulong current_row_number);
|
||||||
const char* msg,
|
|
||||||
ulong current_row_number);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add a new SQL-condition to the current list and increment the respective
|
Add a new SQL-condition to the current list and increment the respective
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <mysqld.h>
|
#include <mysqld.h>
|
||||||
|
#include <mysqld_error.h>
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include <sql_error.h>
|
#include <sql_error.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -22,7 +23,7 @@
|
|||||||
|
|
||||||
#define MEMFIX 4096
|
#define MEMFIX 4096
|
||||||
#if defined(connect_EXPORTS)
|
#if defined(connect_EXPORTS)
|
||||||
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
|
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, M)
|
||||||
#else
|
#else
|
||||||
#define PUSH_WARNING(M) htrc(M)
|
#define PUSH_WARNING(M) htrc(M)
|
||||||
#endif
|
#endif
|
||||||
|
@ -516,7 +516,7 @@ void SetWorkSize(size_t)
|
|||||||
{
|
{
|
||||||
// Changing the session variable value seems to be impossible here
|
// Changing the session variable value seems to be impossible here
|
||||||
// and should be done in a check function
|
// and should be done in a check function
|
||||||
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
|
push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
|
||||||
"Work size too big, try setting a smaller value");
|
"Work size too big, try setting a smaller value");
|
||||||
} // end of SetWorkSize
|
} // end of SetWorkSize
|
||||||
|
|
||||||
@ -719,7 +719,7 @@ void PushWarning(PGLOBAL g, THD *thd, int level)
|
|||||||
Sql_condition::enum_warning_level wlvl;
|
Sql_condition::enum_warning_level wlvl;
|
||||||
|
|
||||||
wlvl= (Sql_condition::enum_warning_level)level;
|
wlvl= (Sql_condition::enum_warning_level)level;
|
||||||
push_warning(thd, wlvl, 0, g->Message);
|
push_warning(thd, wlvl, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} else
|
} else
|
||||||
htrc("%s\n", g->Message);
|
htrc("%s\n", g->Message);
|
||||||
|
|
||||||
@ -2298,7 +2298,7 @@ int ha_connect::MakeRecord(char *buf)
|
|||||||
fp->field_name.str,
|
fp->field_name.str,
|
||||||
thd->get_stmt_da()->current_row_for_warning());
|
thd->get_stmt_da()->current_row_for_warning());
|
||||||
|
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, buf);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf);
|
||||||
DBUG_PRINT("MakeRecord", ("%s", buf));
|
DBUG_PRINT("MakeRecord", ("%s", buf));
|
||||||
rc= 0;
|
rc= 0;
|
||||||
} else if (rc < 0)
|
} else if (rc < 0)
|
||||||
@ -3591,7 +3591,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
|
|||||||
|
|
||||||
if ((rc= ((PTDBASE)tdbp)->ResetTableOpt(g, dop, dox))) {
|
if ((rc= ((PTDBASE)tdbp)->ResetTableOpt(g, dop, dox))) {
|
||||||
if (rc == RC_INFO) {
|
if (rc == RC_INFO) {
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
rc= 0;
|
rc= 0;
|
||||||
} else
|
} else
|
||||||
rc= HA_ERR_CRASHED_ON_USAGE; // Table must be repaired
|
rc= HA_ERR_CRASHED_ON_USAGE; // Table must be repaired
|
||||||
@ -4816,7 +4816,7 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type)
|
|||||||
if (newmode == MODE_ANY) {
|
if (newmode == MODE_ANY) {
|
||||||
if (CloseTable(g)) {
|
if (CloseTable(g)) {
|
||||||
// Make error a warning to avoid crash
|
// Make error a warning to avoid crash
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
rc= 0;
|
rc= 0;
|
||||||
} // endif Close
|
} // endif Close
|
||||||
|
|
||||||
@ -4898,18 +4898,18 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
&& sqlcom != SQLCOM_BEGIN
|
&& sqlcom != SQLCOM_BEGIN
|
||||||
&& sqlcom != SQLCOM_DROP_TABLE) {
|
&& sqlcom != SQLCOM_DROP_TABLE) {
|
||||||
sprintf(g->Message, "external_lock: unexpected command %d", sqlcom);
|
sprintf(g->Message, "external_lock: unexpected command %d", sqlcom);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
} else if (g->Xchk) {
|
} else if (g->Xchk) {
|
||||||
if (!tdbp) {
|
if (!tdbp) {
|
||||||
if (!(tdbp= GetTDB(g))) {
|
if (!(tdbp= GetTDB(g))) {
|
||||||
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
|
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
} else if (!tdbp->GetDef()->Indexable()) {
|
} else if (!tdbp->GetDef()->Indexable()) {
|
||||||
sprintf(g->Message, "external_lock: Table %s is not indexable", tdbp->GetName());
|
sprintf(g->Message, "external_lock: Table %s is not indexable", tdbp->GetName());
|
||||||
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
|
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
} else if (tdbp->GetDef()->Indexable() == 1) {
|
} else if (tdbp->GetDef()->Indexable() == 1) {
|
||||||
bool oldsep= ((PCHK)g->Xchk)->oldsep;
|
bool oldsep= ((PCHK)g->Xchk)->oldsep;
|
||||||
@ -4988,7 +4988,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
if (tdp->MakeIndex(g, adp, true) == RC_FX) {
|
if (tdp->MakeIndex(g, adp, true) == RC_FX) {
|
||||||
// Make it a warning to avoid crash
|
// Make it a warning to avoid crash
|
||||||
//push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
|
//push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||||
// 0, g->Message);
|
// ER_UNKNOWN_ERROR, g->Message);
|
||||||
//rc= 0;
|
//rc= 0;
|
||||||
my_message(ER_TOO_MANY_KEYS, g->Message, MYF(0));
|
my_message(ER_TOO_MANY_KEYS, g->Message, MYF(0));
|
||||||
rc= HA_ERR_INDEX_CORRUPT;
|
rc= HA_ERR_INDEX_CORRUPT;
|
||||||
@ -4998,7 +4998,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
if (CheckVirtualIndex(NULL)) {
|
if (CheckVirtualIndex(NULL)) {
|
||||||
// Make it a warning to avoid crash
|
// Make it a warning to avoid crash
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
|
||||||
0, g->Message);
|
ER_UNKNOWN_ERROR, g->Message);
|
||||||
rc= 0;
|
rc= 0;
|
||||||
} // endif Check
|
} // endif Check
|
||||||
|
|
||||||
@ -5011,7 +5011,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
|
|||||||
if (CloseTable(g)) {
|
if (CloseTable(g)) {
|
||||||
// This is an error while builing index
|
// This is an error while builing index
|
||||||
// Make it a warning to avoid crash
|
// Make it a warning to avoid crash
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
rc= 0;
|
rc= 0;
|
||||||
} // endif Close
|
} // endif Close
|
||||||
|
|
||||||
@ -5722,7 +5722,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS";
|
topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS";
|
||||||
ttp= GetTypeID(topt->type);
|
ttp= GetTypeID(topt->type);
|
||||||
sprintf(g->Message, "No table_type. Was set to %s", topt->type);
|
sprintf(g->Message, "No table_type. Was set to %s", topt->type);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} else if (ttp == TAB_NIY) {
|
} else if (ttp == TAB_NIY) {
|
||||||
sprintf(g->Message, "Unsupported table type %s", topt->type);
|
sprintf(g->Message, "Unsupported table type %s", topt->type);
|
||||||
rc= HA_ERR_INTERNAL_ERROR;
|
rc= HA_ERR_INTERNAL_ERROR;
|
||||||
@ -5732,7 +5732,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
if (ttp == TAB_UNDEF) {
|
if (ttp == TAB_UNDEF) {
|
||||||
ttr= TAB_JSON;
|
ttr= TAB_JSON;
|
||||||
strcpy(g->Message, "No table_type. Was set to JSON");
|
strcpy(g->Message, "No table_type. Was set to JSON");
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} else
|
} else
|
||||||
ttr= ttp;
|
ttr= ttp;
|
||||||
|
|
||||||
@ -6295,7 +6295,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
// Skip this column
|
// Skip this column
|
||||||
sprintf(g->Message, "Column %s skipped (unsupported type %d)",
|
sprintf(g->Message, "Column %s skipped (unsupported type %d)",
|
||||||
cnm, typ);
|
cnm, typ);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
sprintf(g->Message, "Unsupported SQL type %d", typ);
|
sprintf(g->Message, "Unsupported SQL type %d", typ);
|
||||||
@ -6310,7 +6310,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
case TYPE_STRING:
|
case TYPE_STRING:
|
||||||
if (w) {
|
if (w) {
|
||||||
sprintf(g->Message, "Column %s is wide characters", cnm);
|
sprintf(g->Message, "Column %s is wide characters", cnm);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} // endif w
|
} // endif w
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -6337,7 +6337,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
|
|||||||
// Skip this column
|
// Skip this column
|
||||||
sprintf(g->Message, "Column %s skipped (unsupported type %d)",
|
sprintf(g->Message, "Column %s skipped (unsupported type %d)",
|
||||||
cnm, typ);
|
cnm, typ);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
sprintf(g->Message, "Unsupported SQL type %d", typ);
|
sprintf(g->Message, "Unsupported SQL type %d", typ);
|
||||||
@ -6502,7 +6502,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
sprintf(g->Message, "No table_type. Will be set to %s", options->type);
|
sprintf(g->Message, "No table_type. Will be set to %s", options->type);
|
||||||
|
|
||||||
if (sqlcom == SQLCOM_CREATE_TABLE)
|
if (sqlcom == SQLCOM_CREATE_TABLE)
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
|
|
||||||
} else if (type == TAB_NIY) {
|
} else if (type == TAB_NIY) {
|
||||||
sprintf(g->Message, "Unsupported table type %s", options->type);
|
sprintf(g->Message, "Unsupported table type %s", options->type);
|
||||||
@ -6551,7 +6551,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
case TAB_OCCUR:
|
case TAB_OCCUR:
|
||||||
if (options->srcdef) {
|
if (options->srcdef) {
|
||||||
strcpy(g->Message, "Cannot check looping reference");
|
strcpy(g->Message, "Cannot check looping reference");
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} else if (options->tabname) {
|
} else if (options->tabname) {
|
||||||
if (!stricmp(options->tabname, create_info->alias.str) &&
|
if (!stricmp(options->tabname, create_info->alias.str) &&
|
||||||
(!options->dbname ||
|
(!options->dbname ||
|
||||||
@ -6847,7 +6847,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
sprintf(g->Message, "No file name. Table will use %s", buf);
|
sprintf(g->Message, "No file name. Table will use %s", buf);
|
||||||
|
|
||||||
if (sqlcom == SQLCOM_CREATE_TABLE)
|
if (sqlcom == SQLCOM_CREATE_TABLE)
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
|
|
||||||
strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
|
strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
|
||||||
} // endif part_info
|
} // endif part_info
|
||||||
@ -6860,12 +6860,12 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
else
|
else
|
||||||
sprintf(g->Message, "Error %d creating file %s", errno, fn);
|
sprintf(g->Message, "Error %d creating file %s", errno, fn);
|
||||||
|
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} else
|
} else
|
||||||
::close(h);
|
::close(h);
|
||||||
|
|
||||||
if ((type == TAB_FMT || options->readonly) && sqlcom == SQLCOM_CREATE_TABLE)
|
if ((type == TAB_FMT || options->readonly) && sqlcom == SQLCOM_CREATE_TABLE)
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
|
||||||
"Congratulation, you just created a read-only void table!");
|
"Congratulation, you just created a read-only void table!");
|
||||||
|
|
||||||
} // endif sqlcom
|
} // endif sqlcom
|
||||||
@ -6911,7 +6911,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
sqlcom == SQLCOM_CREATE_INDEX || sqlcom == SQLCOM_DROP_INDEX))
|
sqlcom == SQLCOM_CREATE_INDEX || sqlcom == SQLCOM_DROP_INDEX))
|
||||||
// (sqlcom == SQLCOM_CREATE_INDEX && part_info) ||
|
// (sqlcom == SQLCOM_CREATE_INDEX && part_info) ||
|
||||||
// (sqlcom == SQLCOM_DROP_INDEX && part_info)))
|
// (sqlcom == SQLCOM_DROP_INDEX && part_info)))
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
|
||||||
"Unexpected command in create, please contact CONNECT team");
|
"Unexpected command in create, please contact CONNECT team");
|
||||||
|
|
||||||
if (part_info && !inward)
|
if (part_info && !inward)
|
||||||
@ -6922,7 +6922,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
|
|||||||
(!IsFileType(type) || FileExists(options->filename, false))) {
|
(!IsFileType(type) || FileExists(options->filename, false))) {
|
||||||
if (part_info) {
|
if (part_info) {
|
||||||
sprintf(g->Message, "Data repartition in %s is unchecked", partname);
|
sprintf(g->Message, "Data repartition in %s is unchecked", partname);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} else if (sqlcom == SQLCOM_ALTER_TABLE) {
|
} else if (sqlcom == SQLCOM_ALTER_TABLE) {
|
||||||
// This is an ALTER to CONNECT from another engine.
|
// This is an ALTER to CONNECT from another engine.
|
||||||
// It cannot be accepted because the table data would be modified
|
// It cannot be accepted because the table data would be modified
|
||||||
@ -7035,7 +7035,7 @@ bool ha_connect::FileExists(const char *fn, bool bf)
|
|||||||
char buf[_MAX_PATH + 20];
|
char buf[_MAX_PATH + 20];
|
||||||
|
|
||||||
sprintf(buf, "Error %d for file %s", errno, filename);
|
sprintf(buf, "Error %d for file %s", errno, filename);
|
||||||
push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, 0, buf);
|
push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf);
|
||||||
return true;
|
return true;
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
@ -7337,7 +7337,7 @@ fin:
|
|||||||
DBUG_RETURN(HA_ALTER_ERROR);
|
DBUG_RETURN(HA_ALTER_ERROR);
|
||||||
} else if (outward) {
|
} else if (outward) {
|
||||||
if (IsFileType(type))
|
if (IsFileType(type))
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
|
||||||
"This is an outward table, table data were not modified.");
|
"This is an outward table, table data were not modified.");
|
||||||
|
|
||||||
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
|
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
|
||||||
@ -7363,7 +7363,7 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *, uint)
|
|||||||
{
|
{
|
||||||
DBUG_ENTER("ha_connect::check_if_incompatible_data");
|
DBUG_ENTER("ha_connect::check_if_incompatible_data");
|
||||||
// TO DO: really implement and check it.
|
// TO DO: really implement and check it.
|
||||||
push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, 0,
|
push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
|
||||||
"Unexpected call to check_if_incompatible_data.");
|
"Unexpected call to check_if_incompatible_data.");
|
||||||
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
DBUG_RETURN(COMPATIBLE_DATA_NO);
|
||||||
} // end of check_if_incompatible_data
|
} // end of check_if_incompatible_data
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
/*********************************************************************************/
|
/*********************************************************************************/
|
||||||
#include <my_global.h>
|
#include <my_global.h>
|
||||||
#include <mysqld.h>
|
#include <mysqld.h>
|
||||||
|
#include <mysqld_error.h>
|
||||||
#include <mysql.h>
|
#include <mysql.h>
|
||||||
#include <sql_error.h>
|
#include <sql_error.h>
|
||||||
#include <m_string.h>
|
#include <m_string.h>
|
||||||
@ -21,7 +22,7 @@
|
|||||||
|
|
||||||
#define MEMFIX 4096
|
#define MEMFIX 4096
|
||||||
#if defined(connect_EXPORTS)
|
#if defined(connect_EXPORTS)
|
||||||
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
|
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, M)
|
||||||
#else
|
#else
|
||||||
#define PUSH_WARNING(M) htrc(M)
|
#define PUSH_WARNING(M) htrc(M)
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#include <my_global.h> // All MariaDB stuff
|
#include <my_global.h> // All MariaDB stuff
|
||||||
#include <mysqld.h>
|
#include <mysqld.h>
|
||||||
|
#include <mysqld_error.h>
|
||||||
#include <sql_error.h>
|
#include <sql_error.h>
|
||||||
#if !defined(_WIN32) && !defined(_WINDOWS)
|
#if !defined(_WIN32) && !defined(_WINDOWS)
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@ -37,7 +38,7 @@
|
|||||||
#include "tabrest.h"
|
#include "tabrest.h"
|
||||||
|
|
||||||
#if defined(connect_EXPORTS)
|
#if defined(connect_EXPORTS)
|
||||||
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, 0, M)
|
#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, M)
|
||||||
#else
|
#else
|
||||||
#define PUSH_WARNING(M) htrc(M)
|
#define PUSH_WARNING(M) htrc(M)
|
||||||
#endif
|
#endif
|
||||||
|
@ -205,7 +205,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||||||
if (v == 'K') {
|
if (v == 'K') {
|
||||||
// Skip this column
|
// Skip this column
|
||||||
sprintf(g->Message, "Column %s skipped (unsupported type)", colname);
|
sprintf(g->Message, "Column %s skipped (unsupported type)", colname);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
continue;
|
continue;
|
||||||
} // endif v
|
} // endif v
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
|
|||||||
len = zconv;
|
len = zconv;
|
||||||
sprintf(g->Message, "Column %s converted to varchar(%d)",
|
sprintf(g->Message, "Column %s converted to varchar(%d)",
|
||||||
colname, len);
|
colname, len);
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
|
push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
|
||||||
} // endif v
|
} // endif v
|
||||||
|
|
||||||
crp = crp->Next; // Data_Type
|
crp = crp->Next; // Data_Type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user