MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / insert

Method insert

sql/sql_class.cc:1622–1647  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1620*/
1621
1622int Statement_map::insert(THD *thd, Statement *statement)
1623{
1624 if (my_hash_insert(&st_hash, (uchar*) statement))
1625 {
1626 /*
1627 Delete is needed only in case of an insert failure. In all other
1628 cases hash_delete will also delete the statement.
1629 */
1630 delete statement;
1631 my_error(ER_OUT_OF_RESOURCES, MYF(0));
1632 goto err_st_hash;
1633 }
1634 if (statement->name.str && my_hash_insert(&names_hash, (uchar*) statement))
1635 {
1636 my_error(ER_OUT_OF_RESOURCES, MYF(0));
1637 goto err_names_hash;
1638 }
1639
1640 last_found_statement= statement;
1641 return 0;
1642
1643err_names_hash:
1644 my_hash_delete(&st_hash, (uchar*) statement);
1645err_st_hash:
1646 return 1;
1647}
1648
1649
1650void Statement_map::close_transient_cursors()

Callers 6

add_global_threadFunction · 0.45
find_join_elements_newFunction · 0.45
print_indexFunction · 0.45
get_key_nameFunction · 0.45
mysql_sql_parse_adminFunction · 0.45

Calls 3

my_hash_insertFunction · 0.85
my_errorFunction · 0.85
my_hash_deleteFunction · 0.85

Tested by

no test coverage detected