~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/item.cc

MergedĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
 
54
54
String *
55
 
Hybrid_type_traits::val_str(Hybrid_type *val, String *to, uint8 decimals) const
 
55
Hybrid_type_traits::val_str(Hybrid_type *val, String *to, uint8_t decimals) const
56
56
{
57
57
  to->set_real(val->real, decimals, &my_charset_bin);
58
58
  return to;
130
130
 
131
131
String *
132
132
Hybrid_type_traits_decimal::val_str(Hybrid_type *val, String *to,
133
 
                                    uint8 decimals) const
 
133
                                    uint8_t decimals) const
134
134
{
135
135
  my_decimal_round(E_DEC_FATAL_ERROR, &val->dec_buf[val->used_dec_buf_no],
136
136
                   decimals, false, &val->dec_buf[2]);
1343
1343
  for (i= 0, arg= args; i < nargs; i++, arg+= item_sep)
1344
1344
  {
1345
1345
    Item* conv;
1346
 
    uint32 dummy_offset;
 
1346
    uint32_t dummy_offset;
1347
1347
    if (!String::needs_conversion(0, (*arg)->collation.collation,
1348
1348
                                  coll.collation,
1349
1349
                                  &dummy_offset))
1845
1845
{
1846
1846
  str2my_decimal(E_DEC_FATAL_ERROR, str_arg, length, charset, &decimal_value);
1847
1847
  name= (char*) str_arg;
1848
 
  decimals= (uint8) decimal_value.frac;
 
1848
  decimals= (uint8_t) decimal_value.frac;
1849
1849
  fixed= 1;
1850
1850
  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
1851
1851
                                             decimals, unsigned_flag);
1854
1854
Item_decimal::Item_decimal(int64_t val, bool unsig)
1855
1855
{
1856
1856
  int2my_decimal(E_DEC_FATAL_ERROR, val, unsig, &decimal_value);
1857
 
  decimals= (uint8) decimal_value.frac;
 
1857
  decimals= (uint8_t) decimal_value.frac;
1858
1858
  fixed= 1;
1859
1859
  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
1860
1860
                                             decimals, unsigned_flag);
1866
1866
                           int scale __attribute__((__unused__)))
1867
1867
{
1868
1868
  double2my_decimal(E_DEC_FATAL_ERROR, val, &decimal_value);
1869
 
  decimals= (uint8) decimal_value.frac;
 
1869
  decimals= (uint8_t) decimal_value.frac;
1870
1870
  fixed= 1;
1871
1871
  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
1872
1872
                                             decimals, unsigned_flag);
1878
1878
{
1879
1879
  my_decimal2decimal(val_arg, &decimal_value);
1880
1880
  name= (char*) str;
1881
 
  decimals= (uint8) decimal_par;
 
1881
  decimals= (uint8_t) decimal_par;
1882
1882
  max_length= length;
1883
1883
  fixed= 1;
1884
1884
}
1887
1887
Item_decimal::Item_decimal(my_decimal *value_par)
1888
1888
{
1889
1889
  my_decimal2decimal(value_par, &decimal_value);
1890
 
  decimals= (uint8) decimal_value.frac;
 
1890
  decimals= (uint8_t) decimal_value.frac;
1891
1891
  fixed= 1;
1892
1892
  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
1893
1893
                                             decimals, unsigned_flag);
1898
1898
{
1899
1899
  binary2my_decimal(E_DEC_FATAL_ERROR, bin,
1900
1900
                    &decimal_value, precision, scale);
1901
 
  decimals= (uint8) decimal_value.frac;
 
1901
  decimals= (uint8_t) decimal_value.frac;
1902
1902
  fixed= 1;
1903
1903
  max_length= my_decimal_precision_to_length(precision, decimals,
1904
1904
                                             unsigned_flag);
1956
1956
void Item_decimal::set_decimal_value(my_decimal *value_par)
1957
1957
{
1958
1958
  my_decimal2decimal(value_par, &decimal_value);
1959
 
  decimals= (uint8) decimal_value.frac;
 
1959
  decimals= (uint8_t) decimal_value.frac;
1960
1960
  unsigned_flag= !decimal_value.sign();
1961
1961
  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
1962
1962
                                             decimals, unsigned_flag);
2174
2174
  return;
2175
2175
}
2176
2176
 
2177
 
void Item_param::set_int(int64_t i, uint32 max_length_arg)
 
2177
void Item_param::set_int(int64_t i, uint32_t max_length_arg)
2178
2178
{
2179
2179
  value.integer= (int64_t) i;
2180
2180
  state= INT_VALUE;
2236
2236
    MAX_DATE_STRING_REP_LENGTH buffer.
2237
2237
*/
2238
2238
void Item_param::set_time(MYSQL_TIME *tm, timestamp_type time_type,
2239
 
                          uint32 max_length_arg)
 
2239
                          uint32_t max_length_arg)
2240
2240
2241
2241
  value.time= *tm;
2242
2242
  value.time.time_type= time_type;
2338
2338
    {
2339
2339
      CHARSET_INFO *fromcs= entry->collation.collation;
2340
2340
      CHARSET_INFO *tocs= thd->variables.collation_connection;
2341
 
      uint32 dummy_offset;
 
2341
      uint32_t dummy_offset;
2342
2342
 
2343
2343
      value.cs_info.character_set_of_placeholder= 
2344
2344
        value.cs_info.character_set_client= fromcs;
2646
2646
      *ptr++= '\'';
2647
2647
      ptr+= (uint) my_TIME_to_str(&value.time, ptr);
2648
2648
      *ptr++= '\'';
2649
 
      str->length((uint32) (ptr - buf));
 
2649
      str->length((uint32_t) (ptr - buf));
2650
2650
      break;
2651
2651
    }
2652
2652
  case STRING_VALUE:
4471
4471
    my_error(ER_ILLEGAL_VALUE_FOR_TYPE, MYF(0), "double", (char*) str_arg);
4472
4472
  }
4473
4473
  presentation= name=(char*) str_arg;
4474
 
  decimals=(uint8) nr_of_decimals(str_arg, str_arg+length);
 
4474
  decimals=(uint8_t) nr_of_decimals(str_arg, str_arg+length);
4475
4475
  max_length=length;
4476
4476
  fixed= 1;
4477
4477
}
4587
4587
                        collation.collation);
4588
4588
 
4589
4589
  uint64_t nr;
4590
 
  uint32 length= str_value.length();
 
4590
  uint32_t length= str_value.length();
4591
4591
  if (length > 8)
4592
4592
  {
4593
4593
    nr= field->flags & UNSIGNED_FLAG ? UINT64_MAX : INT64_MAX;
6338
6338
  case STRING_RESULT:
6339
6339
  {
6340
6340
    const char *old_cs, *old_derivation;
6341
 
    uint32 old_max_chars= max_length / collation.collation->mbmaxlen;
 
6341
    uint32_t old_max_chars= max_length / collation.collation->mbmaxlen;
6342
6342
    old_cs= collation.collation->name;
6343
6343
    old_derivation= collation.derivation_name();
6344
6344
    if (collation.aggregate(item->collation, MY_COLL_ALLOW_CONV))
6403
6403
    length
6404
6404
*/
6405
6405
 
6406
 
uint32 Item_type_holder::display_length(Item *item)
 
6406
uint32_t Item_type_holder::display_length(Item *item)
6407
6407
{
6408
6408
  if (item->type() == Item::FIELD_ITEM)
6409
6409
    return ((Item_field *)item)->max_disp_length();