|
static bool | check_view_insertability (THD *thd, Table_ref *view, const Table_ref *insert_table_ref) |
| Additional check for insertability for VIEW. More...
|
|
static void | prepare_for_positional_update (TABLE *table, Table_ref *tables) |
| Get extra info for tables we insert into. More...
|
|
static bool | check_single_table_insert (const mem_root_deque< Item * > &fields, Table_ref *view, Table_ref **insert_table_ref) |
| Check that insert fields are from a single table of a multi-table view. More...
|
|
static bool | check_insert_fields (THD *thd, Table_ref *table_list, mem_root_deque< Item * > *fields) |
| Check insert fields. More...
|
|
static bool | check_valid_table_refs (const Table_ref *view, const mem_root_deque< Item * > &values, table_map map) |
| Check that table references are restricted to the supplied table map. 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...
|
|
void | prepare_triggers_for_insert_stmt (THD *thd, TABLE *table) |
| Prepare triggers for INSERT-like statement. More...
|
|
static bool | mysql_prepare_blob_values (THD *thd, const mem_root_deque< Item * > &fields, MEM_ROOT *mem_root) |
| Setup data for field BLOB/GEOMETRY field types for execution of "INSERT...UPDATE" statement. More...
|
|
static bool | fix_join_cond_for_insert (THD *thd, Table_ref *tr) |
| Recursive helper function for resolving join conditions for insertion into view for prepared statements. More...
|
|
static bool | allocate_column_bitmap (THD *thd, TABLE *table, MY_BITMAP **bitmap) |
|
static bool | last_uniq_key (TABLE *table, uint keynr) |
| Check if there are more unique keys after the current one. 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 | check_that_all_fields_are_given_values (THD *thd, TABLE *entry, Table_ref *table_list) |
| Check that all fields with aren't null_fields are used. More...
|
|
static TABLE * | create_table_from_items (THD *thd, HA_CREATE_INFO *create_info, Table_ref *create_table, Alter_info *alter_info, const mem_root_deque< Item * > &items, handlerton **post_ddl_ht) |
| Create table from lists of fields and items (or just return TABLE object for pre-opened existing table). More...
|
|
Create table from lists of fields and items (or just return TABLE object for pre-opened existing table).
Used by CREATE SELECT.
Let "source table" be the table in the SELECT part.
Let "source table columns" be the set of columns in the SELECT list.
An interesting peculiarity in the syntax CREATE TABLE (<columns>) SELECT is that function defaults are stripped from the the source table columns, but not from the additional columns defined in the CREATE TABLE part. The first TIMESTAMP
column there is also subject to promotion to TIMESTAMP
DEFAULT
CURRENT_TIMESTAMP
ON
UPDATE
CURRENT_TIMESTAMP
, as usual.
- Parameters
-
[in] | thd | Thread object |
[in] | create_info | Create information (like MAX_ROWS, ENGINE or temporary table flag) |
[in] | create_table | Pointer to Table_ref object providing database and name for table to be created or to be open |
[in,out] | alter_info | Initial list of columns and indexes for the table to be created |
[in] | items | The source table columns. Corresponding column definitions (Create_field's) will be added to the end of alter_info->create_list. |
[out] | post_ddl_ht | Set to handlerton for table's SE, if this SE supports atomic DDL, so caller can call SE post DDL hook after committing transaction. |
- Note
- This function assumes that either table exists and was pre-opened and locked at open_and_lock_tables() stage (and in this case we just emit error or warning and return pre-opened TABLE object) or an exclusive metadata lock was acquired on table so we can safely create, open and lock table in it (we don't acquire metadata lock if this create is for temporary table).
-
Since this function contains some logic specific to CREATE TABLE ... SELECT it should be changed before it can be used in other contexts.
- Return values
-
non-zero | Pointer to TABLE object for table created or opened |
0 | Error |
Setup data for field BLOB/GEOMETRY field types for execution of "INSERT...UPDATE" statement.
For a expression in 'UPDATE' clause like "a= VALUES(a)", let as call Field* referring 'a' as LHS_FIELD and Field* referring field 'a' in "VALUES(a)" as RHS_FIELD
This function creates a separate copy of the blob value for RHS_FIELD, if the field is updated as well as accessed through VALUES() function in 'UPDATE' clause of "INSERT...UPDATE" statement.
- Parameters
-
[in] | thd | Pointer to THD object. |
[in] | fields | List of fields representing LHS_FIELD of all expressions in 'UPDATE' clause. |
[in] | mem_root | MEM_ROOT for blob copy. |
- Returns
- - Can fail only when we are out of memory.
- Return values
-
Write a record to table with optional deletion of conflicting records, invoke proper triggers if needed.
- Parameters
-
thd | thread context |
table | table to which record should be written |
info | COPY_INFO structure describing handling of duplicates and which is used for counting number of records inserted and deleted. |
update | COPY_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.
- Note
- In ON DUPLICATE KEY UPDATE case this call may set TABLE::autoinc_field_has_explicit_non_null_value flag to true (even in case of failure) so its caller should make sure that it is reset appropriately (
- See also
- fill_record()).
- Returns
- false if success, true if error
< Flag for fatal errors