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

Method match_updatable_columns

sql/sql_trigger.cc:1245–1277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1243*/
1244
1245bool Trigger::match_updatable_columns(List<Item> &fields)
1246{
1247 DBUG_ASSERT(is_trg_event_on(events, TRG_EVENT_UPDATE));
1248
1249 /*
1250 No table columns were specified in OF col1, col2 ... colN of
1251 the statement CREATE TRIGGER BEFORE/AFTER UPDATE. It means that this
1252 ON UPDATE trigger can't be fired on every UPDATE statement involving
1253 the target table.
1254 */
1255 if (!updatable_columns || updatable_columns->is_empty())
1256 return true;
1257
1258 List_iterator_fast<Item> fields_it(fields);
1259 List_iterator_fast<LEX_CSTRING> columns_it(*updatable_columns);
1260 LEX_CSTRING *column_name;
1261 Item_field *field;
1262
1263 /*
1264 Stop search on the first matching of a column taken from UPDATE statement
1265 with any column listed in trigger column list.
1266 */
1267 while ((field= (Item_field*)fields_it++))
1268 {
1269 while ((column_name= columns_it++))
1270 {
1271 if (field->field_name.streq(*column_name))
1272 return true;
1273 }
1274 }
1275
1276 return false;
1277}
1278
1279
1280/**

Callers 2

update_single_tableMethod · 0.80
process_triggersMethod · 0.80

Calls 3

is_trg_event_onFunction · 0.85
is_emptyMethod · 0.45
streqMethod · 0.45

Tested by

no test coverage detected