| 1330 | extern "C" void my_message_sql(uint error, const char *str, myf MyFlags); |
| 1331 | |
| 1332 | void my_message_sql(uint error, const char *str, myf MyFlags) |
| 1333 | { |
| 1334 | THD *thd= current_thd; |
| 1335 | DBUG_ENTER("my_message_sql"); |
| 1336 | DBUG_PRINT("error", ("error: %u message: '%s'", error, str)); |
| 1337 | |
| 1338 | DBUG_ASSERT(str != NULL); |
| 1339 | /* |
| 1340 | An error should have a valid error number (!= 0), so it can be caught |
| 1341 | in stored procedures by SQL exception handlers. |
| 1342 | Calling my_error() with error == 0 is a bug. |
| 1343 | Remaining known places to fix: |
| 1344 | - storage/myisam/mi_create.c, my_printf_error() |
| 1345 | TODO: |
| 1346 | DBUG_ASSERT(error != 0); |
| 1347 | */ |
| 1348 | |
| 1349 | if (error == 0) |
| 1350 | { |
| 1351 | /* At least, prevent new abuse ... */ |
| 1352 | DBUG_ASSERT(strncmp(str, "MyISAM table", 12) == 0); |
| 1353 | error= ER_UNKNOWN_ERROR; |
| 1354 | } |
| 1355 | |
| 1356 | if (thd) |
| 1357 | { |
| 1358 | if (MyFlags & ME_FATALERROR) |
| 1359 | thd->is_fatal_error= 1; |
| 1360 | (void) thd->raise_condition(error, |
| 1361 | NULL, |
| 1362 | Sql_condition::WARN_LEVEL_ERROR, |
| 1363 | str); |
| 1364 | } |
| 1365 | |
| 1366 | /* When simulating OOM, skip writing to error log to avoid mtr errors */ |
| 1367 | DBUG_EXECUTE_IF("simulate_out_of_memory", DBUG_VOID_RETURN;); |
| 1368 | |
| 1369 | if (!thd || MyFlags & ME_NOREFRESH) |
| 1370 | sql_print_error("%s: %s",my_progname,str); /* purecov: inspected */ |
| 1371 | DBUG_VOID_RETURN; |
| 1372 | } |
| 1373 | |
| 1374 | |
| 1375 | #ifndef EMBEDDED_LIBRARY |
nothing calls this directly
no test coverage detected