#include <item.h>
Inheritance diagram for Item_trigger_field:


Public Types | |
| OLD_ROW | |
| NEW_ROW | |
| enum | row_version_type { OLD_ROW, NEW_ROW } |
Public Member Functions | |
| Item_trigger_field (Name_resolution_context *context_arg, row_version_type row_ver_arg, const char *field_name_arg, ulong priv, const bool ro) | |
| void | setup_field (THD *thd, TABLE *table, GRANT_INFO *table_grant_info) |
| enum Type | type () const |
| bool | eq (const Item *item, bool binary_cmp) const |
| bool | fix_fields (THD *, Item **) |
| void | print (String *str) |
| table_map | used_tables () const |
| void | cleanup () |
| Settable_routine_parameter * | get_settable_routine_parameter () |
| bool | set_value (THD *thd, Item **it) |
Public Attributes | |
| row_version_type | row_version |
| Item_trigger_field * | next_trg_field |
| uint | field_idx |
| Table_triggers_list * | triggers |
Private Member Functions | |
| void | set_required_privilege (bool rw) |
| bool | set_value (THD *thd, sp_rcontext *ctx, Item **it) |
Private Attributes | |
| ulong | original_privilege |
| ulong | want_privilege |
| GRANT_INFO * | table_grants |
| bool | read_only |
Definition at line 2282 of file item.h.
| Item_trigger_field::Item_trigger_field | ( | Name_resolution_context * | context_arg, | |
| row_version_type | row_ver_arg, | |||
| const char * | field_name_arg, | |||
| ulong | priv, | |||
| const bool | ro | |||
| ) | [inline] |
Definition at line 2296 of file item.h.
02300 :Item_field(context_arg, 02301 (const char *)NULL, (const char *)NULL, field_name_arg), 02302 row_version(row_ver_arg), field_idx((uint)-1), original_privilege(priv), 02303 want_privilege(priv), table_grants(NULL), read_only (ro) 02304 {}
| void Item_trigger_field::cleanup | ( | ) | [virtual] |
Reimplemented from Item_field.
Definition at line 5579 of file item.cc.
References Item::cleanup(), original_privilege, and want_privilege.
05580 { 05581 want_privilege= original_privilege; 05582 /* 05583 Since special nature of Item_trigger_field we should not do most of 05584 things from Item_field::cleanup() or Item_ident::cleanup() here. 05585 */ 05586 Item::cleanup(); 05587 }
Here is the call graph for this function:

Reimplemented from Item_field.
Definition at line 5499 of file item.cc.
References Item_ident::field_name, my_strcasecmp, row_version, system_charset_info, Item::TRIGGER_FIELD_ITEM, and Item::type().
05500 { 05501 return item->type() == TRIGGER_FIELD_ITEM && 05502 row_version == ((Item_trigger_field *)item)->row_version && 05503 !my_strcasecmp(system_charset_info, field_name, 05504 ((Item_trigger_field *)item)->field_name); 05505 }
Here is the call graph for this function:

Reimplemented from Item_field.
Definition at line 5527 of file item.cc.
References check_grant_column(), st_table_share::db, DBUG_ASSERT, ER_BAD_FIELD_ERROR, FALSE, Item_field::field, field_idx, Item_ident::field_name, Item::fixed, my_error(), MYF, Table_triggers_list::new_field, NEW_ROW, Table_triggers_list::old_field, OLD_ROW, row_version, st_table::s, Item_field::set_field(), LEX_STRING::str, strlen(), Table_triggers_list::table, table_grants, st_table_share::table_name, triggers, TRUE, want_privilege, and st_grant_info::want_privilege.
Referenced by Table_triggers_list::create_trigger(), and set_value().
05528 { 05529 /* 05530 Since trigger is object tightly associated with TABLE object most 05531 of its set up can be performed during trigger loading i.e. trigger 05532 parsing! So we have little to do in fix_fields. :) 05533 */ 05534 05535 DBUG_ASSERT(fixed == 0); 05536 05537 /* Set field. */ 05538 05539 if (field_idx != (uint)-1) 05540 { 05541 #ifndef NO_EMBEDDED_ACCESS_CHECKS 05542 /* 05543 Check access privileges for the subject table. We check privileges only 05544 in runtime. 05545 */ 05546 05547 if (table_grants) 05548 { 05549 table_grants->want_privilege= want_privilege; 05550 05551 if (check_grant_column(thd, table_grants, triggers->table->s->db.str, 05552 triggers->table->s->table_name.str, field_name, 05553 strlen(field_name), thd->security_ctx)) 05554 return TRUE; 05555 } 05556 #endif // NO_EMBEDDED_ACCESS_CHECKS 05557 05558 field= (row_version == OLD_ROW) ? triggers->old_field[field_idx] : 05559 triggers->new_field[field_idx]; 05560 set_field(field); 05561 fixed= 1; 05562 return FALSE; 05563 } 05564 05565 my_error(ER_BAD_FIELD_ERROR, MYF(0), field_name, 05566 (row_version == NEW_ROW) ? "NEW" : "OLD"); 05567 return TRUE; 05568 }
Here is the call graph for this function:

Here is the caller graph for this function:

| Settable_routine_parameter* Item_trigger_field::get_settable_routine_parameter | ( | ) | [inline, virtual] |
| void Item_trigger_field::print | ( | String * | str | ) | [virtual] |
Reimplemented from Item_ident.
Definition at line 5571 of file item.cc.
References String::append(), Item_ident::field_name, NEW_ROW, and row_version.
Referenced by sp_instr_set_trigger_field::print().
05572 { 05573 str->append((row_version == NEW_ROW) ? "NEW" : "OLD", 3); 05574 str->append('.'); 05575 str->append(field_name); 05576 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_trigger_field::set_required_privilege | ( | bool | rw | ) | [private, virtual] |
Reimplemented from Settable_routine_parameter.
Definition at line 5508 of file item.cc.
References SELECT_ACL, UPDATE_ACL, and want_privilege.
05509 { 05510 /* 05511 Require SELECT and UPDATE privilege if this field will be read and 05512 set, and only UPDATE privilege for setting the field. 05513 */ 05514 want_privilege= (rw ? SELECT_ACL | UPDATE_ACL : UPDATE_ACL); 05515 }
| bool Item_trigger_field::set_value | ( | THD * | thd, | |
| sp_rcontext * | ctx, | |||
| Item ** | it | |||
| ) | [private, virtual] |
Implements Settable_routine_parameter.
Definition at line 5518 of file item.cc.
References Item_field::field, fix_fields(), Item::fixed, Item::save_in_field(), and sp_prepare_func_item().
Referenced by sp_instr_set_trigger_field::exec_core(), and set_value().
05519 { 05520 Item *item= sp_prepare_func_item(thd, it); 05521 05522 return (!item || (!fixed && fix_fields(thd, 0)) || 05523 (item->save_in_field(field, 0) < 0)); 05524 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void Item_trigger_field::setup_field | ( | THD * | thd, | |
| TABLE * | table, | |||
| GRANT_INFO * | table_grant_info | |||
| ) |
Definition at line 5475 of file item.cc.
References field_idx, Item_ident::field_name, find_field_in_table(), MARK_COLUMNS_NONE, strlen(), table_grants, st_table::triggers, and triggers.
Referenced by Table_triggers_list::create_trigger().
05477 { 05478 /* 05479 It is too early to mark fields used here, because before execution 05480 of statement that will invoke trigger other statements may use same 05481 TABLE object, so all such mark-up will be wiped out. 05482 So instead we do it in Table_triggers_list::mark_fields_used() 05483 method which is called during execution of these statements. 05484 */ 05485 enum_mark_columns save_mark_used_columns= thd->mark_used_columns; 05486 thd->mark_used_columns= MARK_COLUMNS_NONE; 05487 /* 05488 Try to find field by its name and if it will be found 05489 set field_idx properly. 05490 */ 05491 (void)find_field_in_table(thd, table, field_name, (uint) strlen(field_name), 05492 0, &field_idx); 05493 thd->mark_used_columns= save_mark_used_columns; 05494 triggers= table->triggers; 05495 table_grants= table_grant_info; 05496 }
Here is the call graph for this function:

Here is the caller graph for this function:

| enum Type Item_trigger_field::type | ( | ) | const [inline, virtual] |
Reimplemented from Item_field.
Definition at line 2306 of file item.h.
References Item::TRIGGER_FIELD_ITEM.
02306 { return TRIGGER_FIELD_ITEM; }
| table_map Item_trigger_field::used_tables | ( | ) | const [inline, virtual] |
Reimplemented from Item_field.
Definition at line 2310 of file item.h.
02310 { return (table_map)0L; }
Definition at line 2292 of file item.h.
Referenced by fix_fields(), Table_triggers_list::mark_fields_used(), and setup_field().
Definition at line 2290 of file item.h.
Referenced by Table_triggers_list::create_trigger(), and Table_triggers_list::mark_fields_used().
ulong Item_trigger_field::original_privilege [private] |
bool Item_trigger_field::read_only [private] |
GRANT_INFO* Item_trigger_field::table_grants [private] |
ulong Item_trigger_field::want_privilege [private] |
Definition at line 2340 of file item.h.
Referenced by cleanup(), fix_fields(), and set_required_privilege().
1.4.7

