~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Eric Herman
  • Date: 2008-12-06 19:42:46 UTC
  • mto: (656.1.6 devel)
  • mto: This revision was merged to the branch mainline in revision 665.
  • Revision ID: eric@mysql.com-20081206194246-5cdexuu81i366eek
removed trailing whitespace with simple script:

for file in $(find . -name "*.c") $(find . -name "*.cc") $(find . -name "*.h"); do ruby -pe 'gsub(/\s+$/, $/)' < $file > $file.out; mv $file.out $file; done;

Show diffs side-by-side

added added

removed removed

Lines of Context:
484
484
 
485
485
static sys_var_const_str_ptr    sys_repl_report_host(&vars, "report_host", &report_host);
486
486
 
487
 
sys_var_session_bool  sys_keep_files_on_create(&vars, "keep_files_on_create", 
 
487
sys_var_session_bool  sys_keep_files_on_create(&vars, "keep_files_on_create",
488
488
                                           &SV::keep_files_on_create);
489
489
/* Read only variables */
490
490
 
603
603
static void fix_low_priority_updates(Session *session, enum_var_type type)
604
604
{
605
605
  if (type == OPT_GLOBAL)
606
 
    thr_upgraded_concurrent_insert_lock= 
 
606
    thr_upgraded_concurrent_insert_lock=
607
607
      (global_system_variables.low_priority_updates ?
608
608
       TL_WRITE_LOW_PRIORITY : TL_WRITE);
609
609
  else
985
985
}
986
986
 
987
987
/*
988
 
  32 bit types for session variables 
 
988
  32 bit types for session variables
989
989
*/
990
990
bool sys_var_session_uint32_t::check(Session *session, set_var *var)
991
991
{
996
996
bool sys_var_session_uint32_t::update(Session *session, set_var *var)
997
997
{
998
998
  uint64_t tmp= var->save_result.uint64_t_value;
999
 
  
 
999
 
1000
1000
  /* Don't use bigger value than given with --maximum-variable-name=.. */
1001
1001
  if ((uint32_t) tmp > max_system_variables.*offset)
1002
1002
  {
1003
1003
    throw_bounds_warning(session, true, true, name, (int64_t) tmp);
1004
1004
    tmp= max_system_variables.*offset;
1005
1005
  }
1006
 
  
 
1006
 
1007
1007
  if (option_limits)
1008
1008
    tmp= (uint32_t) fix_unsigned(session, tmp, option_limits);
1009
1009
  else if (tmp > UINT32_MAX)
1011
1011
    tmp= UINT32_MAX;
1012
1012
    throw_bounds_warning(session, true, true, name, (int64_t) var->save_result.uint64_t_value);
1013
1013
  }
1014
 
  
 
1014
 
1015
1015
  if (var->type == OPT_GLOBAL)
1016
1016
     global_system_variables.*offset= (uint32_t) tmp;
1017
1017
   else
1059
1059
  if (var->type == OPT_GLOBAL)
1060
1060
  {
1061
1061
    /* Lock is needed to make things safe on 32 bit systems */
1062
 
    pthread_mutex_lock(&LOCK_global_system_variables);    
 
1062
    pthread_mutex_lock(&LOCK_global_system_variables);
1063
1063
    global_system_variables.*offset= (ha_rows) tmp;
1064
1064
    pthread_mutex_unlock(&LOCK_global_system_variables);
1065
1065
  }
1546
1546
    my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
1547
1547
    return 1;
1548
1548
  }
1549
 
  
 
1549
 
1550
1550
  /*
1551
1551
    We must copy result to thread space to not get a memory leak if
1552
1552
    update is aborted
1766
1766
 
1767
1767
  pthread_mutex_lock(&LOCK_global_system_variables);
1768
1768
  key_cache= get_key_cache(base_name);
1769
 
                            
 
1769
 
1770
1770
  if (!key_cache)
1771
1771
  {
1772
1772
    /* Key cache didn't exists */
1803
1803
        Move tables using this key cache to the default key cache
1804
1804
        and clear the old key cache.
1805
1805
      */
1806
 
      NAMED_LIST *list; 
 
1806
      NAMED_LIST *list;
1807
1807
      key_cache= (KEY_CACHE *) find_named(&key_caches, base_name->str,
1808
1808
                                              base_name->length, &list);
1809
1809
      key_cache->in_init= 1;
1832
1832
    error= (bool)(ha_resize_key_cache(key_cache));
1833
1833
 
1834
1834
  pthread_mutex_lock(&LOCK_global_system_variables);
1835
 
  key_cache->in_init= 0;  
 
1835
  key_cache->in_init= 0;
1836
1836
 
1837
1837
end:
1838
1838
  pthread_mutex_unlock(&LOCK_global_system_variables);
2139
2139
  }
2140
2140
  else // STRING_RESULT
2141
2141
  {
2142
 
    char buff[6]; 
 
2142
    char buff[6];
2143
2143
    String str(buff, sizeof(buff), &my_charset_utf8_general_ci), *res;
2144
2144
    if (!(res=var->value->val_str(&str)))
2145
2145
    {
2312
2312
 
2313
2313
static unsigned char *get_error_count(Session *session)
2314
2314
{
2315
 
  session->sys_var_tmp.long_value= 
 
2315
  session->sys_var_tmp.long_value=
2316
2316
    session->warn_count[(uint32_t) DRIZZLE_ERROR::WARN_LEVEL_ERROR];
2317
2317
  return (unsigned char*) &session->sys_var_tmp.long_value;
2318
2318
}
2359
2359
    ptr         pointer to option structure
2360
2360
*/
2361
2361
 
2362
 
static struct my_option *find_option(struct my_option *opt, const char *name) 
 
2362
static struct my_option *find_option(struct my_option *opt, const char *name)
2363
2363
{
2364
2364
  uint32_t length=strlen(name);
2365
2365
  for (; opt->name; opt++)
2392
2392
 
2393
2393
/*
2394
2394
  Add variables to the dynamic hash of system variables
2395
 
  
 
2395
 
2396
2396
  SYNOPSIS
2397
2397
    mysql_add_sys_var_chain()
2398
2398
    first       Pointer to first system variable to add
2399
2399
    long_opt    (optional)command line arguments may be tied for limit checks.
2400
 
  
 
2400
 
2401
2401
  RETURN VALUES
2402
2402
    0           SUCCESS
2403
2403
    otherwise   FAILURE
2407
2407
int mysql_add_sys_var_chain(sys_var *first, struct my_option *long_options)
2408
2408
{
2409
2409
  sys_var *var;
2410
 
  
 
2410
 
2411
2411
  /* A write lock should be held on LOCK_system_variables_hash */
2412
 
  
 
2412
 
2413
2413
  for (var= first; var; var= var->next)
2414
2414
  {
2415
2415
    var->name_length= strlen(var->name);
2426
2426
    hash_delete(&system_variable_hash, (unsigned char*) first);
2427
2427
  return 1;
2428
2428
}
2429
 
 
2430
 
 
 
2429
 
 
2430
 
2431
2431
/*
2432
2432
  Remove variables to the dynamic hash of system variables
2433
 
   
 
2433
 
2434
2434
  SYNOPSIS
2435
2435
    mysql_del_sys_var_chain()
2436
2436
    first       Pointer to first system variable to remove
2437
 
   
 
2437
 
2438
2438
  RETURN VALUES
2439
2439
    0           SUCCESS
2440
2440
    otherwise   FAILURE
2441
2441
*/
2442
 
 
 
2442
 
2443
2443
int mysql_del_sys_var_chain(sys_var *first)
2444
2444
{
2445
2445
  int result= 0;
2446
 
 
 
2446
 
2447
2447
  /* A write lock should be held on LOCK_system_variables_hash */
2448
 
   
 
2448
 
2449
2449
  for (sys_var *var= first; var; var= var->next)
2450
2450
    result|= hash_delete(&system_variable_hash, (unsigned char*) var);
2451
2451
 
2452
2452
  return result;
2453
2453
}
2454
 
 
2455
 
 
 
2454
 
 
2455
 
2456
2456
static int show_cmp(SHOW_VAR *a, SHOW_VAR *b)
2457
2457
{
2458
2458
  return strcmp(a->name, b->name);
2459
2459
}
2460
 
 
2461
 
 
 
2460
 
 
2461
 
2462
2462
/*
2463
2463
  Constructs an array of system variables for display to the user.
2464
 
  
 
2464
 
2465
2465
  SYNOPSIS
2466
2466
    enumerate_sys_vars()
2467
2467
    session         current thread
2468
2468
    sorted      If TRUE, the system variables should be sorted
2469
 
  
 
2469
 
2470
2470
  RETURN VALUES
2471
2471
    pointer     Array of SHOW_VAR elements for display
2472
2472
    NULL        FAILURE
2497
2497
    if (sorted)
2498
2498
      my_qsort(result, count + fixed_count, sizeof(SHOW_VAR),
2499
2499
               (qsort_cmp) show_cmp);
2500
 
    
 
2500
 
2501
2501
    /* make last element empty */
2502
2502
    memset(show, 0, sizeof(SHOW_VAR));
2503
2503
  }
2507
2507
 
2508
2508
/*
2509
2509
  Initialize the system variables
2510
 
  
 
2510
 
2511
2511
  SYNOPSIS
2512
2512
    set_var_init()
2513
 
  
 
2513
 
2514
2514
  RETURN VALUES
2515
2515
    0           SUCCESS
2516
2516
    otherwise   FAILURE
2519
2519
int set_var_init()
2520
2520
{
2521
2521
  uint32_t count= 0;
2522
 
  
 
2522
 
2523
2523
  for (sys_var *var=vars.first; var; var= var->next, count++) {};
2524
2524
 
2525
2525
  if (my_init_dynamic_array(&fixed_show_vars, sizeof(SHOW_VAR),
2554
2554
 
2555
2555
/*
2556
2556
  Add elements to the dynamic list of read-only system variables.
2557
 
  
 
2557
 
2558
2558
  SYNOPSIS
2559
2559
    mysql_append_static_vars()
2560
2560
    show_vars   Pointer to start of array
2561
2561
    count       Number of elements
2562
 
  
 
2562
 
2563
2563
  RETURN VALUES
2564
2564
    0           SUCCESS
2565
2565
    otherwise   FAILURE
2946
2946
static KEY_CACHE *create_key_cache(const char *name, uint32_t length)
2947
2947
{
2948
2948
  KEY_CACHE *key_cache;
2949
 
  
 
2949
 
2950
2950
  if ((key_cache= (KEY_CACHE*) malloc(sizeof(KEY_CACHE))))
2951
2951
  {
2952
2952
    memset(key_cache, 0, sizeof(KEY_CACHE));