The world's most popular open source database
#include "mysql_priv.h"#include <m_ctype.h>Include dependency graph for field_conv.cc:

Go to the source code of this file.
| static void do_conv_blob | ( | Copy_field * | copy | ) | [static] |
Definition at line 279 of file field_conv.cc.
References mySTL::copy().
00280 { 00281 copy->from_field->val_str(©->tmp); 00282 ((Field_blob *) copy->to_field)->store(copy->tmp.ptr(), 00283 copy->tmp.length(), 00284 copy->tmp.charset()); 00285 }
Here is the call graph for this function:

| static void do_copy_blob | ( | Copy_field * | copy | ) | [static] |
Definition at line 272 of file field_conv.cc.
References mySTL::copy(), and memcpy_fixed.
00273 { 00274 ulong length=((Field_blob*) copy->from_field)->get_length(); 00275 ((Field_blob*) copy->to_field)->store_length(length); 00276 memcpy_fixed(copy->to_ptr,copy->from_ptr,sizeof(char*)); 00277 }
Here is the call graph for this function:

| static void do_copy_maybe_null | ( | Copy_field * | copy | ) | [static] |
Definition at line 239 of file field_conv.cc.
References mySTL::copy().
Referenced by Copy_field::set().
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_copy_next_number | ( | Copy_field * | copy | ) | [static] |
Definition at line 259 of file field_conv.cc.
References mySTL::copy(), and FALSE.
Referenced by Copy_field::set().
00260 { 00261 if (*copy->from_null_ptr & copy->from_bit) 00262 { 00263 /* Same as in set_field_to_null_with_conversions() */ 00264 copy->to_field->table->auto_increment_field_not_null= FALSE; 00265 copy->to_field->reset(); 00266 } 00267 else 00268 (copy->do_copy2)(copy); 00269 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_copy_not_null | ( | Copy_field * | copy | ) | [static] |
Definition at line 226 of file field_conv.cc.
References mySTL::copy(), WARN_DATA_TRUNCATED, and MYSQL_ERROR::WARN_LEVEL_WARN.
Referenced by Copy_field::set().
00227 { 00228 if (*copy->from_null_ptr & copy->from_bit) 00229 { 00230 copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 00231 WARN_DATA_TRUNCATED, 1); 00232 copy->to_field->reset(); 00233 } 00234 else 00235 (copy->do_copy2)(copy); 00236 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_copy_null | ( | Copy_field * | copy | ) | [static] |
Definition at line 195 of file field_conv.cc.
References mySTL::copy().
Referenced by Copy_field::set().
00196 { 00197 if (*copy->from_null_ptr & copy->from_bit) 00198 { 00199 *copy->to_null_ptr|=copy->to_bit; 00200 copy->to_field->reset(); 00201 } 00202 else 00203 { 00204 *copy->to_null_ptr&= ~copy->to_bit; 00205 (copy->do_copy2)(copy); 00206 } 00207 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_copy_timestamp | ( | Copy_field * | copy | ) | [static] |
Definition at line 247 of file field_conv.cc.
References mySTL::copy().
Referenced by Copy_field::set().
00248 { 00249 if (*copy->from_null_ptr & copy->from_bit) 00250 { 00251 /* Same as in set_field_to_null_with_conversions() */ 00252 ((Field_timestamp*) copy->to_field)->set_time(); 00253 } 00254 else 00255 (copy->do_copy2)(copy); 00256 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_cut_string | ( | Copy_field * | copy | ) | [static] |
Definition at line 330 of file field_conv.cc.
References mySTL::copy(), charset_info_st::cset, memcpy, MY_SEQ_SPACES, my_charset_handler_st::scan, WARN_DATA_TRUNCATED, and MYSQL_ERROR::WARN_LEVEL_WARN.
00331 { 00332 CHARSET_INFO *cs= copy->from_field->charset(); 00333 memcpy(copy->to_ptr,copy->from_ptr,copy->to_length); 00334 00335 /* Check if we loosed any important characters */ 00336 if (cs->cset->scan(cs, 00337 copy->from_ptr + copy->to_length, 00338 copy->from_ptr + copy->from_length, 00339 MY_SEQ_SPACES) < copy->from_length - copy->to_length) 00340 { 00341 copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 00342 WARN_DATA_TRUNCATED, 1); 00343 } 00344 }
Here is the call graph for this function:

| static void do_cut_string_complex | ( | Copy_field * | copy | ) | [static] |
Definition at line 352 of file field_conv.cc.
References mySTL::copy(), charset_info_st::cset, my_charset_handler_st::fill, charset_info_st::mbmaxlen, memcpy, MY_SEQ_SPACES, my_charset_handler_st::scan, WARN_DATA_TRUNCATED, MYSQL_ERROR::WARN_LEVEL_WARN, and my_charset_handler_st::well_formed_len.
00353 { // Shorter string field 00354 int well_formed_error; 00355 CHARSET_INFO *cs= copy->from_field->charset(); 00356 const char *from_end= copy->from_ptr + copy->from_length; 00357 uint copy_length= cs->cset->well_formed_len(cs, copy->from_ptr, from_end, 00358 copy->to_length / cs->mbmaxlen, 00359 &well_formed_error); 00360 if (copy->to_length < copy_length) 00361 copy_length= copy->to_length; 00362 memcpy(copy->to_ptr, copy->from_ptr, copy_length); 00363 00364 /* Check if we lost any important characters */ 00365 if (well_formed_error || 00366 cs->cset->scan(cs, copy->from_ptr + copy_length, from_end, 00367 MY_SEQ_SPACES) < (copy->from_length - copy_length)) 00368 { 00369 copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 00370 WARN_DATA_TRUNCATED, 1); 00371 } 00372 00373 if (copy_length < copy->to_length) 00374 cs->cset->fill(cs, copy->to_ptr + copy_length, 00375 copy->to_length - copy_length, ' '); 00376 }
Here is the call graph for this function:

| static void do_expand_binary | ( | Copy_field * | copy | ) | [static] |
Definition at line 381 of file field_conv.cc.
References mySTL::copy(), charset_info_st::cset, my_charset_handler_st::fill, and memcpy.
00382 { 00383 CHARSET_INFO *cs= copy->from_field->charset(); 00384 memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); 00385 cs->cset->fill(cs, copy->to_ptr+copy->from_length, 00386 copy->to_length-copy->from_length, '\0'); 00387 }
Here is the call graph for this function:

| static void do_expand_string | ( | Copy_field * | copy | ) | [static] |
Definition at line 391 of file field_conv.cc.
References mySTL::copy(), charset_info_st::cset, my_charset_handler_st::fill, and memcpy.
00392 { 00393 CHARSET_INFO *cs= copy->from_field->charset(); 00394 memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); 00395 cs->cset->fill(cs, copy->to_ptr+copy->from_length, 00396 copy->to_length-copy->from_length, ' '); 00397 }
Here is the call graph for this function:

| static void do_field_1 | ( | Copy_field * | copy | ) | [static] |
Definition at line 32 of file field_conv.cc.
References mySTL::copy().
Here is the call graph for this function:

| static void do_field_2 | ( | Copy_field * | copy | ) | [static] |
Definition at line 37 of file field_conv.cc.
References mySTL::copy().
Here is the call graph for this function:

| static void do_field_3 | ( | Copy_field * | copy | ) | [static] |
Definition at line 43 of file field_conv.cc.
References mySTL::copy().
00044 { 00045 copy->to_ptr[0]=copy->from_ptr[0]; 00046 copy->to_ptr[1]=copy->from_ptr[1]; 00047 copy->to_ptr[2]=copy->from_ptr[2]; 00048 }
Here is the call graph for this function:

| static void do_field_4 | ( | Copy_field * | copy | ) | [static] |
| static void do_field_6 | ( | Copy_field * | copy | ) | [static] |
Definition at line 58 of file field_conv.cc.
References mySTL::copy().
00059 { // For blob field 00060 copy->to_ptr[0]=copy->from_ptr[0]; 00061 copy->to_ptr[1]=copy->from_ptr[1]; 00062 copy->to_ptr[2]=copy->from_ptr[2]; 00063 copy->to_ptr[3]=copy->from_ptr[3]; 00064 copy->to_ptr[4]=copy->from_ptr[4]; 00065 copy->to_ptr[5]=copy->from_ptr[5]; 00066 }
Here is the call graph for this function:

| static void do_field_8 | ( | Copy_field * | copy | ) | [static] |
Definition at line 68 of file field_conv.cc.
References mySTL::copy().
00069 { 00070 copy->to_ptr[0]=copy->from_ptr[0]; 00071 copy->to_ptr[1]=copy->from_ptr[1]; 00072 copy->to_ptr[2]=copy->from_ptr[2]; 00073 copy->to_ptr[3]=copy->from_ptr[3]; 00074 copy->to_ptr[4]=copy->from_ptr[4]; 00075 copy->to_ptr[5]=copy->from_ptr[5]; 00076 copy->to_ptr[6]=copy->from_ptr[6]; 00077 copy->to_ptr[7]=copy->from_ptr[7]; 00078 }
Here is the call graph for this function:

| static void do_field_eq | ( | Copy_field * | copy | ) | [static] |
Definition at line 27 of file field_conv.cc.
References mySTL::copy(), and memcpy.
Referenced by Copy_field::set().
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_field_int | ( | Copy_field * | copy | ) | [static] |
Definition at line 311 of file field_conv.cc.
References mySTL::copy(), test, UNSIGNED_FLAG, and value.
00312 { 00313 longlong value= copy->from_field->val_int(); 00314 copy->to_field->store(value, 00315 test(copy->from_field->flags & UNSIGNED_FLAG)); 00316 }
Here is the call graph for this function:

| static void do_field_real | ( | Copy_field * | copy | ) | [static] |
Definition at line 318 of file field_conv.cc.
References mySTL::copy(), and value.
00319 { 00320 double value=copy->from_field->val_real(); 00321 copy->to_field->store(value); 00322 }
Here is the call graph for this function:

| static void do_field_string | ( | Copy_field * | copy | ) | [static] |
Definition at line 301 of file field_conv.cc.
References mySTL::copy(), and MAX_FIELD_WIDTH.
00302 { 00303 char buff[MAX_FIELD_WIDTH]; 00304 copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset()); 00305 copy->from_field->val_str(©->tmp); 00306 copy->to_field->store(copy->tmp.c_ptr_quick(),copy->tmp.length(), 00307 copy->tmp.charset()); 00308 }
Here is the call graph for this function:

| static void do_field_to_null_str | ( | Copy_field * | copy | ) | [static] |
Definition at line 81 of file field_conv.cc.
References bzero, mySTL::copy(), and memcpy.
Referenced by Copy_field::set().
00082 { 00083 if (*copy->from_null_ptr & copy->from_bit) 00084 { 00085 bzero(copy->to_ptr,copy->from_length); 00086 copy->to_null_ptr[0]=1; // Always bit 1 00087 } 00088 else 00089 { 00090 copy->to_null_ptr[0]=0; 00091 memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); 00092 } 00093 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_outer_field_null | ( | Copy_field * | copy | ) | [static] |
Definition at line 210 of file field_conv.cc.
References mySTL::copy().
Referenced by Copy_field::set().
00211 { 00212 if (*copy->null_row || 00213 copy->from_null_ptr && (*copy->from_null_ptr & copy->from_bit)) 00214 { 00215 *copy->to_null_ptr|=copy->to_bit; 00216 copy->to_field->reset(); 00217 } 00218 else 00219 { 00220 *copy->to_null_ptr&= ~copy->to_bit; 00221 (copy->do_copy2)(copy); 00222 } 00223 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_outer_field_to_null_str | ( | Copy_field * | copy | ) | [static] |
Definition at line 96 of file field_conv.cc.
References bzero, mySTL::copy(), and memcpy.
Referenced by Copy_field::set().
00097 { 00098 if (*copy->null_row || 00099 copy->from_null_ptr && (*copy->from_null_ptr & copy->from_bit)) 00100 { 00101 bzero(copy->to_ptr,copy->from_length); 00102 copy->to_null_ptr[0]=1; // Always bit 1 00103 } 00104 else 00105 { 00106 copy->to_null_ptr[0]=0; 00107 memcpy(copy->to_ptr,copy->from_ptr,copy->from_length); 00108 } 00109 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_save_blob | ( | Copy_field * | copy | ) | [static] |
Definition at line 289 of file field_conv.cc.
References mySTL::copy(), and MAX_FIELD_WIDTH.
Referenced by Copy_field::set().
00290 { 00291 char buff[MAX_FIELD_WIDTH]; 00292 String res(buff,sizeof(buff),copy->tmp.charset()); 00293 copy->from_field->val_str(&res); 00294 copy->tmp.copy(res); 00295 ((Field_blob *) copy->to_field)->store(copy->tmp.ptr(), 00296 copy->tmp.length(), 00297 copy->tmp.charset()); 00298 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void do_skip | ( | Copy_field *copy | __attribute__((unused)) | ) | [static] |
Definition at line 190 of file field_conv.cc.
Referenced by Copy_field::set(), and walk_and_match().
Here is the caller graph for this function:

| static void do_varstring1 | ( | Copy_field * | copy | ) | [static] |
Definition at line 400 of file field_conv.cc.
References mySTL::copy(), current_thd, memcpy, WARN_DATA_TRUNCATED, and MYSQL_ERROR::WARN_LEVEL_WARN.
00401 { 00402 uint length= (uint) *(uchar*) copy->from_ptr; 00403 if (length > copy->to_length- 1) 00404 { 00405 length=copy->to_length - 1; 00406 if (current_thd->count_cuted_fields) 00407 copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 00408 WARN_DATA_TRUNCATED, 1); 00409 } 00410 *(uchar*) copy->to_ptr= (uchar) length; 00411 memcpy(copy->to_ptr+1, copy->from_ptr + 1, length); 00412 }
Here is the call graph for this function:

| static void do_varstring2 | ( | Copy_field * | copy | ) | [static] |
Definition at line 415 of file field_conv.cc.
References mySTL::copy(), current_thd, HA_KEY_BLOB_LENGTH, int2store, memcpy, uint2korr, WARN_DATA_TRUNCATED, and MYSQL_ERROR::WARN_LEVEL_WARN.
00416 { 00417 uint length=uint2korr(copy->from_ptr); 00418 if (length > copy->to_length- HA_KEY_BLOB_LENGTH) 00419 { 00420 length=copy->to_length-HA_KEY_BLOB_LENGTH; 00421 if (current_thd->count_cuted_fields) 00422 copy->to_field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, 00423 WARN_DATA_TRUNCATED, 1); 00424 } 00425 int2store(copy->to_ptr,length); 00426 memcpy(copy->to_ptr+HA_KEY_BLOB_LENGTH, copy->from_ptr + HA_KEY_BLOB_LENGTH, 00427 length); 00428 }
Here is the call graph for this function:

Definition at line 642 of file field_conv.cc.
References DECIMAL_RESULT, FIELD_TYPE_BIT, FIELD_TYPE_BLOB, FIELD_TYPE_DATE, FIELD_TYPE_DATETIME, FIELD_TYPE_DECIMAL, FIELD_TYPE_ENUM, FIELD_TYPE_NEWDECIMAL, FIELD_TYPE_SET, from, MAX_FIELD_WIDTH, memcpy, MODE_INVALID_DATES, MODE_NO_ZERO_DATE, MODE_NO_ZERO_IN_DATE, MYSQL_TYPE_STRING, MYSQL_TYPE_VARCHAR, REAL_RESULT, STRING_RESULT, test, to, and UNSIGNED_FLAG.
Referenced by Item_field::save_in_field(), Item_ref::save_in_field(), and Item_field::save_org_in_field().
00643 { 00644 if (to->real_type() == from->real_type() && 00645 !(to->type() == FIELD_TYPE_BLOB && to->table->copy_blobs)) 00646 { 00647 if (to->pack_length() == from->pack_length() && 00648 !(to->flags & UNSIGNED_FLAG && !(from->flags & UNSIGNED_FLAG)) && 00649 to->real_type() != FIELD_TYPE_ENUM && 00650 to->real_type() != FIELD_TYPE_SET && 00651 to->real_type() != FIELD_TYPE_BIT && 00652 (to->real_type() != FIELD_TYPE_NEWDECIMAL || 00653 (to->field_length == from->field_length && 00654 (((Field_num*)to)->dec == ((Field_num*)from)->dec))) && 00655 from->charset() == to->charset() && 00656 to->table->s->db_low_byte_first == from->table->s->db_low_byte_first && 00657 (!(to->table->in_use->variables.sql_mode & 00658 (MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE | MODE_INVALID_DATES)) || 00659 to->type() != FIELD_TYPE_DATE && 00660 to->type() != FIELD_TYPE_DATETIME) && 00661 (from->real_type() != MYSQL_TYPE_VARCHAR || 00662 ((Field_varstring*)from)->length_bytes == 00663 ((Field_varstring*)to)->length_bytes)) 00664 { // Identical fields 00665 #ifdef HAVE_purify 00666 /* This may happen if one does 'UPDATE ... SET x=x' */ 00667 if (to->ptr != from->ptr) 00668 #endif 00669 memcpy(to->ptr,from->ptr,to->pack_length()); 00670 return; 00671 } 00672 } 00673 if (to->type() == FIELD_TYPE_BLOB) 00674 { // Be sure the value is stored 00675 Field_blob *blob=(Field_blob*) to; 00676 from->val_str(&blob->value); 00677 /* 00678 Copy value if copy_blobs is set, or source is not a string and 00679 we have a pointer to its internal string conversion buffer. 00680 */ 00681 if (to->table->copy_blobs || 00682 (!blob->value.is_alloced() && 00683 from->real_type() != MYSQL_TYPE_STRING && 00684 from->real_type() != MYSQL_TYPE_VARCHAR)) 00685 blob->value.copy(); 00686 blob->store(blob->value.ptr(),blob->value.length(),from->charset()); 00687 return; 00688 } 00689 if ((from->result_type() == STRING_RESULT && 00690 (to->result_type() == STRING_RESULT || 00691 (from->real_type() != FIELD_TYPE_ENUM && 00692 from->real_type() != FIELD_TYPE_SET))) || 00693 to->type() == FIELD_TYPE_DECIMAL) 00694 { 00695 char buff[MAX_FIELD_WIDTH]; 00696 String result(buff,sizeof(buff),from->charset()); 00697 from->val_str(&result); 00698 /* 00699 We use c_ptr_quick() here to make it easier if to is a float/double 00700 as the conversion routines will do a copy of the result doesn't 00701 end with \0. Can be replaced with .ptr() when we have our own 00702 string->double conversion. 00703 */ 00704 to->store(result.c_ptr_quick(),result.length(),from->charset()); 00705 } 00706 else if (from->result_type() == REAL_RESULT) 00707 to->store(from->val_real()); 00708 else if (from->result_type() == DECIMAL_RESULT) 00709 { 00710 my_decimal buff; 00711 to->store_decimal(from->val_decimal(&buff)); 00712 } 00713 else 00714 to->store(from->val_int(), test(from->flags & UNSIGNED_FLAG)); 00715 }
Here is the caller graph for this function:

| int set_field_to_null | ( | Field * | field | ) |
Definition at line 113 of file field_conv.cc.
References CHECK_FIELD_WARN, current_thd, ER_BAD_NULL_ERROR, Field::field_name, my_error(), MYF, Field::real_maybe_null(), Field::reset(), Field::set_null(), Field::set_warning(), WARN_DATA_TRUNCATED, and MYSQL_ERROR::WARN_LEVEL_WARN.
Referenced by Item_copy_string::save_in_field(), Item::save_in_field(), Item_string::save_in_field(), Item_int::save_in_field(), Item_float::save_in_field(), Item_date::save_in_field(), and Item_null::save_safe_in_field().
00114 { 00115 if (field->real_maybe_null()) 00116 { 00117 field->set_null(); 00118 field->reset(); 00119 return 0; 00120 } 00121 field->reset(); 00122 if (current_thd->count_cuted_fields == CHECK_FIELD_WARN) 00123 { 00124 field->set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, WARN_DATA_TRUNCATED, 1); 00125 return 0; 00126 } 00127 if (!current_thd->no_errors) 00128 my_error(ER_BAD_NULL_ERROR, MYF(0), field->field_name); 00129 return -1; 00130 }
Here is the call graph for this function:

Here is the caller graph for this function:


