#include <field.h>
Inheritance diagram for Field_str:


Public Member Functions | |
| Field_str (char *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, utype unireg_check_arg, const char *field_name_arg, CHARSET_INFO *charset) | |
| Item_result | result_type () const |
| uint | decimals () const |
| int | store (double nr) |
| int | store (longlong nr, bool unsigned_val)=0 |
| int | store_decimal (const my_decimal *) |
| int | store (const char *to, uint length, CHARSET_INFO *cs)=0 |
| uint | size_of () const |
| CHARSET_INFO * | charset (void) const |
| void | set_charset (CHARSET_INFO *charset) |
| bool | binary () const |
| uint32 | max_length () |
| my_decimal * | val_decimal (my_decimal *) |
| virtual bool | str_needs_quotes () |
| uint | is_equal (create_field *new_field) |
Protected Attributes | |
| CHARSET_INFO * | field_charset |
Friends | |
| class | create_field |
Definition at line 405 of file field.h.
| Field_str::Field_str | ( | char * | ptr_arg, | |
| uint32 | len_arg, | |||
| uchar * | null_ptr_arg, | |||
| uchar | null_bit_arg, | |||
| utype | unireg_check_arg, | |||
| const char * | field_name_arg, | |||
| CHARSET_INFO * | charset | |||
| ) |
Definition at line 1411 of file field.cc.
References BINARY_FLAG, charset(), field_charset, Field::flags, MY_CS_BINSORT, and charset_info_st::state.
01414 :Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, 01415 unireg_check_arg, field_name_arg) 01416 { 01417 field_charset=charset; 01418 if (charset->state & MY_CS_BINSORT) 01419 flags|=BINARY_FLAG; 01420 }
Here is the call graph for this function:

| bool Field_str::binary | ( | ) | const [inline, virtual] |
Reimplemented from Field.
Definition at line 421 of file field.h.
References field_charset, and my_charset_bin.
Referenced by Field_blob::key_type(), Field_string::key_type(), Field_varstring::key_type(), Field_varstring::store(), and Field_string::store().
00421 { return field_charset == &my_charset_bin; }
Here is the caller graph for this function:

| CHARSET_INFO* Field_str::charset | ( | void | ) | const [inline, virtual] |
Reimplemented from Field.
Definition at line 419 of file field.h.
References field_charset.
Referenced by Field_blob::copy(), Field_str(), Field_blob::has_charset(), Field_varstring::has_charset(), Field_string::has_charset(), Field_varstring::hash(), Field_blob::key_cmp(), Field_string::new_field(), Field_string::reset(), set_charset(), Field_set::sql_type(), Field_enum::sql_type(), Field_blob::sql_type(), Field_varstring::sql_type(), Field_string::sql_type(), Field_blob::store(), Field_string::store(), store(), Field_blob::val_decimal(), Field_varstring::val_decimal(), Field_string::val_decimal(), Field_blob::val_int(), Field_string::val_int(), Field_blob::val_real(), and Field_string::val_real().
00419 { return field_charset; }
Here is the caller graph for this function:

| uint Field_str::decimals | ( | ) | const [inline, virtual] |
Reimplemented from Field.
Reimplemented in Field_datetime.
Definition at line 413 of file field.h.
References NOT_FIXED_DEC.
00413 { return NOT_FIXED_DEC; }
| uint Field_str::is_equal | ( | create_field * | new_field | ) | [virtual] |
Reimplemented from Field.
Reimplemented in Field_varstring.
Definition at line 6046 of file field.cc.
References BINARY_FLAG, BINCMP_FLAG, Field::charset(), field_charset, Field::flags, max_length(), Field::new_field(), Field::real_type(), and Field::sql_type().
06047 { 06048 if (((new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) && 06049 !(flags & (BINCMP_FLAG | BINARY_FLAG))) || 06050 (!(new_field->flags & (BINCMP_FLAG | BINARY_FLAG)) && 06051 (flags & (BINCMP_FLAG | BINARY_FLAG)))) 06052 return 0; /* One of the fields is binary and the other one isn't */ 06053 06054 return ((new_field->sql_type == real_type()) && 06055 new_field->charset == field_charset && 06056 new_field->length == max_length()); 06057 }
Here is the call graph for this function:

| uint32 Field_str::max_length | ( | ) | [inline, virtual] |
Implements Field.
Reimplemented in Field_null, and Field_blob.
Definition at line 422 of file field.h.
References Field::field_length.
Referenced by Field_varstring::is_equal(), and is_equal().
00422 { return field_length; }
Here is the caller graph for this function:

| Item_result Field_str::result_type | ( | ) | const [inline, virtual] |
Implements Field.
Definition at line 412 of file field.h.
References STRING_RESULT.
00412 { return STRING_RESULT; }
| void Field_str::set_charset | ( | CHARSET_INFO * | charset | ) | [inline, virtual] |
Reimplemented from Field.
Definition at line 420 of file field.h.
References charset(), and field_charset.
00420 { field_charset=charset; }
Here is the call graph for this function:

| uint Field_str::size_of | ( | ) | const [inline, virtual] |
Implements Field.
Reimplemented in Field_null, Field_string, Field_varstring, Field_blob, and Field_enum.
Definition at line 418 of file field.h.
| int Field_str::store | ( | const char * | to, | |
| uint | length, | |||
| CHARSET_INFO * | cs | |||
| ) | [pure virtual] |
Implements Field.
Implemented in Field_null, Field_timestamp, Field_date, Field_newdate, Field_time, Field_datetime, Field_string, Field_varstring, Field_blob, Field_enum, and Field_set.
Implements Field.
Implemented in Field_null, Field_timestamp, Field_date, Field_newdate, Field_time, Field_datetime, Field_string, Field_varstring, Field_blob, Field_enum, and Field_set.
| int Field_str::store | ( | double | nr | ) | [virtual] |
Implements Field.
Reimplemented in Field_null, Field_timestamp, Field_date, Field_newdate, Field_time, Field_datetime, Field_string, Field_varstring, Field_blob, Field_enum, and Field_set.
Definition at line 6004 of file field.cc.
References ASSERT_COLUMN_MARKED_FOR_WRITE, Field::char_length(), charset(), DBUG_ASSERT, DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE, FALSE, Field::field_length, log_10, max, charset_info_st::mbmaxlen, my_sprintf, and TRUE.
Referenced by Field_varstring::store(), Field_string::store(), Field_longstr::store_decimal(), and store_decimal().
06005 { 06006 ASSERT_COLUMN_MARKED_FOR_WRITE; 06007 char buff[DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE]; 06008 uint length; 06009 bool use_scientific_notation= TRUE; 06010 uint char_length= field_length / charset()->mbmaxlen; 06011 /* 06012 Check fabs(nr) against longest value that can be stored in field, 06013 which depends on whether the value is < 1 or not, and negative or not 06014 */ 06015 double anr= fabs(nr); 06016 int neg= (nr < 0.0) ? 1 : 0; 06017 if (char_length > 4 && char_length < 32 && 06018 (anr < 1.0 ? anr > 1/(log_10[max(0,(int) char_length-neg-2)]) /* -2 for "0." */ 06019 : anr < log_10[char_length-neg]-1)) 06020 use_scientific_notation= FALSE; 06021 06022 length= (uint) my_sprintf(buff, (buff, "%-.*g", 06023 (use_scientific_notation ? 06024 max(0, (int)char_length-neg-5) : 06025 char_length), 06026 nr)); 06027 /* 06028 +1 below is because "precision" in %g above means the 06029 max. number of significant digits, not the output width. 06030 Thus the width can be larger than number of significant digits by 1 06031 (for decimal point) 06032 the test for char_length < 5 is for extreme cases, 06033 like inserting 500.0 in char(1) 06034 */ 06035 DBUG_ASSERT(char_length < 5 || length <= char_length+1); 06036 return store((const char *) buff, length, charset()); 06037 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int Field_str::store_decimal | ( | const my_decimal * | ) | [virtual] |
Implements Field.
Reimplemented in Field_longstr, and Field_null.
Definition at line 1447 of file field.cc.
References ASSERT_COLUMN_MARKED_FOR_WRITE, E_DEC_FATAL_ERROR, E_DEC_OVERFLOW, err, my_decimal2double(), store(), and Field::warn_if_overflow().
01448 { 01449 ASSERT_COLUMN_MARKED_FOR_WRITE; 01450 double val; 01451 /* TODO: use decimal2string? */ 01452 int err= warn_if_overflow(my_decimal2double(E_DEC_FATAL_ERROR & 01453 ~E_DEC_OVERFLOW, d, &val)); 01454 return err | store(val); 01455 }
Here is the call graph for this function:

| virtual bool Field_str::str_needs_quotes | ( | ) | [inline, virtual] |
| my_decimal * Field_str::val_decimal | ( | my_decimal * | ) | [virtual] |
Reimplemented from Field.
Reimplemented in Field_null, Field_string, Field_varstring, and Field_blob.
Definition at line 1458 of file field.cc.
References ASSERT_COLUMN_MARKED_FOR_READ, E_DEC_FATAL_ERROR, int2my_decimal(), and Field::val_int().
01459 { 01460 ASSERT_COLUMN_MARKED_FOR_READ; 01461 longlong nr= val_int(); 01462 int2my_decimal(E_DEC_FATAL_ERROR, nr, 0, decimal_value); 01463 return decimal_value; 01464 }
Here is the call graph for this function:

friend class create_field [friend] |
CHARSET_INFO* Field_str::field_charset [protected] |
Definition at line 407 of file field.h.
Referenced by binary(), charset(), Field_blob::cmp(), Field_string::cmp(), Field_varstring::cmp_max(), Field_enum::eq_def(), Field_str(), Field_blob::get_key_image(), Field_varstring::get_key_image(), Field_varstring::is_equal(), is_equal(), Field_varstring::key_cmp(), Field_blob::max_length(), Field_string::pack(), Field_blob::pack_cmp(), Field_varstring::pack_cmp(), Field_string::pack_cmp(), Field_blob::pack_key(), Field_varstring::pack_key(), set_charset(), Field_blob::set_key_image(), Field_varstring::set_key_image(), Field_varstring::sort_length(), Field_blob::sort_length(), Field_blob::sort_string(), Field_varstring::sort_string(), Field_string::sort_string(), Field_set::store(), Field_enum::store(), Field_blob::store(), Field_varstring::store(), Field_string::store(), Field_varstring::val_int(), and Field_varstring::val_real().
1.4.7

