~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to server/sql_plugin.cc

  • Committer: Brian Aker
  • Date: 2008-07-13 22:45:08 UTC
  • Revision ID: brian@tangent.org-20080713224508-hb20z4okblotb39a
longlong replacement

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
/* declared in set_var.cc */
209
209
extern sys_var *intern_find_sys_var(const char *str, uint length, bool no_error);
210
210
extern bool throw_bounds_warning(THD *thd, bool fixed, bool unsignd,
211
 
                                 const char *name, longlong val);
 
211
                                 const char *name, int64_t val);
212
212
 
213
213
/****************************************************************************
214
214
  Value type thunks, allows the C world to play in the C++ world
1415
1415
 
1416
1416
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_int_t, int);
1417
1417
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_long_t, long);
1418
 
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_longlong_t, longlong);
 
1418
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_int64_t_t, int64_t);
1419
1419
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_uint_t, uint);
1420
1420
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_ulong_t, ulong);
1421
1421
typedef DECLARE_MYSQL_SYSVAR_SIMPLE(sysvar_uint64_t_t, uint64_t);
1422
1422
 
1423
1423
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int_t, int);
1424
1424
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_long_t, long);
1425
 
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_longlong_t, longlong);
 
1425
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_int64_t_t, int64_t);
1426
1426
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint_t, uint);
1427
1427
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_ulong_t, ulong);
1428
1428
typedef DECLARE_MYSQL_THDVAR_SIMPLE(thdvar_uint64_t_t, uint64_t);
1492
1492
    *(int *)save= (int) getopt_ll_limit_value(tmp, &options, &fixed);
1493
1493
 
1494
1494
  return throw_bounds_warning(thd, fixed, var->flags & PLUGIN_VAR_UNSIGNED,
1495
 
                              var->name, (longlong) tmp);
 
1495
                              var->name, (int64_t) tmp);
1496
1496
}
1497
1497
 
1498
1498
 
1512
1512
    *(long *)save= (long) getopt_ll_limit_value(tmp, &options, &fixed);
1513
1513
 
1514
1514
  return throw_bounds_warning(thd, fixed, var->flags & PLUGIN_VAR_UNSIGNED,
1515
 
                              var->name, (longlong) tmp);
 
1515
                              var->name, (int64_t) tmp);
1516
1516
}
1517
1517
 
1518
1518
 
1519
 
static int check_func_longlong(THD *thd, struct st_mysql_sys_var *var,
 
1519
static int check_func_int64_t(THD *thd, struct st_mysql_sys_var *var,
1520
1520
                               void *save, st_mysql_value *value)
1521
1521
{
1522
1522
  bool fixed;
1529
1529
    *(uint64_t *)save= getopt_ull_limit_value((uint64_t) tmp, &options,
1530
1530
                                               &fixed);
1531
1531
  else
1532
 
    *(longlong *)save= getopt_ll_limit_value(tmp, &options, &fixed);
 
1532
    *(int64_t *)save= getopt_ll_limit_value(tmp, &options, &fixed);
1533
1533
 
1534
1534
  return throw_bounds_warning(thd, fixed, var->flags & PLUGIN_VAR_UNSIGNED,
1535
 
                              var->name, (longlong) tmp);
 
1535
                              var->name, (int64_t) tmp);
1536
1536
}
1537
1537
 
1538
1538
static int check_func_str(THD *thd,
1673
1673
}
1674
1674
 
1675
1675
 
1676
 
static void update_func_longlong(THD *thd __attribute__((__unused__)),
 
1676
static void update_func_int64_t(THD *thd __attribute__((__unused__)),
1677
1677
                                 struct st_mysql_sys_var *var __attribute__((__unused__)),
1678
1678
                                 void *tgt, const void *save)
1679
1679
{
1680
 
  *(longlong *)tgt= *(uint64_t *) save;
 
1680
  *(int64_t *)tgt= *(uint64_t *) save;
1681
1681
}
1682
1682
 
1683
1683
 
2344
2344
    OPTION_SET_LIMITS(GET_ULONG, options, (sysvar_ulong_t*) opt);
2345
2345
    break;
2346
2346
  case PLUGIN_VAR_LONGLONG:
2347
 
    OPTION_SET_LIMITS(GET_LL, options, (sysvar_longlong_t*) opt);
 
2347
    OPTION_SET_LIMITS(GET_LL, options, (sysvar_int64_t_t*) opt);
2348
2348
    break;
2349
2349
  case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED:
2350
2350
    OPTION_SET_LIMITS(GET_ULL, options, (sysvar_uint64_t_t*) opt);
2386
2386
    OPTION_SET_LIMITS(GET_ULONG, options, (thdvar_ulong_t*) opt);
2387
2387
    break;
2388
2388
  case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_THDLOCAL:
2389
 
    OPTION_SET_LIMITS(GET_LL, options, (thdvar_longlong_t*) opt);
 
2389
    OPTION_SET_LIMITS(GET_LL, options, (thdvar_int64_t_t*) opt);
2390
2390
    break;
2391
2391
  case PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | PLUGIN_VAR_THDLOCAL:
2392
2392
    OPTION_SET_LIMITS(GET_ULL, options, (thdvar_uint64_t_t*) opt);
2502
2502
      SET_PLUGIN_VAR_RESOLVE((thdvar_long_t *) opt);
2503
2503
      break;
2504
2504
    case PLUGIN_VAR_LONGLONG:
2505
 
      SET_PLUGIN_VAR_RESOLVE((thdvar_longlong_t *) opt);
 
2505
      SET_PLUGIN_VAR_RESOLVE((thdvar_int64_t_t *) opt);
2506
2506
      break;
2507
2507
    case PLUGIN_VAR_STR:
2508
2508
      SET_PLUGIN_VAR_RESOLVE((thdvar_str_t *) opt);
2544
2544
      break;
2545
2545
    case PLUGIN_VAR_LONGLONG:
2546
2546
      if (!opt->check)
2547
 
        opt->check= check_func_longlong;
 
2547
        opt->check= check_func_int64_t;
2548
2548
      if (!opt->update)
2549
 
        opt->update= update_func_longlong;
 
2549
        opt->update= update_func_int64_t;
2550
2550
      break;
2551
2551
    case PLUGIN_VAR_STR:
2552
2552
      if (!opt->check)
2574
2574
      if (!opt->check)
2575
2575
        opt->check= check_func_set;
2576
2576
      if (!opt->update)
2577
 
        opt->update= update_func_longlong;
 
2577
        opt->update= update_func_int64_t;
2578
2578
      break;
2579
2579
    default:
2580
2580
      sql_print_error("Unknown variable type code 0x%x in plugin '%s'.",