661
661
column read set or to register used fields in a view
664
bool Item_field::register_field_in_read_map(unsigned char *arg)
664
bool Item_field::register_field_in_read_map(uchar *arg)
666
666
Table *table= (Table *) arg;
667
667
if (field->table == table || !table)
668
668
bitmap_set_bit(field->table->read_set, field->field_index);
669
if (field->vcol_info && field->vcol_info->expr_item)
670
return field->vcol_info->expr_item->walk(&Item::register_field_in_read_map,
676
Mark field in bitmap supplied as *arg
680
bool Item_field::register_field_in_bitmap(unsigned char *arg)
682
MY_BITMAP *bitmap= (MY_BITMAP *) arg;
684
bitmap_set_bit(bitmap, field->field_index);
689
bool Item::check_cols(uint32_t c)
673
bool Item::check_cols(uint c)
1261
1245
bool agg_item_collations(DTCollation &c, const char *fname,
1262
Item **av, uint32_t count, uint32_t flags, int item_sep)
1246
Item **av, uint count, uint flags, int item_sep)
1266
1250
c.set(av[0]->collation);
1267
1251
for (i= 1, arg= &av[item_sep]; i < count; i++, arg++)
1285
1269
bool agg_item_collations_for_comparison(DTCollation &c, const char *fname,
1286
Item **av, uint32_t count, uint32_t flags)
1270
Item **av, uint count, uint flags)
1288
1272
return (agg_item_collations(c, fname, av, count,
1289
1273
flags | MY_COLL_DISALLOW_NONE, 1));
1324
1308
bool agg_item_charsets(DTCollation &coll, const char *fname,
1325
Item **args, uint32_t nargs, uint32_t flags, int item_sep)
1309
Item **args, uint nargs, uint flags, int item_sep)
1327
1311
Item **arg, *safe_args[2];
1818
Item_uint::Item_uint(const char *str_arg, uint32_t length):
1802
Item_uint::Item_uint(const char *str_arg, uint length):
1819
1803
Item_int(str_arg, length)
1821
1805
unsigned_flag= 1;
1825
Item_uint::Item_uint(const char *str_arg, int64_t i, uint32_t length):
1809
Item_uint::Item_uint(const char *str_arg, int64_t i, uint length):
1826
1810
Item_int(str_arg, i, length)
1828
1812
unsigned_flag= 1;
1850
Item_decimal::Item_decimal(const char *str_arg, uint32_t length,
1834
Item_decimal::Item_decimal(const char *str_arg, uint length,
1851
1835
const CHARSET_INFO * const charset)
1853
1837
str2my_decimal(E_DEC_FATAL_ERROR, str_arg, length, charset, &decimal_value);
1904
Item_decimal::Item_decimal(const unsigned char *bin, int precision, int scale)
1888
Item_decimal::Item_decimal(const uchar *bin, int precision, int scale)
1906
1890
binary2my_decimal(E_DEC_FATAL_ERROR, bin,
1907
1891
&decimal_value, precision, scale);
2138
2122
default_set_param_func(Item_param *param,
2139
unsigned char **pos __attribute__((unused)),
2123
uchar **pos __attribute__((unused)),
2140
2124
ulong len __attribute__((unused)))
2142
2126
param->set_null();
2146
Item_param::Item_param(uint32_t pos_in_query_arg) :
2130
Item_param::Item_param(uint pos_in_query_arg) :
2147
2131
state(NO_VALUE),
2148
2132
item_result_type(STRING_RESULT),
2149
2133
/* Don't pretend to be a literal unless value for this item is set. */
2255
2239
value.time.minute > 59 || value.time.second > 59)
2257
2241
char buff[MAX_DATE_STRING_REP_LENGTH];
2258
uint32_t length= my_TIME_to_str(&value.time, buff);
2242
uint length= my_TIME_to_str(&value.time, buff);
2259
2243
make_truncated_value_warning(current_thd, DRIZZLE_ERROR::WARN_LEVEL_WARN,
2260
2244
buff, length, time_type, 0);
2261
2245
set_zero_time(&value.time, DRIZZLE_TIMESTAMP_ERROR);
3567
3551
/* Look up in current select's item_list to find aliased fields */
3568
3552
if (thd->lex->current_select->is_item_list_lookup)
3571
3555
enum_resolution_type resolution;
3572
3556
Item** res= find_item_in_list(this, thd->lex->current_select->item_list,
3573
3557
&counter, REPORT_EXCEPT_NOT_FOUND,
3977
3963
/* Check whether we got a well-formed string */
3978
3964
const CHARSET_INFO * const cs= str->charset();
3979
3965
int well_formed_error;
3980
uint32_t wlen= cs->cset->well_formed_len(cs,
3966
uint wlen= cs->cset->well_formed_len(cs,
3981
3967
str->ptr(), str->ptr() + str->length(),
3982
3968
str->length(), &well_formed_error);
3983
3969
if (wlen < str->length())
4094
4080
The field functions defines a field to be not null if null_ptr is not 0
4096
unsigned char *null_ptr= maybe_null ? (unsigned char*) "" : 0;
4082
uchar *null_ptr= maybe_null ? (uchar*) "" : 0;
4099
4085
switch (field_type()) {
4100
4086
case DRIZZLE_TYPE_NEWDECIMAL:
4101
field= new Field_new_decimal((unsigned char*) 0, max_length, null_ptr, 0,
4087
field= new Field_new_decimal((uchar*) 0, max_length, null_ptr, 0,
4102
4088
Field::NONE, name, decimals, 0,
4103
4089
unsigned_flag);
4105
4091
case DRIZZLE_TYPE_TINY:
4106
field= new Field_tiny((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE,
4092
field= new Field_tiny((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
4107
4093
name, 0, unsigned_flag);
4109
4095
case DRIZZLE_TYPE_LONG:
4110
field= new Field_long((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE,
4096
field= new Field_long((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
4111
4097
name, 0, unsigned_flag);
4113
4099
case DRIZZLE_TYPE_LONGLONG:
4114
field= new Field_int64_t((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE,
4100
field= new Field_int64_t((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
4115
4101
name, 0, unsigned_flag);
4117
4103
case DRIZZLE_TYPE_DOUBLE:
4118
field= new Field_double((unsigned char*) 0, max_length, null_ptr, 0, Field::NONE,
4104
field= new Field_double((uchar*) 0, max_length, null_ptr, 0, Field::NONE,
4119
4105
name, decimals, 0, unsigned_flag);
4121
4107
case DRIZZLE_TYPE_NULL:
4122
field= new Field_null((unsigned char*) 0, max_length, Field::NONE,
4108
field= new Field_null((uchar*) 0, max_length, Field::NONE,
4123
4109
name, &my_charset_bin);
4125
4111
case DRIZZLE_TYPE_NEWDATE:
4608
4594
In number context this is a int64_t value.
4611
Item_bin_string::Item_bin_string(const char *str, uint32_t str_length)
4597
Item_bin_string::Item_bin_string(const char *str, uint str_length)
4613
4599
const char *end= str + str_length - 1;
4614
unsigned char bits= 0;
4617
4603
max_length= (str_length + 7) >> 3;
4618
4604
char *ptr= (char*) sql_alloc(max_length + 1);
5747
5733
new_item= new Item_null(name);
5750
uint32_t length= result->length();
5736
uint length= result->length();
5751
5737
char *tmp_str= sql_strmake(result->ptr(), length);
5752
5738
new_item= new Item_string(name, tmp_str, length, result->charset());
5756
5742
case INT_RESULT:
5758
5744
int64_t result=item->val_int();
5759
uint32_t length=item->max_length;
5745
uint length=item->max_length;
5760
5746
bool null_value=item->null_value;
5761
5747
new_item= (null_value ? (Item*) new Item_null(name) :
5762
5748
(Item*) new Item_int(name, result, length));
5795
5781
case REAL_RESULT:
5796
5782
{ // It must REAL_RESULT
5797
5783
double result= item->val_real();
5798
uint32_t length=item->max_length,decimals=item->decimals;
5784
uint length=item->max_length,decimals=item->decimals;
5799
5785
bool null_value=item->null_value;
5800
5786
new_item= (null_value ? (Item*) new Item_null(name) : (Item*)
5801
5787
new Item_float(name, result, decimals, length));
5806
5792
my_decimal decimal_value;
5807
5793
my_decimal *result= item->val_decimal(&decimal_value);
5808
uint32_t length= item->max_length, decimals= item->decimals;
5794
uint length= item->max_length, decimals= item->decimals;
5809
5795
bool null_value= item->null_value;
5810
5796
new_item= (null_value ?
5811
5797
(Item*) new Item_null(name) :
6251
6237
bool Item_type_holder::join_types(THD *thd __attribute__((unused)),
6254
uint32_t max_length_orig= max_length;
6255
uint32_t decimals_orig= decimals;
6240
uint max_length_orig= max_length;
6241
uint decimals_orig= decimals;
6256
6242
fld_type= Field::field_type_merge(fld_type, get_real_type(item));
6258
6244
int item_decimals= item->decimals;
6389
6375
The field functions defines a field to be not null if null_ptr is not 0
6391
unsigned char *null_ptr= maybe_null ? (unsigned char*) "" : 0;
6377
uchar *null_ptr= maybe_null ? (uchar*) "" : 0;
6394
6380
switch (fld_type) {
6395
6381
case DRIZZLE_TYPE_ENUM:
6396
6382
assert(enum_set_typelib);
6397
field= new Field_enum((unsigned char *) 0, max_length, null_ptr, 0,
6383
field= new Field_enum((uchar *) 0, max_length, null_ptr, 0,
6398
6384
Field::NONE, name,
6399
6385
get_enum_pack_length(enum_set_typelib->count),
6400
6386
enum_set_typelib, collation.collation);