~ubuntu-branches/ubuntu/lucid/mysql-dfsg-5.1/lucid-security

« back to all changes in this revision

Viewing changes to sql/item_func.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 22:33:55 UTC
  • mto: (1.2.1) (37.1.1 lucid-security)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: package-import@ubuntu.com-20120222223355-ku1tb4r70osci6v2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
 
1
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
2
2
 
3
3
   This program is free software; you can redistribute it and/or modify
4
4
   it under the terms of the GNU General Public License as published by
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
18
/* Function items used by mysql */
124
125
  virtual optimize_type select_optimize() const { return OPTIMIZE_NONE; }
125
126
  virtual bool have_rev_func() const { return 0; }
126
127
  virtual Item *key_item() const { return args[0]; }
127
 
  /*
128
 
    This method is used for debug purposes to print the name of an
129
 
    item to the debug log. The second use of this method is as
130
 
    a helper function of print(), where it is applicable.
131
 
    To suit both goals it should return a meaningful,
132
 
    distinguishable and sintactically correct string.  This method
133
 
    should not be used for runtime type identification, use enum
134
 
    {Sum}Functype and Item_func::functype()/Item_sum::sum_func()
135
 
    instead.
136
 
  */
137
 
  virtual const char *func_name() const= 0;
138
128
  virtual bool const_item() const { return const_item_cache; }
139
129
  inline Item **arguments() const { return args; }
140
130
  void set_arguments(List<Item> &list);
200
190
    null_value=1;
201
191
    return 0.0;
202
192
  }
 
193
 
 
194
  bool has_timestamp_args()
 
195
  {
 
196
    DBUG_ASSERT(fixed == TRUE);
 
197
    for (uint i= 0; i < arg_count; i++)
 
198
    {
 
199
      if (args[i]->type() == Item::FIELD_ITEM &&
 
200
          args[i]->field_type() == MYSQL_TYPE_TIMESTAMP)
 
201
        return TRUE;
 
202
    }
 
203
    return FALSE;
 
204
  }
 
205
 
 
206
  bool has_date_args()
 
207
  {
 
208
    DBUG_ASSERT(fixed == TRUE);
 
209
    for (uint i= 0; i < arg_count; i++)
 
210
    {
 
211
      if (args[i]->type() == Item::FIELD_ITEM &&
 
212
          (args[i]->field_type() == MYSQL_TYPE_DATE ||
 
213
           args[i]->field_type() == MYSQL_TYPE_DATETIME))
 
214
        return TRUE;
 
215
    }
 
216
    return FALSE;
 
217
  }
 
218
 
 
219
  bool has_time_args()
 
220
  {
 
221
    DBUG_ASSERT(fixed == TRUE);
 
222
    for (uint i= 0; i < arg_count; i++)
 
223
    {
 
224
      if (args[i]->type() == Item::FIELD_ITEM &&
 
225
          (args[i]->field_type() == MYSQL_TYPE_TIME ||
 
226
           args[i]->field_type() == MYSQL_TYPE_DATETIME))
 
227
        return TRUE;
 
228
    }
 
229
    return FALSE;
 
230
  }
 
231
 
 
232
  bool has_datetime_args()
 
233
  {
 
234
    DBUG_ASSERT(fixed == TRUE);
 
235
    for (uint i= 0; i < arg_count; i++)
 
236
    {
 
237
      if (args[i]->type() == Item::FIELD_ITEM &&
 
238
          args[i]->field_type() == MYSQL_TYPE_DATETIME)
 
239
        return TRUE;
 
240
    }
 
241
    return FALSE;
 
242
  }
 
243
 
 
244
  /*
 
245
    We assume the result of any function that has a TIMESTAMP argument to be
 
246
    timezone-dependent, since a TIMESTAMP value in both numeric and string
 
247
    contexts is interpreted according to the current timezone.
 
248
    The only exception is UNIX_TIMESTAMP() which returns the internal
 
249
    representation of a TIMESTAMP argument verbatim, and thus does not depend on
 
250
    the timezone.
 
251
   */
 
252
  virtual bool check_valid_arguments_processor(uchar *bool_arg)
 
253
  {
 
254
    return has_timestamp_args();
 
255
  }
 
256
 
 
257
  virtual bool find_function_processor (uchar *arg)
 
258
  {
 
259
    return functype() == *(Functype *) arg;
 
260
  }
203
261
};
204
262
 
205
263
 
1336
1394
  my_decimal *val_decimal(my_decimal *);
1337
1395
  double val_result();
1338
1396
  longlong val_int_result();
 
1397
  bool val_bool_result();
1339
1398
  String *str_result(String *str);
1340
1399
  my_decimal *val_decimal_result(my_decimal *);
1341
1400
  bool is_null_result();
1513
1572
       join_key(0), ft_handler(0), table(0), master(0), concat_ws(0) { }
1514
1573
  void cleanup()
1515
1574
  {
1516
 
    DBUG_ENTER("Item_func_match");
 
1575
    DBUG_ENTER("Item_func_match::cleanup");
1517
1576
    Item_real_func::cleanup();
1518
1577
    if (!master && ft_handler)
1519
1578
      ft_handler->please->close_search(ft_handler);