~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item.cc

Merged from fix-headers again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
const String my_null_string("NULL", 4, default_charset_info);
38
38
 
39
39
 
 
40
const uint32_t NO_CACHED_FIELD_INDEX= UINT32_MAX;
 
41
 
 
42
 
40
43
/*****************************************************************************
41
44
** Item functions
42
45
*****************************************************************************/
50
53
}
51
54
 
52
55
 
 
56
bool Item::is_expensive_processor(unsigned char *)
 
57
{
 
58
  return 0;
 
59
}
 
60
 
 
61
void Item::fix_after_pullout(st_select_lex *, Item **)
 
62
{}
 
63
 
 
64
 
 
65
Field *Item::tmp_table_field(Table *)
 
66
{
 
67
  return 0;
 
68
}
 
69
 
 
70
 
 
71
const char *Item::full_name(void) const
 
72
{
 
73
  return name ? name : "???";
 
74
}
 
75
 
 
76
 
 
77
int64_t Item::val_int_endpoint(bool, bool *)
 
78
{
 
79
  assert(0);
 
80
  return 0;
 
81
}
 
82
 
 
83
 
53
84
/**
54
85
  @todo
55
86
    Make this functions class dependent
326
357
}
327
358
 
328
359
 
 
360
void Item::print(String *str, enum_query_type)
 
361
{
 
362
  str->append(full_name());
 
363
}
 
364
 
 
365
 
329
366
void Item::print_item_w_name(String *str, enum_query_type query_type)
330
367
{
331
368
  print(str, query_type);
339
376
}
340
377
 
341
378
 
 
379
void Item::split_sum_func(Session *, Item **, List<Item> &)
 
380
{}
 
381
 
 
382
 
342
383
void Item::cleanup()
343
384
{
344
385
  fixed=0;
833
874
      str_to_time_with_warn(res->ptr(), res->length(), ltime))
834
875
  {
835
876
    memset(ltime, 0, sizeof(*ltime));
836
 
    return 1;
 
877
    return true;
837
878
  }
838
 
  return 0;
839
 
}
 
879
  return false;
 
880
}
 
881
 
 
882
 
 
883
bool Item::get_date_result(DRIZZLE_TIME *ltime,uint32_t fuzzydate)
 
884
{
 
885
  return get_date(ltime,fuzzydate);
 
886
}
 
887
 
 
888
 
 
889
bool Item::is_null()
 
890
{
 
891
  return false;
 
892
}
 
893
 
 
894
 
 
895
void Item::update_null_value ()
 
896
{
 
897
  (void) val_int();
 
898
}
 
899
 
 
900
 
 
901
void Item::top_level_item(void)
 
902
{}
 
903
 
 
904
 
 
905
void Item::set_result_field(Field *)
 
906
{}
 
907
 
 
908
 
 
909
bool Item::is_result_field(void)
 
910
{
 
911
  return 0;
 
912
}
 
913
 
 
914
 
 
915
bool Item::is_bool_func(void)
 
916
{
 
917
  return 0;
 
918
}
 
919
 
 
920
 
 
921
void Item::save_in_result_field(bool)
 
922
{}
 
923
 
 
924
 
 
925
void Item::no_rows_in_result(void)
 
926
{}
 
927
 
 
928
 
 
929
Item *Item::copy_or_same(Session *)
 
930
{
 
931
  return this;
 
932
}
 
933
 
 
934
 
 
935
Item *Item::copy_andor_structure(Session *)
 
936
{
 
937
  return this;
 
938
}
 
939
 
 
940
 
 
941
Item *Item::real_item(void)
 
942
{
 
943
  return this;
 
944
}
 
945
 
 
946
 
 
947
Item *Item::get_tmp_table_item(Session *session)
 
948
{
 
949
  return copy_or_same(session);
 
950
}
 
951
 
840
952
 
841
953
const CHARSET_INFO *Item::default_charset()
842
954
{
844
956
}
845
957
 
846
958
 
847
 
/*
848
 
  Save value in field, but don't give any warnings
849
 
 
850
 
  NOTES
851
 
   This is used to temporary store and retrieve a value in a column,
852
 
   for example in opt_range to adjust the key value to fit the column.
853
 
*/
 
959
const CHARSET_INFO *Item::compare_collation()
 
960
{
 
961
  return NULL;
 
962
}
 
963
 
 
964
 
 
965
bool Item::walk(Item_processor processor, bool, unsigned char *arg)
 
966
{
 
967
  return (this->*processor)(arg);
 
968
}
 
969
 
 
970
 
 
971
Item* Item::compile(Item_analyzer analyzer, unsigned char **arg_p,
 
972
                    Item_transformer transformer, unsigned char *arg_t)
 
973
{
 
974
  if ((this->*analyzer) (arg_p))
 
975
    return ((this->*transformer) (arg_t));
 
976
  return 0;
 
977
}
 
978
 
 
979
 
 
980
void Item::traverse_cond(Cond_traverser traverser, void *arg, traverse_order)
 
981
{
 
982
  (*traverser)(this, arg);
 
983
}
 
984
 
 
985
 
 
986
bool Item::remove_dependence_processor(unsigned char *)
 
987
{
 
988
  return 0;
 
989
}
 
990
 
 
991
 
 
992
bool Item::remove_fixed(unsigned char *)
 
993
{
 
994
  fixed= 0;
 
995
  return 0;
 
996
}
 
997
 
 
998
 
 
999
bool Item::collect_item_field_processor(unsigned char *)
 
1000
{
 
1001
  return 0;
 
1002
}
 
1003
 
 
1004
 
 
1005
bool Item::find_item_in_field_list_processor(unsigned char *)
 
1006
{
 
1007
  return 0;
 
1008
}
 
1009
 
 
1010
 
 
1011
bool Item::change_context_processor(unsigned char *)
 
1012
{
 
1013
  return 0;
 
1014
}
 
1015
 
 
1016
bool Item::reset_query_id_processor(unsigned char *)
 
1017
{
 
1018
  return 0;
 
1019
}
 
1020
 
 
1021
 
 
1022
bool Item::register_field_in_read_map(unsigned char *)
 
1023
{
 
1024
  return 0;
 
1025
}
 
1026
 
 
1027
 
 
1028
bool Item::register_field_in_bitmap(unsigned char *)
 
1029
{
 
1030
  return 0;
 
1031
}
 
1032
 
 
1033
 
 
1034
bool Item::subst_argument_checker(unsigned char **arg)
 
1035
{
 
1036
  if (*arg)
 
1037
    *arg= NULL;
 
1038
  return true;
 
1039
}
 
1040
 
 
1041
 
 
1042
bool Item::check_vcol_func_processor(unsigned char *)
 
1043
{
 
1044
  return true;
 
1045
}
 
1046
 
 
1047
 
 
1048
Item *Item::equal_fields_propagator(unsigned char *)
 
1049
{
 
1050
  return this;
 
1051
}
 
1052
 
 
1053
 
 
1054
bool Item::set_no_const_sub(unsigned char *)
 
1055
{
 
1056
  return false;
 
1057
}
 
1058
 
 
1059
 
 
1060
Item *Item::replace_equal_field(unsigned char *)
 
1061
{
 
1062
  return this;
 
1063
}
 
1064
 
 
1065
 
 
1066
Item *Item::this_item(void)
 
1067
{
 
1068
  return this;
 
1069
}
 
1070
 
 
1071
 
 
1072
const Item *Item::this_item(void) const
 
1073
{
 
1074
  return this;
 
1075
}
 
1076
 
 
1077
 
 
1078
Item **Item::this_item_addr(Session *, Item **addr_arg)
 
1079
{
 
1080
  return addr_arg;
 
1081
}
 
1082
 
 
1083
 
 
1084
uint32_t Item::cols()
 
1085
{
 
1086
  return 1;
 
1087
}
 
1088
 
 
1089
 
 
1090
Item* Item::element_index(uint32_t)
 
1091
{
 
1092
  return this;
 
1093
}
 
1094
 
 
1095
 
 
1096
Item** Item::addr(uint32_t)
 
1097
{
 
1098
  return 0;
 
1099
}
 
1100
 
 
1101
 
 
1102
bool Item::null_inside()
 
1103
{
 
1104
  return 0;
 
1105
}
 
1106
 
 
1107
 
 
1108
void Item::bring_value()
 
1109
{}
 
1110
 
 
1111
 
 
1112
Item_field *Item::filed_for_view_update()
 
1113
{
 
1114
  return 0;
 
1115
}
 
1116
 
 
1117
Item *Item::neg_transformer(Session *)
 
1118
{
 
1119
  return NULL;
 
1120
}
 
1121
 
 
1122
 
 
1123
Item *Item::update_value_transformer(unsigned char *)
 
1124
{
 
1125
  return this;
 
1126
}
 
1127
 
 
1128
 
 
1129
void Item::delete_self()
 
1130
{
 
1131
  cleanup();
 
1132
  delete this;
 
1133
}
 
1134
 
 
1135
bool Item::result_as_int64_t()
 
1136
{
 
1137
  return false;
 
1138
}
 
1139
 
 
1140
 
 
1141
bool Item::is_expensive()
 
1142
{
 
1143
  if (is_expensive_cache < 0)
 
1144
    is_expensive_cache= walk(&Item::is_expensive_processor, 0,
 
1145
                             (unsigned char*)0);
 
1146
  return test(is_expensive_cache);
 
1147
}
 
1148
 
854
1149
 
855
1150
int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
856
1151
{
901
1196
                               SUM items
902
1197
 
903
1198
  @note
904
 
    This is from split_sum_func2() for items that should be split
 
1199
    This is from split_sum_func() for items that should be split
905
1200
 
906
1201
    All found SUM items are added FIRST in the fields list and
907
1202
    we replace the item with a reference.
909
1204
    session->fatal_error() may be called if we are out of memory
910
1205
*/
911
1206
 
912
 
void Item::split_sum_func2(Session *session, Item **ref_pointer_array,
913
 
                           List<Item> &fields, Item **ref, 
914
 
                           bool skip_registered)
 
1207
void Item::split_sum_func(Session *session, Item **ref_pointer_array,
 
1208
                          List<Item> &fields, Item **ref,
 
1209
                          bool skip_registered)
915
1210
{
916
 
  /* An item of type Item_sum  is registered <=> ref_by != 0 */ 
917
 
  if (type() == SUM_FUNC_ITEM && skip_registered && 
 
1211
  /* An item of type Item_sum  is registered <=> ref_by != 0 */
 
1212
  if (type() == SUM_FUNC_ITEM && skip_registered &&
918
1213
      ((Item_sum *) this)->ref_by)
919
 
    return;                                                 
 
1214
    return;
920
1215
  if ((type() != SUM_FUNC_ITEM && with_sum_func) ||
921
1216
      (type() == FUNC_ITEM &&
922
1217
       (((Item_func *) this)->functype() == Item_func::ISNOTNULLTEST_FUNC ||