~ubuntu-branches/ubuntu/karmic/mysql-dfsg-5.1/karmic

« back to all changes in this revision

Viewing changes to sql/item_func.h

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2009-02-10 16:42:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090210164205-ej41ocvm4z1s14nq
Tags: 5.1.31-1ubuntu1
* Merge from debian experimental, remaining changes: 
  - debian/mysql-server-5.1.config: ask for MySQL root password at priority
    high instead of medium so that the password prompt is seen on a default
    install. (LP: #319843)
  - debian/control: 
    + Don't build mysql-server, mysql-client, mysql-common and 
      libmysqlclient15-dev binary packages since they're still provided 
      by mysql-dfsg-5.0.
    + Rename libmysqlclient-dev package to libmysqlclient16-dev (LP: #316280).
      Make it conflict with libmysqlclient15-dev.
    + Make mysql-{client,server}-5.1 packages conflict and
      replace mysql-{client,server}-5.0, but not provide 
      mysql-{client,server}.
    + Depend on a specific version of mysql-common rather than the src 
      version of mysql-dfsg-5.1 since mysql-common is currently part of
      mysql-dfsg-5.0.
  - debian/rules: added -fno-strict-aliasing to CFLAGS to get
    around mysql testsuite build failures.
* debian/patches/92_ssl_test_cert.dpatch: certificate expiration in 
  test suite (LP: #323755).
* Dropped changes:
  - all of the changes made to support both 5.0 and 5.1 installed at the
    same time have been dropped now that amarok doesn't depend on
    mysql-server-5.1 anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
                  NOW_FUNC, TRIG_COND_FUNC,
56
56
                  SUSERVAR_FUNC, GUSERVAR_FUNC, COLLATE_FUNC,
57
57
                  EXTRACT_FUNC, CHAR_TYPECAST_FUNC, FUNC_SP, UDF_FUNC,
58
 
                  NEG_FUNC };
 
58
                  NEG_FUNC, GSYSVAR_FUNC };
59
59
  enum optimize_type { OPTIMIZE_NONE,OPTIMIZE_KEY,OPTIMIZE_OP, OPTIMIZE_NULL,
60
60
                       OPTIMIZE_EQUAL };
61
61
  enum Type type() const { return FUNC_ITEM; }
362
362
  Item_func_unsigned(Item *a) :Item_func_signed(a) {}
363
363
  const char *func_name() const { return "cast_as_unsigned"; }
364
364
  void fix_length_and_dec()
365
 
  { max_length=args[0]->max_length; unsigned_flag=1; }
 
365
  {
 
366
    max_length= min(args[0]->max_length, DECIMAL_MAX_PRECISION + 2);
 
367
    unsigned_flag=1;
 
368
  }
366
369
  longlong val_int();
367
370
  virtual void print(String *str, enum_query_type query_type);
368
371
};
1295
1298
  enum Item_result cached_result_type;
1296
1299
  user_var_entry *entry;
1297
1300
  /*
1298
 
    The entry_thd variable is used:
 
1301
    The entry_thread_id variable is used:
1299
1302
    1) to skip unnecessary updates of the entry field (see above);
1300
1303
    2) to reset the entry field that was initialized in the other thread
1301
1304
       (for example, an item tree of a trigger that updates user variables
1302
 
       may be shared between several connections, and the entry_thd field
 
1305
       may be shared between several connections, and the entry_thread_id field
1303
1306
       prevents updates of one connection user variables from a concurrent
1304
1307
       connection calling the same trigger that initially updated some
1305
1308
       user variable it the first connection context).
1306
1309
  */
1307
 
  THD *entry_thd;
 
1310
  my_thread_id entry_thread_id;
1308
1311
  char buffer[MAX_FIELD_WIDTH];
1309
1312
  String value;
1310
1313
  my_decimal decimal_buff;
1321
1324
  LEX_STRING name; // keep it public
1322
1325
  Item_func_set_user_var(LEX_STRING a,Item *b)
1323
1326
    :Item_func(b), cached_result_type(INT_RESULT),
1324
 
     entry(NULL), entry_thd(NULL), name(a)
 
1327
     entry(NULL), entry_thread_id(0), name(a)
1325
1328
  {}
1326
1329
  enum Functype functype() const { return SUSERVAR_FUNC; }
1327
1330
  double val_real();
1426
1429
 
1427
1430
/* A system variable */
1428
1431
 
 
1432
#define GET_SYS_VAR_CACHE_LONG     1
 
1433
#define GET_SYS_VAR_CACHE_DOUBLE   2
 
1434
#define GET_SYS_VAR_CACHE_STRING   4
 
1435
 
1429
1436
class Item_func_get_system_var :public Item_func
1430
1437
{
1431
1438
  sys_var *var;
1432
 
  enum_var_type var_type;
 
1439
  enum_var_type var_type, orig_var_type;
1433
1440
  LEX_STRING component;
 
1441
  longlong cached_llval;
 
1442
  double cached_dval;
 
1443
  String cached_strval;
 
1444
  my_bool cached_null_value;
 
1445
  query_id_t used_query_id;
 
1446
  uchar cache_present;
 
1447
 
1434
1448
public:
1435
1449
  Item_func_get_system_var(sys_var *var_arg, enum_var_type var_type_arg,
1436
1450
                           LEX_STRING *component_arg, const char *name_arg,
1437
1451
                           size_t name_len_arg);
1438
 
  bool fix_fields(THD *thd, Item **ref);
1439
 
  /*
1440
 
    Stubs for pure virtual methods. Should never be called: this
1441
 
    item is always substituted with a constant in fix_fields().
1442
 
  */
1443
 
  double val_real()         { DBUG_ASSERT(0); return 0.0; }
1444
 
  longlong val_int()        { DBUG_ASSERT(0); return 0; }
1445
 
  String* val_str(String*)  { DBUG_ASSERT(0); return 0; }
1446
 
  void fix_length_and_dec() { DBUG_ASSERT(0); }
 
1452
  enum Functype functype() const { return GSYSVAR_FUNC; }
 
1453
  void fix_length_and_dec();
 
1454
  void print(String *str, enum_query_type query_type);
 
1455
  bool const_item() const { return true; }
 
1456
  table_map used_tables() const { return 0; }
 
1457
  enum Item_result result_type() const;
 
1458
  enum_field_types field_type() const;
 
1459
  double val_real();
 
1460
  longlong val_int();
 
1461
  String* val_str(String*);
1447
1462
  /* TODO: fix to support views */
1448
1463
  const char *func_name() const { return "get_system_var"; }
1449
1464
  /**
1455
1470
    @return true if the variable is written to the binlog, false otherwise.
1456
1471
  */
1457
1472
  bool is_written_to_binlog();
 
1473
  bool eq(const Item *item, bool binary_cmp) const;
 
1474
 
 
1475
  void cleanup();
1458
1476
};
1459
1477
 
1460
1478