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

Function insert_precheck

sql/sql_parse.cc:9787–9809  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9785*/
9786
9787bool insert_precheck(THD *thd, TABLE_LIST *tables)
9788{
9789 LEX *lex= thd->lex;
9790 DBUG_ENTER("insert_precheck");
9791
9792 /*
9793 Check that we have modify privileges for the first table and
9794 select privileges for the rest
9795 */
9796 privilege_t privilege= (INSERT_ACL |
9797 (lex->duplicates == DUP_REPLACE ? DELETE_ACL : NO_ACL) |
9798 (lex->value_list.elements ? UPDATE_ACL : NO_ACL));
9799
9800 if (check_one_table_access(thd, privilege, tables))
9801 DBUG_RETURN(TRUE);
9802
9803 if (lex->update_list.elements != lex->value_list.elements)
9804 {
9805 my_message(ER_WRONG_VALUE_COUNT, ER_THD(thd, ER_WRONG_VALUE_COUNT), MYF(0));
9806 DBUG_RETURN(TRUE);
9807 }
9808 DBUG_RETURN(FALSE);
9809}
9810
9811
9812/**

Callers 3

sql_parse.ccFile · 0.85
mysql_test_insert_commonFunction · 0.85
mysql_test_insert_selectFunction · 0.85

Calls 2

my_messageFunction · 0.85
check_one_table_accessFunction · 0.70

Tested by

no test coverage detected