MCPcopy Create free account
hub / github.com/MariaDB/server / update_non_unique_table_error

Function update_non_unique_table_error

sql/sql_base.cc:1420–1456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1418*/
1419
1420void update_non_unique_table_error(TABLE_LIST *update,
1421 const char *operation,
1422 TABLE_LIST *duplicate)
1423{
1424 update= update->top_table();
1425 duplicate= duplicate->top_table();
1426 if (!update->view || !duplicate->view ||
1427 update->view == duplicate->view ||
1428 !update->view_name.streq(duplicate->view_name) ||
1429 !update->view_db.streq(duplicate->view_db))
1430 {
1431 /*
1432 it is not the same view repeated (but it can be parts of the same copy
1433 of view), so we have to hide underlying tables.
1434 */
1435 if (update->view)
1436 {
1437 /* Issue the ER_NON_INSERTABLE_TABLE error for an INSERT */
1438 if (update->view == duplicate->view)
1439 my_error(!strncmp(operation, "INSERT", 6) ?
1440 ER_NON_INSERTABLE_TABLE : ER_NON_UPDATABLE_TABLE, MYF(0),
1441 update->alias.str, operation);
1442 else
1443 my_error(ER_VIEW_PREVENT_UPDATE, MYF(0),
1444 (duplicate->view ? duplicate->alias.str : update->alias.str),
1445 operation, update->alias.str);
1446 return;
1447 }
1448 if (duplicate->view)
1449 {
1450 my_error(ER_VIEW_PREVENT_UPDATE, MYF(0), duplicate->alias.str, operation,
1451 update->alias.str);
1452 return;
1453 }
1454 }
1455 my_error(ER_UPDATE_TABLE_USED, MYF(0), update->alias.str, operation);
1456}
1457
1458
1459/**

Callers 4

mysql_prepare_insertFunction · 0.85
check_unique_tableFunction · 0.85
mysql_create_like_tableFunction · 0.85
executeMethod · 0.85

Calls 3

my_errorFunction · 0.85
top_tableMethod · 0.80
streqMethod · 0.45

Tested by

no test coverage detected