~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

  • Committer: Olaf van der Spek
  • Date: 2011-07-04 19:11:47 UTC
  • mto: This revision was merged to the branch mainline in revision 2367.
  • Revision ID: olafvdspek@gmail.com-20110704191147-s99ojek811zi1fzj
RemoveĀ unusedĀ Name_resolution_context::error_reporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
#include "drizzled/sql_select.h"
22
 
#include "drizzled/error.h"
23
 
#include "drizzled/show.h"
24
 
#include "drizzled/item/cmpfunc.h"
25
 
#include "drizzled/item/cache_row.h"
26
 
#include "drizzled/item/type_holder.h"
27
 
#include "drizzled/item/sum.h"
28
 
#include "drizzled/item/copy_string.h"
29
 
#include "drizzled/function/str/conv_charset.h"
30
 
#include "drizzled/sql_base.h"
31
 
#include "drizzled/util/convert.h"
32
 
#include "drizzled/plugin/client.h"
33
 
#include "drizzled/time_functions.h"
34
 
 
35
 
#include "drizzled/field/str.h"
36
 
#include "drizzled/field/num.h"
37
 
 
38
 
#include "drizzled/field/blob.h"
39
 
#include "drizzled/field/date.h"
40
 
#include "drizzled/field/datetime.h"
41
 
#include "drizzled/field/decimal.h"
42
 
#include "drizzled/field/double.h"
43
 
#include "drizzled/field/enum.h"
44
 
#include "drizzled/field/epoch.h"
45
 
#include "drizzled/field/int32.h"
46
 
#include "drizzled/field/int64.h"
47
 
#include "drizzled/field/microtime.h"
48
 
#include "drizzled/field/null.h"
49
 
#include "drizzled/field/real.h"
50
 
#include "drizzled/field/size.h"
51
 
#include "drizzled/field/time.h"
52
 
#include "drizzled/field/varstring.h"
53
 
 
54
 
#include "drizzled/internal/m_string.h"
 
20
#include <config.h>
 
21
#include <drizzled/sql_select.h>
 
22
#include <drizzled/error.h>
 
23
#include <drizzled/show.h>
 
24
#include <drizzled/item/cmpfunc.h>
 
25
#include <drizzled/item/cache_row.h>
 
26
#include <drizzled/item/type_holder.h>
 
27
#include <drizzled/item/sum.h>
 
28
#include <drizzled/item/copy_string.h>
 
29
#include <drizzled/function/str/conv_charset.h>
 
30
#include <drizzled/sql_base.h>
 
31
#include <drizzled/util/convert.h>
 
32
#include <drizzled/plugin/client.h>
 
33
#include <drizzled/time_functions.h>
 
34
#include <drizzled/field/str.h>
 
35
#include <drizzled/field/num.h>
 
36
#include <drizzled/field/blob.h>
 
37
#include <drizzled/field/date.h>
 
38
#include <drizzled/field/datetime.h>
 
39
#include <drizzled/field/decimal.h>
 
40
#include <drizzled/field/double.h>
 
41
#include <drizzled/field/enum.h>
 
42
#include <drizzled/field/epoch.h>
 
43
#include <drizzled/field/int32.h>
 
44
#include <drizzled/field/int64.h>
 
45
#include <drizzled/field/microtime.h>
 
46
#include <drizzled/field/null.h>
 
47
#include <drizzled/field/real.h>
 
48
#include <drizzled/field/size.h>
 
49
#include <drizzled/field/time.h>
 
50
#include <drizzled/field/varstring.h>
 
51
#include <drizzled/current_session.h>
 
52
#include <drizzled/session.h>
 
53
#include <drizzled/internal/m_string.h>
 
54
#include <drizzled/item/ref.h>
 
55
#include <drizzled/item/subselect.h>
 
56
#include <drizzled/sql_lex.h>
 
57
#include <drizzled/system_variables.h>
55
58
 
56
59
#include <cstdio>
57
60
#include <math.h>
60
63
 
61
64
using namespace std;
62
65
 
63
 
namespace drizzled
64
 
{
 
66
namespace drizzled {
65
67
 
66
68
const String my_null_string("NULL", 4, default_charset_info);
67
69
 
173
175
type::Decimal *Item::val_decimal_from_string(type::Decimal *decimal_value)
174
176
{
175
177
  String *res;
176
 
  char *end_ptr;
177
178
  if (!(res= val_str(&str_value)))
178
179
    return NULL;
179
180
 
180
 
  end_ptr= (char*) res->ptr()+ res->length();
181
181
  if (decimal_value->store(E_DEC_FATAL_ERROR & ~E_DEC_BAD_NUM,
182
182
                     res->ptr(), 
183
183
                     res->length(), 
283
283
  is_expensive_cache(-1),
284
284
  name(0), 
285
285
  name_length(0),
286
 
  orig_name(0), 
287
286
  max_length(0), 
288
287
  marker(0),
289
288
  decimals(0),
305
304
 
306
305
  /*
307
306
    Item constructor can be called during execution other then SQL_COM
308
 
    command => we should check session->lex->current_select on zero (session->lex
 
307
    command => we should check session->lex().current_select on zero (session->lex
309
308
    can be uninitialised)
310
309
  */
311
 
  if (getSession().lex->current_select)
 
310
  if (getSession().lex().current_select)
312
311
  {
313
 
    enum_parsing_place place= getSession().getLex()->current_select->parsing_place;
 
312
    enum_parsing_place place= getSession().lex().current_select->parsing_place;
314
313
    if (place == SELECT_LIST || place == IN_HAVING)
315
 
      getSession().getLex()->current_select->select_n_having_items++;
 
314
      getSession().lex().current_select->select_n_having_items++;
316
315
  }
317
316
}
318
317
 
321
320
  str_value(item->str_value),
322
321
  name(item->name),
323
322
  name_length(item->name_length),
324
 
  orig_name(item->orig_name),
325
323
  max_length(item->max_length),
326
324
  marker(item->marker),
327
325
  decimals(item->decimals),
361
359
  return class_decimal_int_part(decimal_precision(), decimals);
362
360
}
363
361
 
364
 
void Item::print(String *str, enum_query_type)
 
362
void Item::print(String *str)
365
363
{
366
364
  str->append(full_name());
367
365
}
368
366
 
369
 
void Item::print_item_w_name(String *str, enum_query_type query_type)
 
367
void Item::print_item_w_name(String *str)
370
368
{
371
 
  print(str, query_type);
 
369
  print(str);
372
370
 
373
371
  if (name)
374
372
  {
384
382
{
385
383
  fixed= false;
386
384
  marker= 0;
387
 
  if (orig_name)
388
 
    name= orig_name;
389
 
  return;
390
 
}
391
 
 
392
 
void Item::rename(char *new_name)
393
 
{
394
 
  /*
395
 
    we can compare pointers to names here, because if name was not changed,
396
 
    pointer will be same
397
 
  */
398
 
  if (! orig_name && new_name != name)
399
 
    orig_name= name;
400
 
  name= new_name;
401
385
}
402
386
 
403
387
Item* Item::transform(Item_transformer transformer, unsigned char *arg)
415
399
  return false;
416
400
}
417
401
 
418
 
void Item::set_name(const char *str, uint32_t length, const CHARSET_INFO * const cs)
 
402
void Item::set_name(const char *str, uint32_t length, const charset_info_st * const cs)
419
403
{
420
404
  if (!length)
421
405
  {
422
406
    /* Empty string, used by AS or internal function like last_insert_id() */
423
 
    name= (char*) str;
 
407
    name= str;
424
408
    name_length= 0;
425
409
    return;
426
410
  }
436
420
    if (orig_len != length && ! is_autogenerated_name)
437
421
    {
438
422
      if (length == 0)
439
 
        push_warning_printf(&getSession(), 
440
 
                            DRIZZLE_ERROR::WARN_LEVEL_WARN,
441
 
                            ER_NAME_BECOMES_EMPTY, 
442
 
                            ER(ER_NAME_BECOMES_EMPTY),
443
 
                            str + length - orig_len);
 
423
        push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_NAME_BECOMES_EMPTY, ER(ER_NAME_BECOMES_EMPTY), str + length - orig_len);
444
424
      else
445
 
        push_warning_printf(&getSession(),
446
 
                            DRIZZLE_ERROR::WARN_LEVEL_WARN,
447
 
                            ER_REMOVED_SPACES, 
448
 
                            ER(ER_REMOVED_SPACES),
449
 
                            str + length - orig_len);
 
425
        push_warning_printf(&getSession(), DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_REMOVED_SPACES, ER(ER_REMOVED_SPACES), str + length - orig_len);
450
426
    }
451
427
  }
452
428
  name= memory::sql_strmake(str, length);
465
441
         ! my_strcasecmp(system_charset_info, name, item->name);
466
442
}
467
443
 
468
 
Item *Item::safe_charset_converter(const CHARSET_INFO * const tocs)
 
444
Item *Item::safe_charset_converter(const charset_info_st * const tocs)
469
445
{
470
446
  Item_func_conv_charset *conv= new Item_func_conv_charset(this, tocs, 1);
471
447
  return conv->safe ? conv : NULL;
592
568
  return copy_or_same(session);
593
569
}
594
570
 
595
 
const CHARSET_INFO *Item::default_charset()
 
571
const charset_info_st *Item::default_charset()
596
572
{
597
573
  return current_session->variables.getCollation();
598
574
}
599
575
 
600
 
const CHARSET_INFO *Item::compare_collation()
 
576
const charset_info_st *Item::compare_collation()
601
577
{
602
578
  return NULL;
603
579
}
627
603
  return false;
628
604
}
629
605
 
630
 
bool Item::remove_fixed(unsigned char *)
631
 
{
632
 
  fixed= false;
633
 
  return false;
634
 
}
635
 
 
636
606
bool Item::collect_item_field_processor(unsigned char *)
637
607
{
638
608
  return false;
722
692
bool Item::is_expensive()
723
693
{
724
694
  if (is_expensive_cache < 0)
725
 
    is_expensive_cache= walk(&Item::is_expensive_processor, 0,
726
 
                             (unsigned char*)0);
 
695
    is_expensive_cache= walk(&Item::is_expensive_processor, 0, NULL);
727
696
  return test(is_expensive_cache);
728
697
}
729
698
 
739
708
                  const char *table_name_arg, const char *field_name_arg)
740
709
    :Item_ref(context_arg, item, table_name_arg, field_name_arg) {}
741
710
 
742
 
  virtual inline void print (String *str, enum_query_type query_type)
 
711
  virtual inline void print (String *str)
743
712
  {
744
713
    if (ref)
745
 
      (*ref)->print(str, query_type);
 
714
      (*ref)->print(str);
746
715
    else
747
 
      Item_ident::print(str, query_type);
 
716
      Item_ident::print(str);
748
717
  }
749
718
};
750
719
 
781
750
      Item_ref to allow fields from view being stored in tmp table.
782
751
    */
783
752
    Item_aggregate_ref *item_ref;
784
 
    uint32_t el= fields.elements;
 
753
    uint32_t el= fields.size();
785
754
    Item *real_itm= real_item();
786
755
 
787
756
    ref_pointer_array[el]= real_itm;
788
 
    if (!(item_ref= new Item_aggregate_ref(&session->lex->current_select->context,
789
 
                                           ref_pointer_array + el, 0, name)))
790
 
      return; /* fatal_error is set */
 
757
    item_ref= new Item_aggregate_ref(&session->lex().current_select->context, ref_pointer_array + el, 0, name);
791
758
    if (type() == SUM_FUNC_ITEM)
792
759
      item_ref->depended_from= ((Item_sum *) this)->depended_from();
793
760
    fields.push_front(real_itm);
794
 
    session->change_item_tree(ref, item_ref);
 
761
    *ref= item_ref;
795
762
  }
796
763
}
797
764
 
818
785
  if (mark_item)
819
786
    mark_item->depended_from= last;
820
787
  current->mark_as_dependent(last);
821
 
  if (session->lex->describe & DESCRIBE_EXTENDED)
 
788
  if (session->lex().describe & DESCRIBE_EXTENDED)
822
789
  {
823
790
    char warn_buff[DRIZZLE_ERRMSG_SIZE];
824
791
    snprintf(warn_buff, sizeof(warn_buff), ER(ER_WARN_FIELD_RESOLVED),
1087
1054
 
1088
1055
bool Item::is_datetime()
1089
1056
{
1090
 
  switch (field_type())
1091
 
  {
1092
 
    case DRIZZLE_TYPE_TIME:
1093
 
    case DRIZZLE_TYPE_DATE:
1094
 
    case DRIZZLE_TYPE_DATETIME:
1095
 
    case DRIZZLE_TYPE_TIMESTAMP:
1096
 
    case DRIZZLE_TYPE_MICROTIME:
1097
 
      return true;
1098
 
    case DRIZZLE_TYPE_BLOB:
1099
 
    case DRIZZLE_TYPE_VARCHAR:
1100
 
    case DRIZZLE_TYPE_DOUBLE:
1101
 
    case DRIZZLE_TYPE_DECIMAL:
1102
 
    case DRIZZLE_TYPE_ENUM:
1103
 
    case DRIZZLE_TYPE_LONG:
1104
 
    case DRIZZLE_TYPE_LONGLONG:
1105
 
    case DRIZZLE_TYPE_NULL:
1106
 
    case DRIZZLE_TYPE_UUID:
1107
 
    case DRIZZLE_TYPE_BOOLEAN:
1108
 
      return false;
1109
 
  }
1110
 
 
1111
 
  assert(0);
1112
 
  abort();
 
1057
  return field::isDateTime(field_type());
1113
1058
}
1114
1059
 
1115
1060
String *Item::check_well_formed_result(String *str, bool send_error)
1116
1061
{
1117
1062
  /* Check whether we got a well-formed string */
1118
 
  const CHARSET_INFO * const cs= str->charset();
 
1063
  const charset_info_st * const cs= str->charset();
1119
1064
  int well_formed_error;
1120
1065
  uint32_t wlen= cs->cset->well_formed_len(cs,
1121
1066
                                       str->ptr(), str->ptr() + str->length(),
1144
1089
  return str;
1145
1090
}
1146
1091
 
1147
 
bool Item::eq_by_collation(Item *item, bool binary_cmp, const CHARSET_INFO * const cs)
 
1092
bool Item::eq_by_collation(Item *item, bool binary_cmp, const charset_info_st * const cs)
1148
1093
{
1149
 
  const CHARSET_INFO *save_cs= 0;
1150
 
  const CHARSET_INFO *save_item_cs= 0;
 
1094
  const charset_info_st *save_cs= 0;
 
1095
  const charset_info_st *save_item_cs= 0;
1151
1096
  if (collation.collation != cs)
1152
1097
  {
1153
1098
    save_cs= collation.collation;
1216
1161
                            name, decimals, 0, unsigned_flag);
1217
1162
    break;
1218
1163
  case DRIZZLE_TYPE_NULL:
1219
 
    field= new Field_null((unsigned char*) 0, max_length, name, &my_charset_bin);
 
1164
    field= new Field_null((unsigned char*) 0, max_length, name);
1220
1165
    break;
1221
1166
  case DRIZZLE_TYPE_DATE:
1222
 
    field= new Field_date(maybe_null, name, &my_charset_bin);
 
1167
    field= new Field_date(maybe_null, name);
1223
1168
    break;
1224
1169
 
1225
1170
  case DRIZZLE_TYPE_MICROTIME:
1230
1175
    field= new field::Epoch(maybe_null, name);
1231
1176
    break;
1232
1177
  case DRIZZLE_TYPE_DATETIME:
1233
 
    field= new Field_datetime(maybe_null, name, &my_charset_bin);
 
1178
    field= new Field_datetime(maybe_null, name);
1234
1179
    break;
1235
1180
  case DRIZZLE_TYPE_TIME:
1236
 
    field= new field::Time(maybe_null, name, &my_charset_bin);
 
1181
    field= new field::Time(maybe_null, name);
1237
1182
    break;
1238
1183
  case DRIZZLE_TYPE_BOOLEAN:
1239
1184
  case DRIZZLE_TYPE_UUID:
1262
1207
  if (result_type() == STRING_RESULT)
1263
1208
  {
1264
1209
    String *result;
1265
 
    const CHARSET_INFO * const cs= collation.collation;
 
1210
    const charset_info_st * const cs= collation.collation;
1266
1211
    char buff[MAX_FIELD_WIDTH];         // Alloc buffer for small columns
1267
1212
    str_value.set_quick(buff, sizeof(buff), cs);
1268
1213
    result=val_str(&str_value);
1374
1319
  return this;
1375
1320
}
1376
1321
 
1377
 
bool Item::send(plugin::Client *client, String *buffer)
 
1322
void Item::send(plugin::Client *client, String *buffer)
1378
1323
{
1379
 
  bool result= false;
1380
 
  enum_field_types f_type;
1381
 
 
1382
 
  switch ((f_type=field_type())) {
 
1324
  switch (field_type())
 
1325
  {
1383
1326
  case DRIZZLE_TYPE_DATE:
1384
1327
  case DRIZZLE_TYPE_NULL:
1385
1328
  case DRIZZLE_TYPE_ENUM:
1389
1332
  case DRIZZLE_TYPE_UUID:
1390
1333
  case DRIZZLE_TYPE_DECIMAL:
1391
1334
    {
1392
 
      String *res;
1393
 
      if ((res=val_str(buffer)))
1394
 
        result= client->store(res->ptr(),res->length());
 
1335
      if (String* res=val_str(buffer))
 
1336
        client->store(res->ptr(), res->length());
1395
1337
      break;
1396
1338
    }
1397
1339
  case DRIZZLE_TYPE_LONG:
1398
1340
    {
1399
 
      int64_t nr;
1400
 
      nr= val_int();
 
1341
      int64_t nr= val_int();
1401
1342
      if (!null_value)
1402
 
        result= client->store((int32_t)nr);
 
1343
        client->store((int32_t)nr);
1403
1344
      break;
1404
1345
    }
1405
1346
  case DRIZZLE_TYPE_LONGLONG:
1406
1347
    {
1407
 
      int64_t nr;
1408
 
      nr= val_int();
 
1348
      int64_t nr= val_int();
1409
1349
      if (!null_value)
1410
1350
      {
1411
1351
        if (unsigned_flag)
1412
 
          result= client->store((uint64_t)nr);
 
1352
          client->store((uint64_t)nr);
1413
1353
        else
1414
 
          result= client->store((int64_t)nr);
 
1354
          client->store((int64_t)nr);
1415
1355
      }
1416
1356
      break;
1417
1357
    }
1419
1359
    {
1420
1360
      double nr= val_real();
1421
1361
      if (!null_value)
1422
 
        result= client->store(nr, decimals, buffer);
 
1362
        client->store(nr, decimals, buffer);
1423
1363
      break;
1424
1364
    }
1425
1365
  case DRIZZLE_TYPE_TIME:
1427
1367
      type::Time tm;
1428
1368
      get_time(tm);
1429
1369
      if (not null_value)
1430
 
        result= client->store(&tm);
 
1370
        client->store(&tm);
1431
1371
      break;
1432
1372
    }
1433
1373
  case DRIZZLE_TYPE_DATETIME:
1437
1377
      type::Time tm;
1438
1378
      get_date(tm, TIME_FUZZY_DATE);
1439
1379
      if (!null_value)
1440
 
        result= client->store(&tm);
 
1380
        client->store(&tm);
1441
1381
      break;
1442
1382
    }
1443
1383
  }
1444
1384
  if (null_value)
1445
 
    result= client->store();
1446
 
 
1447
 
  return result;
 
1385
    client->store();
1448
1386
}
1449
1387
 
1450
1388
uint32_t Item::max_char_length() const
1452
1390
  return max_length / collation.collation->mbmaxlen;
1453
1391
}
1454
1392
 
1455
 
void Item::fix_length_and_charset(uint32_t max_char_length_arg, CHARSET_INFO *cs)
1456
 
1457
 
  max_length= char_to_byte_length_safe(max_char_length_arg, cs->mbmaxlen);
1458
 
  collation.collation= cs;
1459
 
}
1460
 
 
1461
1393
void Item::fix_char_length(uint32_t max_char_length_arg)
1462
1394
1463
1395
  max_length= char_to_byte_length_safe(max_char_length_arg, collation.collation->mbmaxlen);
1464
1396
}
1465
1397
 
1466
 
void Item::fix_char_length_uint64_t(uint64_t max_char_length_arg)
1467
 
1468
 
  uint64_t max_result_length= max_char_length_arg *
1469
 
    collation.collation->mbmaxlen;
1470
 
 
1471
 
  if (max_result_length >= MAX_BLOB_WIDTH)
1472
 
  { 
1473
 
    max_length= MAX_BLOB_WIDTH;
1474
 
    maybe_null= false;
1475
 
  }
1476
 
  else
1477
 
  {
1478
 
    max_length= max_result_length;
1479
 
  }
1480
 
}
1481
 
 
1482
 
void Item::fix_length_and_charset_datetime(uint32_t max_char_length_arg)
1483
 
1484
 
  collation.set(&my_charset_bin);
1485
 
  fix_char_length(max_char_length_arg);
1486
 
}
1487
 
 
1488
1398
Item_result item_cmp_type(Item_result a,Item_result b)
1489
1399
{
1490
1400
  if (a == STRING_RESULT && b == STRING_RESULT)
1508
1418
  Item *new_item= NULL;
1509
1419
  if (item->basic_const_item())
1510
1420
    return; /* Can't be better */
1511
 
  Item_result res_type=item_cmp_type(comp_item->result_type(),
1512
 
                                     item->result_type());
1513
 
  char *name=item->name; /* Alloced by memory::sql_alloc */
 
1421
  Item_result res_type=item_cmp_type(comp_item->result_type(), item->result_type());
 
1422
  const char *name=item->name; /* Alloced by memory::sql_alloc */
1514
1423
 
1515
 
  switch (res_type) {
 
1424
  switch (res_type) 
 
1425
  {
1516
1426
  case STRING_RESULT:
1517
1427
    {
1518
1428
      char buff[MAX_FIELD_WIDTH];
1530
1440
    }
1531
1441
  case INT_RESULT:
1532
1442
    {
1533
 
      int64_t result=item->val_int();
1534
 
      uint32_t length=item->max_length;
1535
 
      bool null_value=item->null_value;
1536
 
      new_item= (null_value ? (Item*) new Item_null(name) :
1537
 
                 (Item*) new Item_int(name, result, length));
 
1443
      new_item= item->null_value ? (Item*)new Item_null(name) : (Item*)new Item_int(name, item->val_int(), item->max_length);
1538
1444
      break;
1539
1445
    }
1540
1446
  case ROW_RESULT:
1550
1456
      */
1551
1457
      Item_row *item_row= (Item_row*) item;
1552
1458
      Item_row *comp_item_row= (Item_row*) comp_item;
1553
 
      uint32_t col;
1554
1459
      new_item= 0;
1555
1460
      /*
1556
1461
        If item and comp_item are both Item_rows and have same number of cols
1560
1465
      */
1561
1466
      assert(item->result_type() == comp_item->result_type());
1562
1467
      assert(item_row->cols() == comp_item_row->cols());
1563
 
      col= item_row->cols();
1564
 
      while (col-- > 0)
1565
 
        resolve_const_item(session, item_row->addr(col),
1566
 
                           comp_item_row->element_index(col));
 
1468
      for (uint32_t col= item_row->cols(); col--; )
 
1469
        resolve_const_item(session, item_row->addr(col), comp_item_row->element_index(col));
1567
1470
      break;
1568
1471
    }
1569
1472
    /* Fallthrough */
1590
1493
  }
1591
1494
 
1592
1495
  if (new_item)
1593
 
    session->change_item_tree(ref, new_item);
 
1496
    *ref= new_item;
1594
1497
}
1595
1498
 
1596
1499
bool field_is_equal_to_item(Field *field,Item *item)
1632
1535
  return result == field->val_real();
1633
1536
}
1634
1537
 
1635
 
void dummy_error_processor(Session *, void *)
1636
 
{}
1637
 
 
1638
1538
/**
1639
1539
  Create field for temporary table using type of given item.
1640
1540
 
1700
1600
  case STRING_RESULT:
1701
1601
    assert(item->collation.collation);
1702
1602
 
1703
 
    enum enum_field_types type;
1704
1603
    /*
1705
1604
      DATE/TIME fields have STRING_RESULT result type.
1706
1605
      To preserve type they needed to be handled separately.
1707
1606
    */
1708
 
    if ((type= item->field_type()) == DRIZZLE_TYPE_DATETIME ||
1709
 
        type == DRIZZLE_TYPE_TIME ||
1710
 
        type == DRIZZLE_TYPE_MICROTIME ||
1711
 
        type == DRIZZLE_TYPE_DATE ||
1712
 
        type == DRIZZLE_TYPE_TIMESTAMP)
 
1607
    if (field::isDateTime(item->field_type()))
1713
1608
    {
1714
1609
      new_field= item->tmp_table_field_from_field_type(table, 1);
1715
1610
      /*