1
/* Copyright (C) 2000-2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
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 */
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
21
/* compare and test functions */
230
234
bool result_for_null_param;
232
236
Item_in_optimizer(Item *a, Item_in_subselect *b):
233
Item_bool_func(a, my_reinterpret_cast(Item *)(b)), cache(0),
237
Item_bool_func(a, reinterpret_cast<Item *>(b)), cache(0),
234
238
save_cache(0), result_for_null_param(UNKNOWN)
235
239
{ with_subselect= true; }
236
240
bool fix_fields(THD *, Item **);
241
245
const char *func_name() const { return "<in_optimizer>"; }
242
246
Item_cache **get_cache() { return &cache; }
243
247
void keep_top_level_cache();
244
Item *transform(Item_transformer transformer, uchar *arg);
248
Item *transform(Item_transformer transformer, unsigned char *arg);
247
251
class Comp_creator
758
762
count(elements), used_count(elements) {}
759
763
virtual ~in_vector() {}
760
764
virtual void set(uint pos,Item *item)=0;
761
virtual uchar *get_value(Item *item)=0;
765
virtual unsigned char *get_value(Item *item)=0;
764
768
my_qsort2(base,used_count,size,compare, (void *) collation);
802
806
in_string(uint elements,qsort2_cmp cmp_func, const CHARSET_INFO * const cs);
804
808
void set(uint pos,Item *item);
805
uchar *get_value(Item *item);
809
unsigned char *get_value(Item *item);
806
810
Item* create_item()
808
812
return new Item_string(collation);
833
837
in_int64_t(uint elements);
834
838
void set(uint pos,Item *item);
835
uchar *get_value(Item *item);
839
unsigned char *get_value(Item *item);
837
841
Item* create_item()
873
877
:in_int64_t(elements), thd(current_thd), warn_item(warn_item_arg),
874
878
lval_cache(0) {};
875
879
void set(uint pos,Item *item);
876
uchar *get_value(Item *item);
880
unsigned char *get_value(Item *item);
877
881
friend int cmp_int64_t(void *cmp_arg, packed_int64_t *a,packed_int64_t *b);
885
889
in_double(uint elements);
886
890
void set(uint pos,Item *item);
887
uchar *get_value(Item *item);
891
unsigned char *get_value(Item *item);
888
892
Item *create_item()
890
894
return new Item_float(0.0, 0);
904
908
in_decimal(uint elements);
905
909
void set(uint pos, Item *item);
906
uchar *get_value(Item *item);
910
unsigned char *get_value(Item *item);
907
911
Item *create_item()
909
913
return new Item_decimal(0, false);
1260
1264
in_row(uint elements, Item *);
1262
1266
void set(uint pos,Item *item);
1263
uchar *get_value(Item *item);
1267
unsigned char *get_value(Item *item);
1264
1268
friend void Item_func_in::fix_length_and_dec();
1265
1269
Item_result result_type() { return ROW_RESULT; }
1433
1437
void top_level_item() { abort_on_null=1; }
1434
1438
void copy_andor_arguments(THD *thd, Item_cond *item);
1435
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
1436
Item *transform(Item_transformer transformer, uchar *arg);
1439
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
1440
Item *transform(Item_transformer transformer, unsigned char *arg);
1437
1441
void traverse_cond(Cond_traverser, void *arg, traverse_order order);
1438
1442
void neg_arguments(THD *thd);
1439
1443
enum_field_types field_type() const { return DRIZZLE_TYPE_LONGLONG; }
1440
bool subst_argument_checker(uchar **arg __attribute__((unused)))
1444
bool subst_argument_checker(unsigned char **arg __attribute__((unused)))
1441
1445
{ return true; }
1442
Item *compile(Item_analyzer analyzer, uchar **arg_p,
1443
Item_transformer transformer, uchar *arg_t);
1446
Item *compile(Item_analyzer analyzer, unsigned char **arg_p,
1447
Item_transformer transformer, unsigned char *arg_t);
1549
1553
void fix_length_and_dec();
1550
1554
bool fix_fields(THD *thd, Item **ref);
1551
1555
void update_used_tables();
1552
bool walk(Item_processor processor, bool walk_subquery, uchar *arg);
1553
Item *transform(Item_transformer transformer, uchar *arg);
1556
bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
1557
Item *transform(Item_transformer transformer, unsigned char *arg);
1554
1558
virtual void print(String *str, enum_query_type query_type);
1555
1559
const CHARSET_INFO *compare_collation()
1556
1560
{ return fields.head()->collation.collation; }