~posulliv/drizzle/optimizer-style-cleanup

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Padraig O'Sullivan
  • Date: 2010-03-15 14:05:26 UTC
  • mfrom: (1237.9.99 staging)
  • Revision ID: osullivan.padraig@gmail.com-20100315140526-opbgwdwn6tfecdkq
MergeĀ fromĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
129
129
 
130
130
static sys_var_session_uint64_t
131
131
sys_auto_increment_increment(&vars, "auto_increment_increment",
132
 
                             &SV::auto_increment_increment);
 
132
                             &system_variables::auto_increment_increment);
133
133
static sys_var_session_uint64_t
134
134
sys_auto_increment_offset(&vars, "auto_increment_offset",
135
 
                          &SV::auto_increment_offset);
 
135
                          &system_variables::auto_increment_offset);
136
136
 
137
137
static sys_var_const_str       sys_basedir(&vars, "basedir", drizzle_home);
138
138
static sys_var_session_uint64_t sys_bulk_insert_buff_size(&vars, "bulk_insert_buffer_size",
139
 
                                                          &SV::bulk_insert_buff_size);
 
139
                                                          &system_variables::bulk_insert_buff_size);
140
140
static sys_var_session_uint32_t sys_completion_type(&vars, "completion_type",
141
 
                                                    &SV::completion_type,
 
141
                                                    &system_variables::completion_type,
142
142
                                                    check_completion_type,
143
143
                                                    fix_completion_type);
144
144
static sys_var_collation_sv
145
 
sys_collation_server(&vars, "collation_server", &SV::collation_server, &default_charset_info);
 
145
sys_collation_server(&vars, "collation_server", &system_variables::collation_server, &default_charset_info);
146
146
static sys_var_const_str       sys_datadir(&vars, "datadir", drizzle_real_data_home);
147
147
 
148
148
static sys_var_session_uint64_t sys_join_buffer_size(&vars, "join_buffer_size",
149
 
                                                     &SV::join_buff_size);
 
149
                                                     &system_variables::join_buff_size);
150
150
static sys_var_session_uint32_t sys_max_allowed_packet(&vars, "max_allowed_packet",
151
 
                                                       &SV::max_allowed_packet);
 
151
                                                       &system_variables::max_allowed_packet);
152
152
static sys_var_uint64_t_ptr     sys_max_connect_errors(&vars, "max_connect_errors",
153
153
                                               &max_connect_errors);
154
154
static sys_var_session_uint64_t sys_max_error_count(&vars, "max_error_count",
155
 
                                                  &SV::max_error_count);
 
155
                                                  &system_variables::max_error_count);
156
156
static sys_var_session_uint64_t sys_max_heap_table_size(&vars, "max_heap_table_size",
157
 
                                                        &SV::max_heap_table_size);
 
157
                                                        &system_variables::max_heap_table_size);
158
158
static sys_var_session_uint64_t sys_pseudo_thread_id(&vars, "pseudo_thread_id",
159
 
                                              &SV::pseudo_thread_id,
 
159
                                              &system_variables::pseudo_thread_id,
160
160
                                              0, check_pseudo_thread_id);
161
161
static sys_var_session_ha_rows  sys_max_join_size(&vars, "max_join_size",
162
 
                                                  &SV::max_join_size,
 
162
                                                  &system_variables::max_join_size,
163
163
                                                  fix_max_join_size);
164
164
static sys_var_session_uint64_t sys_max_seeks_for_key(&vars, "max_seeks_for_key",
165
 
                                                      &SV::max_seeks_for_key);
 
165
                                                      &system_variables::max_seeks_for_key);
166
166
static sys_var_session_uint64_t   sys_max_length_for_sort_data(&vars, "max_length_for_sort_data",
167
 
                                                               &SV::max_length_for_sort_data);
 
167
                                                               &system_variables::max_length_for_sort_data);
168
168
static sys_var_session_size_t   sys_max_sort_length(&vars, "max_sort_length",
169
 
                                                    &SV::max_sort_length);
 
169
                                                    &system_variables::max_sort_length);
170
170
static sys_var_uint64_t_ptr     sys_max_write_lock_count(&vars, "max_write_lock_count",
171
171
                                                 &max_write_lock_count);
172
172
static sys_var_session_uint64_t sys_min_examined_row_limit(&vars, "min_examined_row_limit",
173
 
                                                           &SV::min_examined_row_limit);
 
173
                                                           &system_variables::min_examined_row_limit);
174
174
 
175
175
/* these two cannot be static */
176
176
static sys_var_session_bool sys_optimizer_prune_level(&vars, "optimizer_prune_level",
177
 
                                                      &SV::optimizer_prune_level);
 
177
                                                      &system_variables::optimizer_prune_level);
178
178
static sys_var_session_uint32_t sys_optimizer_search_depth(&vars, "optimizer_search_depth",
179
 
                                                           &SV::optimizer_search_depth);
 
179
                                                           &system_variables::optimizer_search_depth);
180
180
 
181
181
static sys_var_session_uint64_t sys_preload_buff_size(&vars, "preload_buffer_size",
182
 
                                                      &SV::preload_buff_size);
 
182
                                                      &system_variables::preload_buff_size);
183
183
static sys_var_session_uint32_t sys_read_buff_size(&vars, "read_buffer_size",
184
 
                                                   &SV::read_buff_size);
 
184
                                                   &system_variables::read_buff_size);
185
185
static sys_var_session_uint32_t sys_read_rnd_buff_size(&vars, "read_rnd_buffer_size",
186
 
                                                       &SV::read_rnd_buff_size);
 
186
                                                       &system_variables::read_rnd_buff_size);
187
187
static sys_var_session_uint32_t sys_div_precincrement(&vars, "div_precision_increment",
188
 
                                                      &SV::div_precincrement);
 
188
                                                      &system_variables::div_precincrement);
189
189
 
190
190
static sys_var_session_size_t   sys_range_alloc_block_size(&vars, "range_alloc_block_size",
191
 
                                                           &SV::range_alloc_block_size);
 
191
                                                           &system_variables::range_alloc_block_size);
192
192
static sys_var_session_uint32_t sys_query_alloc_block_size(&vars, "query_alloc_block_size",
193
 
                                                           &SV::query_alloc_block_size,
 
193
                                                           &system_variables::query_alloc_block_size,
194
194
                                                           false, fix_session_mem_root);
195
195
static sys_var_session_uint32_t sys_query_prealloc_size(&vars, "query_prealloc_size",
196
 
                                                        &SV::query_prealloc_size,
 
196
                                                        &system_variables::query_prealloc_size,
197
197
                                                        false, fix_session_mem_root);
198
198
static sys_var_readonly sys_tmpdir(&vars, "tmpdir", OPT_GLOBAL, SHOW_CHAR, get_tmpdir);
199
199
 
203
203
                                           fix_server_id);
204
204
 
205
205
static sys_var_session_size_t   sys_sort_buffer(&vars, "sort_buffer_size",
206
 
                                                &SV::sortbuff_size);
 
206
                                                &system_variables::sortbuff_size);
207
207
 
208
208
static sys_var_session_storage_engine sys_storage_engine(&vars, "storage_engine",
209
 
                                       &SV::storage_engine);
 
209
                                       &system_variables::storage_engine);
210
210
static sys_var_const_str        sys_system_time_zone(&vars, "system_time_zone",
211
211
                                             system_time_zone);
212
212
static sys_var_size_t_ptr       sys_table_def_size(&vars, "table_definition_cache",
216
216
static sys_var_uint64_t_ptr     sys_table_lock_wait_timeout(&vars, "table_lock_wait_timeout",
217
217
                                                    &table_lock_wait_timeout);
218
218
static sys_var_session_enum     sys_tx_isolation(&vars, "tx_isolation",
219
 
                                             &SV::tx_isolation,
 
219
                                             &system_variables::tx_isolation,
220
220
                                             &tx_isolation_typelib,
221
221
                                             fix_tx_isolation,
222
222
                                             check_tx_isolation);
223
223
static sys_var_session_uint64_t sys_tmp_table_size(&vars, "tmp_table_size",
224
 
                                           &SV::tmp_table_size);
 
224
                                           &system_variables::tmp_table_size);
225
225
static sys_var_bool_ptr  sys_timed_mutexes(&vars, "timed_mutexes", &internal::timed_mutexes);
226
226
static sys_var_const_str  sys_version(&vars, "version", version().c_str());
227
227
 
261
261
/* Local state variables */
262
262
 
263
263
static sys_var_session_ha_rows  sys_select_limit(&vars, "sql_select_limit",
264
 
                                                 &SV::select_limit);
 
264
                                                 &system_variables::select_limit);
265
265
static sys_var_timestamp sys_timestamp(&vars, "timestamp");
266
266
static sys_var_last_insert_id
267
267
sys_last_insert_id(&vars, "last_insert_id");
295
295
                                          get_warning_count);
296
296
 
297
297
sys_var_session_uint64_t sys_group_concat_max_len(&vars, "group_concat_max_len",
298
 
                                                  &SV::group_concat_max_len);
 
298
                                                  &system_variables::group_concat_max_len);
299
299
 
300
300
sys_var_session_time_zone sys_time_zone(&vars, "time_zone");
301
301
 
309
309
  TODO: remove this list completely
310
310
*/
311
311
 
312
 
#define FIXED_VARS_SIZE (sizeof(fixed_vars) / sizeof(SHOW_VAR))
313
 
static SHOW_VAR fixed_vars[]= {
 
312
#define FIXED_VARS_SIZE (sizeof(fixed_vars) / sizeof(drizzle_show_var))
 
313
static drizzle_show_var fixed_vars[]= {
314
314
  {"back_log",                (char*) &back_log,                SHOW_INT},
315
315
  {"language",                language,                         SHOW_CHAR},
316
316
  {"pid_file",                (char*) pidfile_name,             SHOW_CHAR},
1379
1379
    {
1380
1380
      /* We changed to auto_commit mode */
1381
1381
      session->options&= ~(uint64_t) (OPTION_BEGIN);
1382
 
      session->transaction.all.modified_non_trans_table= false;
1383
1382
      session->server_status|= SERVER_STATUS_AUTOCOMMIT;
1384
1383
      TransactionServices &transaction_services= TransactionServices::singleton();
1385
1384
      if (transaction_services.ha_commit_trans(session, true))
1387
1386
    }
1388
1387
    else
1389
1388
    {
1390
 
      session->transaction.all.modified_non_trans_table= false;
1391
1389
      session->server_status&= ~SERVER_STATUS_AUTOCOMMIT;
1392
1390
    }
1393
1391
  }
1564
1562
    sorted      If TRUE, the system variables should be sorted
1565
1563
 
1566
1564
  RETURN VALUES
1567
 
    pointer     Array of SHOW_VAR elements for display
 
1565
    pointer     Array of drizzle_show_var elements for display
1568
1566
    NULL        FAILURE
1569
1567
*/
1570
1568
 
1571
 
SHOW_VAR* enumerate_sys_vars(Session *session, bool)
 
1569
drizzle_show_var* enumerate_sys_vars(Session *session, bool)
1572
1570
{
1573
1571
  int fixed_count= fixed_show_vars.elements;
1574
 
  int size= sizeof(SHOW_VAR) * (system_variable_map.size() + fixed_count + 1);
1575
 
  SHOW_VAR *result= (SHOW_VAR*) session->alloc(size);
 
1572
  int size= sizeof(drizzle_show_var) * (system_variable_map.size() + fixed_count + 1);
 
1573
  drizzle_show_var *result= (drizzle_show_var*) session->alloc(size);
1576
1574
 
1577
1575
  if (result)
1578
1576
  {
1579
 
    SHOW_VAR *show= result + fixed_count;
1580
 
    memcpy(result, fixed_show_vars.buffer, fixed_count * sizeof(SHOW_VAR));
 
1577
    drizzle_show_var *show= result + fixed_count;
 
1578
    memcpy(result, fixed_show_vars.buffer, fixed_count * sizeof(drizzle_show_var));
1581
1579
 
1582
1580
    SystemVariableMap::const_iterator iter= system_variable_map.begin();
1583
1581
    while (iter != system_variable_map.end())
1591
1589
    }
1592
1590
 
1593
1591
    /* make last element empty */
1594
 
    memset(show, 0, sizeof(SHOW_VAR));
 
1592
    memset(show, 0, sizeof(drizzle_show_var));
1595
1593
  }
1596
1594
  return result;
1597
1595
}
1614
1612
 
1615
1613
  for (sys_var *var= vars.first; var; var= var->getNext(), count++) {};
1616
1614
 
1617
 
  if (my_init_dynamic_array(&fixed_show_vars, sizeof(SHOW_VAR),
 
1615
  if (my_init_dynamic_array(&fixed_show_vars, sizeof(drizzle_show_var),
1618
1616
                            FIXED_VARS_SIZE + 64, 64))
1619
1617
    goto error;
1620
1618
 
1639
1637
}
1640
1638
 
1641
1639
 
1642
 
/*
1643
 
  Add elements to the dynamic list of read-only system variables.
1644
 
 
1645
 
  SYNOPSIS
1646
 
    mysql_append_static_vars()
1647
 
    show_vars   Pointer to start of array
1648
 
    count       Number of elements
1649
 
 
1650
 
  RETURN VALUES
1651
 
    0           SUCCESS
1652
 
    otherwise   FAILURE
1653
 
*/
1654
 
int mysql_append_static_vars(const SHOW_VAR *show_vars, uint32_t count)
1655
 
{
1656
 
  for (; count > 0; count--, show_vars++)
1657
 
    if (insert_dynamic(&fixed_show_vars, (unsigned char*) show_vars))
1658
 
      return 1;
1659
 
  return 0;
1660
 
}
1661
 
 
1662
 
 
1663
1640
/**
1664
1641
  Find a user set-table variable.
1665
1642