MySQL  8.0.17
Source Code Documentation
sql_insert.h File Reference
#include <stddef.h>
#include <sys/types.h>
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_sqlcommand.h"
#include "sql/query_result.h"
#include "sql/sql_cmd_dml.h"
#include "sql/sql_data_change.h"
#include "sql/sql_list.h"
#include "sql/table.h"

Go to the source code of this file.

Classes

class  Query_result_insert
 
class  Query_result_create
 
class  Sql_cmd_insert_base
 Base class for all INSERT and REPLACE statements. More...
 
class  Sql_cmd_insert_values
 Class that implements INSERT ... More...
 
class  Sql_cmd_insert_select
 Class that implements INSERT ... More...
 

Typedefs

typedef List< ItemList_item
 

Functions

bool check_that_all_fields_are_given_values (THD *thd, TABLE *entry, TABLE_LIST *table_list)
 Check that all fields with arn't null_fields are used. More...
 
void prepare_triggers_for_insert_stmt (THD *thd, TABLE *table)
 Prepare triggers for INSERT-like statement. More...
 
bool write_record (THD *thd, TABLE *table, COPY_INFO *info, COPY_INFO *update)
 Write a record to table with optional deletion of conflicting records, invoke proper triggers if needed. More...
 
bool validate_default_values_of_unset_fields (THD *thd, TABLE *table)
 Validates default value of fields which are not specified in the column list of INSERT statement. More...
 

Typedef Documentation

◆ List_item

typedef List<Item> List_item

Function Documentation

◆ check_that_all_fields_are_given_values()

bool check_that_all_fields_are_given_values ( THD thd,
TABLE entry,
TABLE_LIST table_list 
)

Check that all fields with arn't null_fields are used.

Parameters
thdthread handler
entry
table_list
Returns
true if all fields are given values

◆ prepare_triggers_for_insert_stmt()

void prepare_triggers_for_insert_stmt ( THD thd,
TABLE table 
)

Prepare triggers for INSERT-like statement.

Parameters
thdThread handler
tableTable to which insert will happen
Note
Prepare triggers for INSERT-like statement by marking fields used by triggers and inform handlers that batching of UPDATE/DELETE cannot be done if there are BEFORE UPDATE/DELETE triggers.

◆ validate_default_values_of_unset_fields()

bool validate_default_values_of_unset_fields ( THD thd,
TABLE table 
)

Validates default value of fields which are not specified in the column list of INSERT statement.

Note
table->record[0] should be be populated with default values before calling this function.
Parameters
thdthread context
tabletable to which values are inserted.
Returns
false if success, true if error

◆ write_record()

bool write_record ( THD thd,
TABLE table,
COPY_INFO info,
COPY_INFO update 
)

Write a record to table with optional deletion of conflicting records, invoke proper triggers if needed.

Parameters
thdthread context
tabletable to which record should be written
infoCOPY_INFO structure describing handling of duplicates and which is used for counting number of records inserted and deleted.
updateCOPY_INFO structure describing the UPDATE part (only used for INSERT ON DUPLICATE KEY UPDATE)

Once this record is written to the table buffer, any AFTER INSERT trigger will be invoked. If instead of inserting a new record we end up updating an old one, both ON UPDATE triggers will fire instead. Similarly both ON DELETE triggers will be invoked if are to delete conflicting records.

Call thd->transaction.stmt.mark_modified_non_trans_table() if table is a non-transactional table.

Returns
false if success, true if error

< Flag for fatal errors