~skinny.moey/drizzle/innodb-replication

« back to all changes in this revision

Viewing changes to drizzled/item/cmpfunc.cc

  • Committer: Brian Aker
  • Date: 2010-11-08 22:35:57 UTC
  • mfrom: (1802.1.114 trunk)
  • Revision ID: brian@tangent.org-20101108223557-w3xzwp9hjjtjhtc1
MergeĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
14
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
15
15
 
16
16
 
17
17
/**
764
764
*/
765
765
 
766
766
enum Arg_comparator::enum_date_cmp_type
767
 
Arg_comparator::can_compare_as_dates(Item *a, Item *b, uint64_t *const_value)
 
767
Arg_comparator::can_compare_as_dates(Item *in_a, Item *in_b,
 
768
                                     uint64_t *const_value)
768
769
{
769
770
  enum enum_date_cmp_type cmp_type= CMP_DATE_DFLT;
770
771
  Item *str_arg= 0, *date_arg= 0;
771
772
 
772
 
  if (a->type() == Item::ROW_ITEM || b->type() == Item::ROW_ITEM)
 
773
  if (in_a->type() == Item::ROW_ITEM || in_b->type() == Item::ROW_ITEM)
773
774
    return CMP_DATE_DFLT;
774
775
 
775
 
  if (a->is_datetime())
 
776
  if (in_a->is_datetime())
776
777
  {
777
 
    if (b->is_datetime())
 
778
    if (in_b->is_datetime())
778
779
      cmp_type= CMP_DATE_WITH_DATE;
779
 
    else if (b->result_type() == STRING_RESULT)
 
780
    else if (in_b->result_type() == STRING_RESULT)
780
781
    {
781
782
      cmp_type= CMP_DATE_WITH_STR;
782
 
      date_arg= a;
783
 
      str_arg= b;
 
783
      date_arg= in_a;
 
784
      str_arg= in_b;
784
785
    }
785
786
  }
786
 
  else if (b->is_datetime() && a->result_type() == STRING_RESULT)
 
787
  else if (in_b->is_datetime() && in_a->result_type() == STRING_RESULT)
787
788
  {
788
789
    cmp_type= CMP_STR_WITH_DATE;
789
 
    date_arg= b;
790
 
    str_arg= a;
 
790
    date_arg= in_b;
 
791
    str_arg= in_a;
791
792
  }
792
793
 
793
794
  if (cmp_type != CMP_DATE_DFLT)
2034
2035
    ge_cmp.set_datetime_cmp_func(args, args + 1);
2035
2036
    le_cmp.set_datetime_cmp_func(args, args + 2);
2036
2037
  }
2037
 
  else if (args[0]->real_item()->type() == FIELD_ITEM &&
2038
 
           session->lex->sql_command != SQLCOM_SHOW_CREATE)
 
2038
  else if (args[0]->real_item()->type() == FIELD_ITEM)
2039
2039
  {
2040
2040
    Item_field *field_item= (Item_field*) (args[0]->real_item());
2041
2041
    if (field_item->field->can_be_compared_as_int64_t())
3677
3677
        comparison type accordingly.
3678
3678
      */
3679
3679
      if (args[0]->real_item()->type() == FIELD_ITEM &&
3680
 
          session->lex->sql_command != SQLCOM_SHOW_CREATE &&
3681
3680
          cmp_type != INT_RESULT)
3682
3681
      {
3683
3682
        Item_field *field_item= (Item_field*) (args[0]->real_item());