|
static bool | is_subtype_of (Field::geometry_type sub, Field::geometry_type super) |
| Check if geometry type sub is a subtype of super. More...
|
|
static void | do_field_eq (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | set_to_is_null (Field *to_field, bool is_null) |
|
type_conversion_status | set_field_to_null (Field *field) |
|
type_conversion_status | set_field_to_null_with_conversions (Field *field, bool no_conversions) |
| Set field to NULL or TIMESTAMP or to next auto_increment number. More...
|
|
static void | do_skip (Copy_field *, const Field *, Field *) |
|
static void | do_copy_null (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_copy_not_null (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_copy_maybe_null (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_copy_timestamp (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_copy_next_number (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_copy_blob (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | do_conv_blob (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_field_string (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | do_field_enum (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_field_varbinary_pre50 (Copy_field *copy, const Field *from_field, Field *to_field) |
|
static void | do_field_int (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | do_field_real (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | do_field_decimal (Copy_field *, const Field *from_field, Field *to_field) |
|
type_conversion_status | copy_time_to_time (const Field *from, Field *to) |
|
static void | do_field_time (Copy_field *, const Field *from_field, Field *to_field) |
| Convert between fields using time representation. More...
|
|
static void | do_cut_string (Copy_field *, const Field *from_field, Field *to_field) |
| string copy for single byte characters set when to string is shorter than from string. More...
|
|
static void | do_cut_string_complex (Copy_field *, const Field *from_field, Field *to_field) |
| string copy for multi byte characters set when to string is shorter than from string. More...
|
|
static void | do_expand_binary (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | do_expand_string (Copy_field *, const Field *from_field, Field *to_field) |
|
static void | copy_field_varstring (Field_varstring *const to, const Field_varstring *const from) |
| A variable length string field consists of: (a) 1 or 2 length bytes, depending on the VARCHAR column definition (b) as many relevant character bytes, as defined in the length byte(s) (c) unused padding up to the full length of the column. More...
|
|
static void | do_varstring (Copy_field *, const Field *from_field, Field *to_field) |
|
static bool | is_blob_type (enum_field_types to_type) |
|
bool | fields_are_memcpyable (const Field *to, const Field *from) |
| Check if one can copy from “from” to “to” with a simple memcpy(), with pack_length() as the length. More...
|
|
type_conversion_status | field_conv_slow (Field *to, const Field *from) |
| Copy the value in "from" (assumed to be non-NULL) to "to", doing any required conversions in the process. More...
|
|
Functions to copy data to or from fields.
A variable length string field consists of: (a) 1 or 2 length bytes, depending on the VARCHAR column definition (b) as many relevant character bytes, as defined in the length byte(s) (c) unused padding up to the full length of the column.
This function only copies (a) and (b)
Condition for using this function: to and from must use the same number of bytes for length, i.e: to->length_bytes==from->length_bytes
- Parameters
-
to | Variable length field we're copying to |
from | Variable length field we're copying from |
Copy the value in "from" (assumed to be non-NULL) to "to", doing any required conversions in the process.
Note that you should only call this if fields_are_memcpyable() is false, since it does an actual conversion on the slow path (and it is not properly tested whether it gives the correct result in all cases if fields_are_memcpyable() is true).
You should never call this with to == from, as they are no-ops.
bool fields_are_memcpyable |
( |
const Field * |
to, |
|
|
const Field * |
from |
|
) |
| |
Check if one can copy from “from” to “to” with a simple memcpy(), with pack_length() as the length.
This is the case if the types of the two fields are the same and we don't have special copying rules for the type (e.g., blobs, which require allocation, or time functions that require checking for special SQL modes).
You should never call this with to == from, as such copies are no-ops and memcpy() has undefined behavior with overlapping memory areas.
The following piece of code is run for the case when a BLOB column that has value NULL is queried with GROUP BY NULL and the result is inserted into a some table's column declared having primitive type (e.g. INT) and NOT NULL.
For example, the following test case will hit this piece of code: CREATE TABLE t1 (a BLOB); CREATE TABLE t2 (a INT NOT NULL);
INSERT t1 VALUES (NULL); INSERT INTO t2(a) SELECT a FROM t1 GROUP BY NULL; <<== Hit here
In general, when set_field_to_null() is called a Field has to be either declared as NULL-able or be marked as temporary NULL-able. But in case of INSERT SELECT from a BLOB field and when GROUP BY NULL is specified the Field object for a destination column doesn't set neither NULL-able nor temporary NULL-able (see setup_copy_fields()).