~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/item_cmpfunc.cc

  • Committer: Patrick Galbraith
  • Date: 2008-07-27 19:30:42 UTC
  • mto: (212.1.4 codestyle)
  • mto: This revision was merged to the branch mainline in revision 217.
  • Revision ID: patg@ishvara-20080727193042-iie3dyo65v0grevw
Renamed all MYSQL_TYPE... to FIELD_TYPE...

It took less time than I thought.

All tests pass.

Show diffs side-by-side

added added

removed removed

Lines of Context:
757
757
      uint64_t value;
758
758
      bool error;
759
759
      String tmp, *str_val= 0;
760
 
      timestamp_type t_type= (date_arg->field_type() == MYSQL_TYPE_NEWDATE ?
 
760
      timestamp_type t_type= (date_arg->field_type() == FIELD_TYPE_NEWDATE ?
761
761
                              MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME);
762
762
 
763
763
      str_val= str_arg->val_str(&tmp);
878
878
    get_value_func= &get_datetime_value;
879
879
    return 0;
880
880
  }
881
 
  else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
882
 
           (*b)->field_type() == MYSQL_TYPE_TIME)
 
881
  else if (type == STRING_RESULT && (*a)->field_type() == FIELD_TYPE_TIME &&
 
882
           (*b)->field_type() == FIELD_TYPE_TIME)
883
883
  {
884
884
    /* Compare TIME values as integers. */
885
885
    thd= current_thd;
956
956
    *is_null= item->null_value;
957
957
    enum_field_types f_type= item->field_type();
958
958
    /*
959
 
      Item_date_add_interval may return MYSQL_TYPE_STRING as the result
 
959
      Item_date_add_interval may return FIELD_TYPE_STRING as the result
960
960
      field type. To detect that the DATE value has been returned we
961
961
      compare it with 100000000L - any DATE value should be less than it.
962
962
      Don't shift cached DATETIME values up for the second time.
963
963
    */
964
 
    if (f_type == MYSQL_TYPE_NEWDATE ||
965
 
        (f_type != MYSQL_TYPE_DATETIME && value < 100000000L))
 
964
    if (f_type == FIELD_TYPE_NEWDATE ||
 
965
        (f_type != FIELD_TYPE_DATETIME && value < 100000000L))
966
966
      value*= 1000000L;
967
967
  }
968
968
  else
983
983
    bool error;
984
984
    enum_field_types f_type= warn_item->field_type();
985
985
    timestamp_type t_type= f_type ==
986
 
      MYSQL_TYPE_NEWDATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME;
 
986
      FIELD_TYPE_NEWDATE ? MYSQL_TIMESTAMP_DATE : MYSQL_TIMESTAMP_DATETIME;
987
987
    value= get_date_from_str(thd, str, t_type, warn_item->name, &error);
988
988
    /*
989
989
      If str did not contain a valid date according to the current
999
999
  if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM ||
1000
1000
      ((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
1001
1001
  {
1002
 
    Item_cache_int *cache= new Item_cache_int(MYSQL_TYPE_DATETIME);
 
1002
    Item_cache_int *cache= new Item_cache_int(FIELD_TYPE_DATETIME);
1003
1003
    /* Mark the cache as non-const to prevent re-caching. */
1004
1004
    cache->set_used_tables(1);
1005
1005
    cache->store(item, value);
2020
2020
        datetime_found= true;
2021
2021
        continue;
2022
2022
      }
2023
 
      if (args[i]->field_type() == MYSQL_TYPE_TIME &&
 
2023
      if (args[i]->field_type() == FIELD_TYPE_TIME &&
2024
2024
          args[i]->result_as_int64_t())
2025
2025
        time_items_found++;
2026
2026
    }
3625
3625
            */
3626
3626
            if (!date_arg)
3627
3627
              date_arg= itm;
3628
 
            else if (itm->field_type() == MYSQL_TYPE_DATETIME)
 
3628
            else if (itm->field_type() == FIELD_TYPE_DATETIME)
3629
3629
            {
3630
3630
              date_arg= itm;
3631
3631
              /* All arguments are already checked to have the STRING result. */