Doxygenize comments, a*.cc - field.cc .

parent 04296df3
...@@ -14,7 +14,12 @@ ...@@ -14,7 +14,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Read language depeneded messagefile */ /**
@file
@brief
Read language depeneded messagefile
*/
#include "mysql_priv.h" #include "mysql_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
...@@ -23,20 +28,17 @@ static bool read_texts(const char *file_name,const char ***point, ...@@ -23,20 +28,17 @@ static bool read_texts(const char *file_name,const char ***point,
uint error_messages); uint error_messages);
static void init_myfunc_errs(void); static void init_myfunc_errs(void);
/* /**
Read messages from errorfile. Read messages from errorfile.
SYNOPSIS This function can be called multiple times to reload the messages.
init_errmessage() If it fails to load the messages, it will fail softly by initializing
the errmesg pointer to an array of empty strings or by keeping the
old array if it exists.
DESCRIPTION @retval
This function can be called multiple times to reload the messages.
If it fails to load the messages, it will fail softly by initializing
the errmesg pointer to an array of empty strings or by keeping the
old array if it exists.
RETURN
FALSE OK FALSE OK
@retval
TRUE Error TRUE Error
*/ */
...@@ -75,7 +77,14 @@ bool init_errmessage(void) ...@@ -75,7 +77,14 @@ bool init_errmessage(void)
} }
/* Read text from packed textfile in language-directory */ /**
Read text from packed textfile in language-directory.
If we can't read messagefile then it's panic- we can't continue.
@todo
Convert the character set to server system character set
*/
static bool read_texts(const char *file_name,const char ***point, static bool read_texts(const char *file_name,const char ***point,
uint error_messages) uint error_messages)
...@@ -178,7 +187,9 @@ Check that the above file is the right version for this program!", ...@@ -178,7 +187,9 @@ Check that the above file is the right version for this program!",
} /* read_texts */ } /* read_texts */
/* Initiates error-messages used by my_func-library */ /**
Initiates error-messages used by my_func-library.
*/
static void init_myfunc_errs() static void init_myfunc_errs()
{ {
......
...@@ -21,17 +21,18 @@ ...@@ -21,17 +21,18 @@
struct st_des_keyschedule des_keyschedule[10]; struct st_des_keyschedule des_keyschedule[10];
uint des_default_key; uint des_default_key;
/* #define des_cs &my_charset_latin1
Function which loads DES keys from plaintext file into memory on MySQL
server startup and on command FLUSH DES_KEY_FILE. /**
Blame tonu@spam.ee on bugs ;) Load DES keys from plaintext file into
memory on MySQL server startup and on command FLUSH DES_KEY_FILE.
RETURN
0 ok @retval
1 Error 0 ok
@retval
1 Error
*/ */
#define des_cs &my_charset_latin1
bool bool
load_des_key_file(const char *file_name) load_des_key_file(const char *file_name)
......
...@@ -14,29 +14,33 @@ ...@@ -14,29 +14,33 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Functions for discover of frm file from handler */ /**
@file
@brief
Functions for discover of frm file from handler
*/
#include "mysql_priv.h" #include "mysql_priv.h"
#include <my_dir.h> #include <my_dir.h>
/* /**
Read the contents of a .frm file Read the contents of a .frm file.
SYNOPSIS frmdata and len are set to 0 on error.
readfrm()
name path to table-file "db/name" @param name path to table-file "db/name"
frmdata frm data @param frmdata frm data
len length of the read frmdata @param len length of the read frmdata
RETURN VALUES @retval
0 ok 0 ok
1 Could not open file @retval
2 Could not stat file 1 Could not open file
3 Could not allocate data for read @retval
Could not read file 2 Could not stat file
@retval
frmdata and len are set to 0 on error 3 Could not allocate data for read. Could not read file
*/ */
int readfrm(const char *name, uchar **frmdata, size_t *len) int readfrm(const char *name, uchar **frmdata, size_t *len)
...@@ -87,18 +91,16 @@ int readfrm(const char *name, uchar **frmdata, size_t *len) ...@@ -87,18 +91,16 @@ int readfrm(const char *name, uchar **frmdata, size_t *len)
/* /*
Write the content of a frm data pointer Write the content of a frm data pointer
to a frm file to a frm file.
SYNOPSIS
writefrm()
name path to table-file "db/name" @param name path to table-file "db/name"
frmdata frm data @param frmdata frm data
len length of the frmdata @param len length of the frmdata
RETURN VALUES @retval
0 ok 0 ok
2 Could not write file @retval
2 Could not write file
*/ */
int writefrm(const char *name, const uchar *frmdata, size_t len) int writefrm(const char *name, const uchar *frmdata, size_t len)
......
...@@ -14,9 +14,12 @@ ...@@ -14,9 +14,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/***************************************************************************** /**
** This file implements classes defined in field.h @file
*****************************************************************************/
@brief
This file implements classes defined in field.h
*/
#ifdef USE_PRAGMA_IMPLEMENTATION #ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation // gcc: Class implementation #pragma implementation // gcc: Class implementation
...@@ -913,14 +916,13 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]= ...@@ -913,14 +916,13 @@ static enum_field_types field_types_merge_rules [FIELDTYPE_NUM][FIELDTYPE_NUM]=
} }
}; };
/* /**
Return type of which can carry value of both given types in UNION result Return type of which can carry value of both given types in UNION result.
SYNOPSIS @param a type for merging
Field::field_type_merge() @param b type for merging
a, b types for merging
RETURN @return
type of field type of field
*/ */
...@@ -992,14 +994,12 @@ test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend) ...@@ -992,14 +994,12 @@ test_if_important_data(CHARSET_INFO *cs, const char *str, const char *strend)
} }
/* /**
Detect Item_result by given field type of UNION merge result Detect Item_result by given field type of UNION merge result.
SYNOPSIS @param field_type given field type
Field::result_merge_type()
field_type given field type
RETURN @return
Item_result (type of internal MySQL expression result) Item_result (type of internal MySQL expression result)
*/ */
...@@ -1015,18 +1015,17 @@ Item_result Field::result_merge_type(enum_field_types field_type) ...@@ -1015,18 +1015,17 @@ Item_result Field::result_merge_type(enum_field_types field_type)
*****************************************************************************/ *****************************************************************************/
/* /**
Check whether a field type can be partially indexed by a key Check whether a field type can be partially indexed by a key.
This is a static method, rather than a virtual function, because we need This is a static method, rather than a virtual function, because we need
to check the type of a non-Field in mysql_alter_table(). to check the type of a non-Field in mysql_alter_table().
SYNOPSIS @param type field type
type_can_have_key_part()
type field type
RETURN @retval
TRUE Type can have a prefixed key TRUE Type can have a prefixed key
@retval
FALSE Type can not have a prefixed key FALSE Type can not have a prefixed key
*/ */
...@@ -1048,8 +1047,8 @@ bool Field::type_can_have_key_part(enum enum_field_types type) ...@@ -1048,8 +1047,8 @@ bool Field::type_can_have_key_part(enum enum_field_types type)
} }
/* /**
Numeric fields base class constructor Numeric fields base class constructor.
*/ */
Field_num::Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg, Field_num::Field_num(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg, uchar null_bit_arg, utype unireg_check_arg,
...@@ -1080,23 +1079,25 @@ void Field_num::prepend_zeros(String *value) ...@@ -1080,23 +1079,25 @@ void Field_num::prepend_zeros(String *value)
} }
} }
/* /**
Test if given number is a int. Test if given number is a int.
SYNOPSIS @todo
Field_num::check_int Make this multi-byte-character safe
cs Character set
str String to test
end Pointer to char after last used digit
length String length
error Error returned by strntoull10rnd()
NOTE @param str String to test
@param length Length of 'str'
@param int_end Pointer to char after last used digit
@param cs Character set
@note
This is called after one has called strntoull10rnd() function. This is called after one has called strntoull10rnd() function.
RETURN @retval
0 ok 0 OK
@retval
1 error: empty string or wrong integer. 1 error: empty string or wrong integer.
@retval
2 error: garbage at the end of string. 2 error: garbage at the end of string.
*/ */
...@@ -1191,16 +1192,15 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len, ...@@ -1191,16 +1192,15 @@ bool Field_num::get_int(CHARSET_INFO *cs, const char *from, uint len,
return 1; return 1;
} }
/* /**
Process decimal library return codes and issue warnings for overflow and Process decimal library return codes and issue warnings for overflow and
truncation. truncation.
SYNOPSIS @param op_result decimal library return code (E_DEC_* see include/decimal.h)
Field::warn_if_overflow()
op_result decimal library return code (E_DEC_* see include/decimal.h)
RETURN @retval
1 there was overflow 1 there was overflow
@retval
0 no error or some other errors except overflow 0 no error or some other errors except overflow
*/ */
...@@ -1275,10 +1275,10 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs) ...@@ -1275,10 +1275,10 @@ static bool test_if_real(const char *str,int length, CHARSET_INFO *cs)
#endif #endif
/* /**
Interpret field value as an integer but return the result as a string. Interpret field value as an integer but return the result as a string.
This is used for printing bit_fields as numbers while debugging This is used for printing bit_fields as numbers while debugging.
*/ */
String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val) String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
...@@ -1299,6 +1299,7 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val) ...@@ -1299,6 +1299,7 @@ String *Field::val_int_as_str(String *val_buffer, my_bool unsigned_val)
} }
/// This is used as a table name when the table structure is not set up
Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg, Field::Field(uchar *ptr_arg,uint32 length_arg,uchar *null_ptr_arg,
uchar null_bit_arg, uchar null_bit_arg,
utype unireg_check_arg, const char *field_name_arg) utype unireg_check_arg, const char *field_name_arg)
...@@ -1474,17 +1475,15 @@ void Field::make_field(Send_field *field) ...@@ -1474,17 +1475,15 @@ void Field::make_field(Send_field *field)
} }
/* /**
Conversion from decimal to longlong with checking overflow and Conversion from decimal to longlong with checking overflow and
setting correct value (min/max) in case of overflow setting correct value (min/max) in case of overflow.
SYNOPSIS @param val value which have to be converted
Field::convert_decimal2longlong() @param unsigned_flag type of integer in which we convert val
val value which have to be converted @param err variable to pass error code
unsigned_flag type of integer in which we convert val
err variable to pass error code
RETURN @return
value converted from val value converted from val
*/ */
longlong Field::convert_decimal2longlong(const my_decimal *val, longlong Field::convert_decimal2longlong(const my_decimal *val,
...@@ -1518,19 +1517,18 @@ longlong Field::convert_decimal2longlong(const my_decimal *val, ...@@ -1518,19 +1517,18 @@ longlong Field::convert_decimal2longlong(const my_decimal *val,
} }
/* /**
Storing decimal in integer fields. Storing decimal in integer fields.
SYNOPSIS @param val value for storing
Field_num::store_decimal()
val value for storing
NOTE @note
This method is used by all integer fields, real/decimal redefine it This method is used by all integer fields, real/decimal redefine it
RETURN @retval
0 OK 0 OK
!= 0 error @retval
!=0 error
*/ */
int Field_num::store_decimal(const my_decimal *val) int Field_num::store_decimal(const my_decimal *val)
...@@ -1542,19 +1540,17 @@ int Field_num::store_decimal(const my_decimal *val) ...@@ -1542,19 +1540,17 @@ int Field_num::store_decimal(const my_decimal *val)
} }
/* /**
Return decimal value of integer field Return decimal value of integer field.
SYNOPSIS @param decimal_value buffer for storing decimal value
Field_num::val_decimal()
decimal_value buffer for storing decimal value
NOTE @note
This method is used by all integer fields, real/decimal redefine it This method is used by all integer fields, real/decimal redefine it.
All longlong values fit in our decimal buffer which cal store 8*9=72 All longlong values fit in our decimal buffer which cal store 8*9=72
digits of integer number digits of integer number
RETURN @return
pointer to decimal buffer with value of field pointer to decimal buffer with value of field
*/ */
...@@ -1587,22 +1583,24 @@ void Field_num::make_field(Send_field *field) ...@@ -1587,22 +1583,24 @@ void Field_num::make_field(Send_field *field)
field->decimals= dec; field->decimals= dec;
} }
/* /**
Decimal representation of Field_str Decimal representation of Field_str.
SYNOPSIS @param d value for storing
Field_str::store_decimal()
d value for storing
NOTE @note
Field_str is the base class for fields like Field_enum, Field_date and some Field_str is the base class for fields like Field_enum,
similar. Some dates use fraction and also string value should be Field_date and some similar. Some dates use fraction and also
converted to floating point value according our rules, so we use double string value should be converted to floating point value according
to store value of decimal in string our rules, so we use double to store value of decimal in string.
RETURN @todo
use decimal2string?
@retval
0 OK 0 OK
!= 0 error @retval
!=0 error
*/ */
int Field_str::store_decimal(const my_decimal *d) int Field_str::store_decimal(const my_decimal *d)
...@@ -1675,11 +1673,11 @@ bool Field::get_time(MYSQL_TIME *ltime) ...@@ -1675,11 +1673,11 @@ bool Field::get_time(MYSQL_TIME *ltime)
return 0; return 0;
} }
/* /**
This is called when storing a date in a string This is called when storing a date in a string.
NOTES @note
Needs to be changed if/when we want to support different time formats Needs to be changed if/when we want to support different time formats.
*/ */
int Field::store_time(MYSQL_TIME *ltime, timestamp_type type_arg) int Field::store_time(MYSQL_TIME *ltime, timestamp_type type_arg)
...@@ -2301,9 +2299,9 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)), ...@@ -2301,9 +2299,9 @@ String *Field_decimal::val_str(String *val_buffer __attribute__((unused)),
return val_ptr; return val_ptr;
} }
/* /**
** Should be able to handle at least the following fixed decimal formats: Should be able to handle at least the following fixed decimal formats:
** 5.00 , -1.0, 05, -05, +5 with optional pre/end space 5.00 , -1.0, 05, -05, +5 with optional pre/end space
*/ */
int Field_decimal::cmp(const uchar *a_ptr,const uchar *b_ptr) int Field_decimal::cmp(const uchar *a_ptr,const uchar *b_ptr)
...@@ -2425,13 +2423,11 @@ int Field_new_decimal::reset(void) ...@@ -2425,13 +2423,11 @@ int Field_new_decimal::reset(void)
} }
/* /**
Generate max/min decimal value in case of overflow. Generate max/min decimal value in case of overflow.
SYNOPSIS @param decimal_value buffer for value
Field_new_decimal::set_value_on_overflow(); @param sign sign of value which caused overflow
decimal_value buffer for value
sign sign of value which caused overflow
*/ */
void Field_new_decimal::set_value_on_overflow(my_decimal *decimal_value, void Field_new_decimal::set_value_on_overflow(my_decimal *decimal_value,
...@@ -2450,21 +2446,19 @@ void Field_new_decimal::set_value_on_overflow(my_decimal *decimal_value, ...@@ -2450,21 +2446,19 @@ void Field_new_decimal::set_value_on_overflow(my_decimal *decimal_value,
} }
/* /**
Store decimal value in the binary buffer Store decimal value in the binary buffer.
SYNOPSIS Checks if decimal_value fits into field size.
store_value(const my_decimal *decimal_value) If it does, stores the decimal in the buffer using binary format.
decimal_value my_decimal Otherwise sets maximal number that can be stored in the field.
DESCRIPTION @param decimal_value my_decimal
checks if decimal_value fits into field size.
if it does, stores the decimal in the buffer using binary format.
Otherwise sets maximal number that can be stored in the field.
RETURN @retval
0 ok 0 ok
1 error @retval
1 error
*/ */
bool Field_new_decimal::store_value(const my_decimal *decimal_value) bool Field_new_decimal::store_value(const my_decimal *decimal_value)
...@@ -2573,6 +2567,12 @@ int Field_new_decimal::store(const char *from, uint length, ...@@ -2573,6 +2567,12 @@ int Field_new_decimal::store(const char *from, uint length,
} }
/**
@todo
Fix following when double2my_decimal when double2decimal
will return E_DEC_TRUNCATED always correctly
*/
int Field_new_decimal::store(double nr) int Field_new_decimal::store(double nr)
{ {
ASSERT_COLUMN_MARKED_FOR_WRITE; ASSERT_COLUMN_MARKED_FOR_WRITE;
...@@ -4546,9 +4546,8 @@ void Field_double::sql_type(String &res) const ...@@ -4546,9 +4546,8 @@ void Field_double::sql_type(String &res) const
} }
/* /**
TIMESTAMP type. TIMESTAMP type holds datetime values in range from 1970-01-01 00:00:01 UTC to
Holds datetime values in range from 1970-01-01 00:00:01 UTC to
2038-01-01 00:00:00 UTC stored as number of seconds since Unix 2038-01-01 00:00:00 UTC stored as number of seconds since Unix
Epoch in UTC. Epoch in UTC.
...@@ -4581,7 +4580,7 @@ void Field_double::sql_type(String &res) const ...@@ -4581,7 +4580,7 @@ void Field_double::sql_type(String &res) const
NONE - field which is not auto-set on update with some other than NOW() NONE - field which is not auto-set on update with some other than NOW()
default value (TIMESTAMP DEFAULT 0). default value (TIMESTAMP DEFAULT 0).
Note that TIMESTAMP_OLD_FIELD's are never created explicitly now, they are Note that TIMESTAMP_OLD_FIELDs are never created explicitly now, they are
left only for preserving ability to read old tables. Such fields replaced left only for preserving ability to read old tables. Such fields replaced
with their newer analogs in CREATE TABLE and in SHOW CREATE TABLE. This is with their newer analogs in CREATE TABLE and in SHOW CREATE TABLE. This is
because we want to prefer NONE unireg_check before TIMESTAMP_OLD_FIELD for because we want to prefer NONE unireg_check before TIMESTAMP_OLD_FIELD for
...@@ -4623,15 +4622,11 @@ Field_timestamp::Field_timestamp(bool maybe_null_arg, ...@@ -4623,15 +4622,11 @@ Field_timestamp::Field_timestamp(bool maybe_null_arg,
} }
/* /**
Get auto-set type for TIMESTAMP field. Get auto-set type for TIMESTAMP field.
SYNOPSIS Returns value indicating during which operations this TIMESTAMP field
get_auto_set_type() should be auto-set to current timestamp.
DESCRIPTION
Returns value indicating during which operations this TIMESTAMP field
should be auto-set to current timestamp.
*/ */
timestamp_auto_set_type Field_timestamp::get_auto_set_type() const timestamp_auto_set_type Field_timestamp::get_auto_set_type() const
{ {
...@@ -5114,7 +5109,8 @@ longlong Field_time::val_int(void) ...@@ -5114,7 +5109,8 @@ longlong Field_time::val_int(void)
} }
/* /**
@note
This function is multi-byte safe as the result string is always of type This function is multi-byte safe as the result string is always of type
my_charset_bin my_charset_bin
*/ */
...@@ -5141,7 +5137,8 @@ String *Field_time::val_str(String *val_buffer, ...@@ -5141,7 +5137,8 @@ String *Field_time::val_str(String *val_buffer,
} }
/* /**
@note
Normally we would not consider 'time' as a valid date, but we allow Normally we would not consider 'time' as a valid date, but we allow
get_date() here to be able to do things like get_date() here to be able to do things like
DATE_FORMAT(time, "%l.%i %p") DATE_FORMAT(time, "%l.%i %p")
...@@ -6243,15 +6240,12 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -6243,15 +6240,12 @@ int Field_string::store(const char *from,uint length,CHARSET_INFO *cs)
} }
/* /**
Store double value in Field_string or Field_varstring. Store double value in Field_string or Field_varstring.
SYNOPSIS Pretty prints double number into field_length characters buffer.
store(double nr)
nr number
DESCRIPTION @param nr number
Pretty prints double number into field_length characters buffer.
*/ */
int Field_str::store(double nr) int Field_str::store(double nr)
...@@ -6605,18 +6599,18 @@ int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length, ...@@ -6605,18 +6599,18 @@ int Field_string::pack_cmp(const uchar *a, const uchar *b, uint length,
} }
/* /**
Compare a packed key against row Compare a packed key against row.
SYNOPSIS @param key Original key
pack_cmp() @param length Key length. (May be less than field length)
key Original key @param insert_or_update 1 if this is an insert or update
length Key length. (May be less than field length)
insert_or_update 1 if this is an insert or update
RETURN @return
< 0 row < key < 0 row < key
@return
0 row = key 0 row = key
@return
> 0 row > key > 0 row > key
*/ */
...@@ -6859,8 +6853,9 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr, ...@@ -6859,8 +6853,9 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr,
} }
/* /**
NOTE: varstring and blob keys are ALWAYS stored with a 2 byte length prefix @note
varstring and blob keys are ALWAYS stored with a 2 byte length prefix
*/ */
int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length) int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
...@@ -6880,10 +6875,10 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length) ...@@ -6880,10 +6875,10 @@ int Field_varstring::key_cmp(const uchar *key_ptr, uint max_key_length)
} }
/* /**
Compare to key segments (always 2 byte length prefix) Compare to key segments (always 2 byte length prefix).
NOTE @note
This is used only to compare key segments created for index_read(). This is used only to compare key segments created for index_read().
(keys are created and compared in key.cc) (keys are created and compared in key.cc)
*/ */
...@@ -6995,21 +6990,18 @@ uchar *Field_varstring::pack_key(uchar *to, const uchar *key, uint max_length) ...@@ -6995,21 +6990,18 @@ uchar *Field_varstring::pack_key(uchar *to, const uchar *key, uint max_length)
} }
/* /**
Unpack a key into a record buffer. Unpack a key into a record buffer.
SYNOPSIS A VARCHAR key has a maximum size of 64K-1.
unpack_key() In its packed form, the length field is one or two bytes long,
to Pointer into the record buffer. depending on 'max_length'.
key Pointer to the packed key.
max_length Key length limit from key description.
DESCRIPTION @param to Pointer into the record buffer.
A VARCHAR key has a maximum size of 64K-1. @param key Pointer to the packed key.
In its packed form, the length field is one or two bytes long, @param max_length Key length limit from key description.
depending on 'max_length'.
RETURN @return
Pointer to end of 'key' (To the next key part if multi-segment key) Pointer to end of 'key' (To the next key part if multi-segment key)
*/ */
...@@ -7030,16 +7022,14 @@ const uchar *Field_varstring::unpack_key(uchar *to, const uchar *key, ...@@ -7030,16 +7022,14 @@ const uchar *Field_varstring::unpack_key(uchar *to, const uchar *key,
return key + length; return key + length;
} }
/* /**
Create a packed key that will be used for storage in the index tree Create a packed key that will be used for storage in the index tree.
SYNOPSIS @param to Store packed key segment here
pack_key_from_key_image() @param from Key segment (as given to index_read())
to Store packed key segment here @param max_length Max length of key
from Key segment (as given to index_read())
max_length Max length of key
RETURN @return
end of key storage end of key storage
*/ */
...@@ -7389,21 +7379,15 @@ uint32 Field_blob::get_length(const uchar *pos, bool low_byte_first) ...@@ -7389,21 +7379,15 @@ uint32 Field_blob::get_length(const uchar *pos, bool low_byte_first)
} }
/* /**
Put a blob length field into a record buffer. Put a blob length field into a record buffer.
SYNOPSIS Depending on the maximum length of a blob, its length field is
Field_blob::put_length() put into 1 to 4 bytes. This is a property of the blob object,
pos Pointer into the record buffer. described by 'packlength'.
length The length value to put.
DESCRIPTION
Depending on the maximum length of a blob, its length field is
put into 1 to 4 bytes. This is a property of the blob object,
described by 'packlength'.
RETURN @param pos Pointer into the record buffer.
nothing @param length The length value to put.
*/ */
void Field_blob::put_length(uchar *pos, uint32 length) void Field_blob::put_length(uchar *pos, uint32 length)
...@@ -7891,7 +7875,7 @@ int Field_blob::pack_cmp(const uchar *b, uint key_length_arg, ...@@ -7891,7 +7875,7 @@ int Field_blob::pack_cmp(const uchar *b, uint key_length_arg,
insert_or_update); insert_or_update);
} }
/* Create a packed key that will be used for storage from a MySQL row */ /** Create a packed key that will be used for storage from a MySQL row. */
uchar *Field_blob::pack_key(uchar *to, const uchar *from, uint max_length) uchar *Field_blob::pack_key(uchar *to, const uchar *from, uint max_length)
{ {
...@@ -7915,26 +7899,24 @@ uchar *Field_blob::pack_key(uchar *to, const uchar *from, uint max_length) ...@@ -7915,26 +7899,24 @@ uchar *Field_blob::pack_key(uchar *to, const uchar *from, uint max_length)
} }
/* /**
Unpack a blob key into a record buffer. Unpack a blob key into a record buffer.
SYNOPSIS A blob key has a maximum size of 64K-1.
Field_blob::unpack_key() In its packed form, the length field is one or two bytes long,
to Pointer into the record buffer. depending on 'max_length'.
from Pointer to the packed key. Depending on the maximum length of a blob, its length field is
max_length Key length limit from key description. put into 1 to 4 bytes. This is a property of the blob object,
described by 'packlength'.
Blobs are internally stored apart from the record buffer, which
contains a pointer to the blob buffer.
DESCRIPTION
A blob key has a maximum size of 64K-1.
In its packed form, the length field is one or two bytes long,
depending on 'max_length'.
Depending on the maximum length of a blob, its length field is
put into 1 to 4 bytes. This is a property of the blob object,
described by 'packlength'.
Blobs are internally stored apart from the record buffer, which
contains a pointer to the blob buffer.
RETURN @param to Pointer into the record buffer.
@param from Pointer to the packed key.
@param max_length Key length limit from key description.
@return
Pointer into 'from' past the last byte copied from packed key. Pointer into 'from' past the last byte copied from packed key.
*/ */
...@@ -7960,7 +7942,7 @@ const uchar *Field_blob::unpack_key(uchar *to, const uchar *from, ...@@ -7960,7 +7942,7 @@ const uchar *Field_blob::unpack_key(uchar *to, const uchar *from,
} }
/* Create a packed key that will be used for storage from a MySQL key */ /** Create a packed key that will be used for storage from a MySQL key. */
uchar *Field_blob::pack_key_from_key_image(uchar *to, const uchar *from, uchar *Field_blob::pack_key_from_key_image(uchar *to, const uchar *from,
uint max_length) uint max_length)
...@@ -8181,9 +8163,10 @@ void Field_enum::store_type(ulonglong value) ...@@ -8181,9 +8163,10 @@ void Field_enum::store_type(ulonglong value)
} }
/* /**
** Note. Storing a empty string in a enum field gives a warning @note
** (if there isn't a empty value in the enum) Storing a empty string in a enum field gives a warning
(if there isn't a empty value in the enum)
*/ */
int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs) int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
...@@ -8509,7 +8492,12 @@ void Field_set::sql_type(String &res) const ...@@ -8509,7 +8492,12 @@ void Field_set::sql_type(String &res) const
res.append(')'); res.append(')');
} }
/* returns 1 if the fields are equally defined */ /**
@retval
1 if the fields are equally defined
@retval
0 if the fields are unequally defined
*/
bool Field::eq_def(Field *field) bool Field::eq_def(Field *field)
{ {
...@@ -8519,6 +8507,10 @@ bool Field::eq_def(Field *field) ...@@ -8519,6 +8507,10 @@ bool Field::eq_def(Field *field)
return 1; return 1;
} }
/**
@return
returns 1 if the fields are equally defined
*/
bool Field_enum::eq_def(Field *field) bool Field_enum::eq_def(Field *field)
{ {
if (!Field::eq_def(field)) if (!Field::eq_def(field))
...@@ -8537,6 +8529,10 @@ bool Field_enum::eq_def(Field *field) ...@@ -8537,6 +8529,10 @@ bool Field_enum::eq_def(Field *field)
return 1; return 1;
} }
/**
@return
returns 1 if the fields are equally defined
*/
bool Field_num::eq_def(Field *field) bool Field_num::eq_def(Field *field)
{ {
if (!Field::eq_def(field)) if (!Field::eq_def(field))
...@@ -9113,14 +9109,8 @@ void Field_bit_as_char::sql_type(String &res) const ...@@ -9113,14 +9109,8 @@ void Field_bit_as_char::sql_type(String &res) const
Handling of field and Create_field Handling of field and Create_field
*****************************************************************************/ *****************************************************************************/
/* /**
Convert Create_field::length from number of characters to number of bytes Convert create_field::length from number of characters to number of bytes.
SYNOPSIS
Create_field::create_length_to_internal_length()
DESCRIPTION
Convert Create_field::length from number of characters to number of bytes.
*/ */
void Create_field::create_length_to_internal_length(void) void Create_field::create_length_to_internal_length(void)
...@@ -9170,6 +9160,9 @@ void Create_field::create_length_to_internal_length(void) ...@@ -9170,6 +9160,9 @@ void Create_field::create_length_to_internal_length(void)
} }
/**
Init for a tmp table field. To be extended if need be.
*/
void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
uint32 length_arg, uint32 decimals_arg, uint32 length_arg, uint32 decimals_arg,
bool maybe_null, bool is_unsigned) bool maybe_null, bool is_unsigned)
...@@ -9188,26 +9181,26 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg, ...@@ -9188,26 +9181,26 @@ void Create_field::init_for_tmp_table(enum_field_types sql_type_arg,
} }
/* /**
Initialize field definition for create Initialize field definition for create.
SYNOPSIS @param thd Thread handle
thd Thread handle @param fld_name Field name
fld_name Field name @param fld_type Field type
fld_type Field type @param fld_length Field length
fld_length Field length @param fld_decimals Decimal (if any)
fld_decimals Decimal (if any) @param fld_type_modifier Additional type information
fld_type_modifier Additional type information @param fld_default_value Field default value (if any)
fld_default_value Field default value (if any) @param fld_on_update_value The value of ON UPDATE clause
fld_on_update_value The value of ON UPDATE clause @param fld_comment Field comment
fld_comment Field comment @param fld_change Field change
fld_change Field change @param fld_interval_list Interval list (if any)
fld_interval_list Interval list (if any) @param fld_charset Field charset
fld_charset Field charset @param fld_geom_type Field geometry type (if any)
fld_geom_type Field geometry type (if any)
@retval
RETURN
FALSE on success FALSE on success
@retval
TRUE on error TRUE on error
*/ */
...@@ -9795,7 +9788,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length, ...@@ -9795,7 +9788,7 @@ Field *make_field(TABLE_SHARE *share, uchar *ptr, uint32 field_length,
} }
/* Create a field suitable for create of table */ /** Create a field suitable for create of table. */
Create_field::Create_field(Field *old_field,Field *orig_field) Create_field::Create_field(Field *old_field,Field *orig_field)
{ {
...@@ -9883,13 +9876,10 @@ Create_field::Create_field(Field *old_field,Field *orig_field) ...@@ -9883,13 +9876,10 @@ Create_field::Create_field(Field *old_field,Field *orig_field)
} }
/* /**
maximum possible display length for blob maximum possible display length for blob.
SYNOPSIS
Field_blob::max_display_length()
RETURN @return
length length
*/ */
...@@ -9916,24 +9906,23 @@ uint32 Field_blob::max_display_length() ...@@ -9916,24 +9906,23 @@ uint32 Field_blob::max_display_length()
Warning handling Warning handling
*****************************************************************************/ *****************************************************************************/
/* /**
Produce warning or note about data saved into field Produce warning or note about data saved into field.
SYNOPSIS @param level - level of message (Note/Warning/Error)
set_warning() @param code - error code of message to be produced
level - level of message (Note/Warning/Error) @param cuted_increment - whenever we should increase cut fields count or not
code - error code of message to be produced
cuted_increment - whenever we should increase cut fields count or not
NOTE @note
This function won't produce warning and increase cut fields counter This function won't produce warning and increase cut fields counter
if count_cuted_fields == CHECK_FIELD_IGNORE for current thread. if count_cuted_fields == CHECK_FIELD_IGNORE for current thread.
if count_cuted_fields == CHECK_FIELD_IGNORE then we ignore notes. if count_cuted_fields == CHECK_FIELD_IGNORE then we ignore notes.
This allows us to avoid notes in optimisation, like convert_constant_item(). This allows us to avoid notes in optimisation, like convert_constant_item().
RETURN VALUE @retval
1 if count_cuted_fields == CHECK_FIELD_IGNORE and error level is not NOTE 1 if count_cuted_fields == CHECK_FIELD_IGNORE and error level is not NOTE
@retval
0 otherwise 0 otherwise
*/ */
...@@ -9957,21 +9946,19 @@ Field::set_warning(MYSQL_ERROR::enum_warning_level level, uint code, ...@@ -9957,21 +9946,19 @@ Field::set_warning(MYSQL_ERROR::enum_warning_level level, uint code,
} }
/* /**
Produce warning or note about datetime string data saved into field Produce warning or note about datetime string data saved into field.
SYNOPSIS @param level level of message (Note/Warning/Error)
set_datime_warning() @param code error code of message to be produced
level - level of message (Note/Warning/Error) @param str string value which we tried to save
code - error code of message to be produced @param str_length length of string which we tried to save
str - string value which we tried to save @param ts_type type of datetime value (datetime/date/time)
str_len - length of string which we tried to save @param cuted_increment whenever we should increase cut fields count or not
ts_type - type of datetime value (datetime/date/time)
cuted_increment - whenever we should increase cut fields count or not @note
This function will always produce some warning but won't increase cut
NOTE fields counter if count_cuted_fields ==FIELD_CHECK_IGNORE for current
This function will always produce some warning but won't increase cut
fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
thread. thread.
*/ */
...@@ -9989,20 +9976,18 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code, ...@@ -9989,20 +9976,18 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
} }
/* /**
Produce warning or note about integer datetime value saved into field Produce warning or note about integer datetime value saved into field.
SYNOPSIS @param level level of message (Note/Warning/Error)
set_warning() @param code error code of message to be produced
level - level of message (Note/Warning/Error) @param nr numeric value which we tried to save
code - error code of message to be produced @param ts_type type of datetime value (datetime/date/time)
nr - numeric value which we tried to save @param cuted_increment whenever we should increase cut fields count or not
ts_type - type of datetime value (datetime/date/time)
cuted_increment - whenever we should increase cut fields count or not @note
This function will always produce some warning but won't increase cut
NOTE fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
This function will always produce some warning but won't increase cut
fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
thread. thread.
*/ */
...@@ -10023,19 +10008,17 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code, ...@@ -10023,19 +10008,17 @@ Field::set_datetime_warning(MYSQL_ERROR::enum_warning_level level, uint code,
} }
/* /**
Produce warning or note about double datetime data saved into field Produce warning or note about double datetime data saved into field.
SYNOPSIS @param level level of message (Note/Warning/Error)
set_warning() @param code error code of message to be produced
level - level of message (Note/Warning/Error) @param nr double value which we tried to save
code - error code of message to be produced @param ts_type type of datetime value (datetime/date/time)
nr - double value which we tried to save
ts_type - type of datetime value (datetime/date/time) @note
This function will always produce some warning but won't increase cut
NOTE fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
This function will always produce some warning but won't increase cut
fields counter if count_cuted_fields == FIELD_CHECK_IGNORE for current
thread. thread.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment