MySQL 9.1.0
Source Code Documentation
sql_tmp_table.h
Go to the documentation of this file.
1#ifndef SQL_TMP_TABLE_INCLUDED
2#define SQL_TMP_TABLE_INCLUDED
3
4/* Copyright (c) 2000, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27/**
28 @file
29
30 @brief
31 Temporary table handling functions.
32*/
33
34#include <sys/types.h>
35
36#include "my_base.h" // ha_rows
37#include "my_inttypes.h"
38#include "sql/item.h" // Item
40
41class Create_field;
42class Field;
43class SJ_TMP_TABLE;
44class THD;
45struct ORDER;
46struct TABLE;
47template <class T>
48class List;
49
53};
54
56 const mem_root_deque<Item *> &fields, ORDER *group,
57 bool distinct, bool save_sum_fields,
58 ulonglong select_options, ha_rows rows_limit,
59 const char *table_alias);
62 bool is_virtual = true,
63 ulonglong select_options = 0,
64 const char *alias = nullptr);
66 bool insert_last_record, bool ignore_last_dup,
67 bool *is_duplicate);
70TABLE *create_duplicate_weedout_tmp_table(THD *thd, uint uniq_tuple_length_arg,
71 SJ_TMP_TABLE *sjtbl);
72bool setup_tmp_table_handler(THD *thd, TABLE *table, ulonglong select_options,
73 bool force_disk_table = false,
74 bool schema_table = false);
77 Func_ptr_array *copy_func, Field **from_field,
78 Field **default_field, bool group, bool modify_item,
79 bool table_cant_handle_bit_fields,
80 bool make_copy_field);
81Field *create_tmp_field_from_field(THD *thd, const Field *org_field,
82 const char *name, TABLE *table,
83 Item_field *item);
84
85/**
86 Get the minimum of max_key_length and max_key_part_length between
87 HEAP engine and internal_tmp_disk_storage_engine.
88*/
89void get_max_key_and_part_length(uint *max_key_length,
90 uint *max_key_part_length,
91 uint *max_key_parts);
93void encode_innodb_position(uchar *rowid_bytes, uint length, ha_rows row_num);
95#endif /* SQL_TMP_TABLE_INCLUDED */
Create_field is a description a field/column that may or may not exists in a table.
Definition: create_field.h:51
Definition: field.h:577
Definition: item.h:4385
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:930
Type
Definition: item.h:965
Definition: sql_list.h:494
A typesafe replacement for DYNAMIC_ARRAY.
Definition: mem_root_array.h:426
Definition: sql_executor.h:95
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
Object containing parameters used when creating and using temporary tables.
Definition: temp_table_param.h:97
A (partial) implementation of std::deque allocating its blocks on a MEM_ROOT.
Definition: mem_root_deque.h:111
This file includes constants used by all storage engines.
my_off_t ha_rows
Definition: my_base.h:1141
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
unsigned char uchar
Definition: my_inttypes.h:52
void error(const char *format,...)
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:76
bool is_duplicate(Country_record *record, int skip_index)
Check for duplicate value of Primary/Unique Key column(s).
Definition: pfs_example_country.cc:51
required string type
Definition: replication_group_member_actions.proto:34
bool setup_tmp_table_handler(THD *thd, TABLE *table, ulonglong select_options, bool force_disk_table=false, bool schema_table=false)
Helper function to create_tmp_table_* family for setting up table's SE.
Definition: sql_tmp_table.cc:2121
Field * create_tmp_field(THD *thd, TABLE *table, Item *item, Item::Type type, Func_ptr_array *copy_func, Field **from_field, Field **default_field, bool group, bool modify_item, bool table_cant_handle_bit_fields, bool make_copy_field)
Create field for temporary table.
Definition: sql_tmp_table.cc:362
void free_tmp_table(TABLE *table)
Free temporary table.
Definition: sql_tmp_table.cc:2507
enum_internal_tmp_mem_storage_engine
Definition: sql_tmp_table.h:50
@ TMP_TABLE_TEMPTABLE
Definition: sql_tmp_table.h:52
@ TMP_TABLE_MEMORY
Definition: sql_tmp_table.h:51
Field * create_tmp_field_from_field(THD *thd, const Field *org_field, const char *name, TABLE *table, Item_field *item)
Lifecycle management of internal temporary tables.
Definition: sql_tmp_table.cc:190
TABLE * create_tmp_table(THD *thd, Temp_table_param *param, const mem_root_deque< Item * > &fields, ORDER *group, bool distinct, bool save_sum_fields, ulonglong select_options, ha_rows rows_limit, const char *table_alias)
Definition: sql_tmp_table.cc:886
void close_tmp_table(TABLE *table)
Close a temporary table at end of preparation or execution.
Definition: sql_tmp_table.cc:2458
TABLE * create_tmp_table_from_fields(THD *thd, List< Create_field > &field_list, bool is_virtual=true, ulonglong select_options=0, const char *alias=nullptr)
Create an, optionally reduced, TABLE object with properly set up Field list from a list of field defi...
Definition: sql_tmp_table.cc:1933
bool reposition_innodb_cursor(TABLE *table, ha_rows row_num)
Helper function for create_ondisk_from_heap().
Definition: sql_tmp_table.cc:2938
void encode_innodb_position(uchar *rowid_bytes, uint length, ha_rows row_num)
Encode an InnoDB PK in 6 bytes, high-byte first; like InnoDB's dict_sys_write_row_id() does.
Definition: sql_tmp_table.cc:2916
bool open_tmp_table(TABLE *table)
Definition: sql_tmp_table.cc:2246
void get_max_key_and_part_length(uint *max_key_length, uint *max_key_part_length, uint *max_key_parts)
Get the minimum of max_key_length and max_key_part_length between HEAP engine and internal_tmp_disk_s...
Definition: sql_tmp_table.cc:644
TABLE * create_duplicate_weedout_tmp_table(THD *thd, uint uniq_tuple_length_arg, SJ_TMP_TABLE *sjtbl)
Create a temporary table to weed out duplicate rowid combinations.
Definition: sql_tmp_table.cc:1713
bool create_ondisk_from_heap(THD *thd, TABLE *table, int error, bool insert_last_record, bool ignore_last_dup, bool *is_duplicate)
If a MEMORY table gets full, create a disk-based table and copy all rows to this.
Definition: sql_tmp_table.cc:2604
void init_cache_tmp_engine_properties()
Initialize the storage engine properties for the alternative temporary table storage engines.
Definition: sql_tmp_table.cc:626
bool instantiate_tmp_table(THD *thd, TABLE *table)
Instantiates temporary table.
Definition: sql_tmp_table.cc:2387
case opt name
Definition: sslopt-case.h:29
Definition: table.h:289
Definition: table.h:1421