~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/set_var.cc

  • Committer: Brian Aker
  • Date: 2009-04-09 15:03:26 UTC
  • mfrom: (971.1.44 mordred)
  • Revision ID: brian@gaz-20090409150326-cu50yn12esijpy1c
Merge Monty

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
                                                               &SV::optimizer_switch);
278
278
 
279
279
static sys_var_session_storage_engine sys_storage_engine(&vars, "storage_engine",
280
 
                                       &SV::table_plugin);
 
280
                                       &SV::storage_engine);
281
281
static sys_var_const_str        sys_system_time_zone(&vars, "system_time_zone",
282
282
                                             system_time_zone);
283
283
static sys_var_uint64_t_ptr     sys_table_def_size(&vars, "table_definition_cache",
2287
2287
  const char *value;
2288
2288
  String str(buff, sizeof(buff), &my_charset_utf8_general_ci), *res;
2289
2289
 
2290
 
  var->save_result.plugin= NULL;
 
2290
  var->save_result.storage_engine= NULL;
2291
2291
  if (var->value->result_type() == STRING_RESULT)
2292
2292
  {
2293
2293
    LEX_STRING engine_name;
2295
2295
    if (!(res=var->value->val_str(&str)) ||
2296
2296
        !(engine_name.str= (char *)res->ptr()) ||
2297
2297
        !(engine_name.length= res->length()) ||
2298
 
        !(var->save_result.plugin= ha_resolve_by_name(session, &engine_name)) ||
2299
 
        !(engine= static_cast<StorageEngine *>(var->save_result.plugin->data)))
 
2298
              !(var->save_result.storage_engine=
 
2299
            ha_resolve_by_name(session, &engine_name)) ||
 
2300
        !(engine= var->save_result.storage_engine))
2300
2301
    {
2301
2302
      value= res ? res->c_ptr() : "NULL";
2302
2303
      goto err;
2316
2317
                                                         const LEX_STRING *)
2317
2318
{
2318
2319
  unsigned char* result;
2319
 
  StorageEngine *engine;
2320
2320
  string engine_name;
2321
 
  st_plugin_int *plugin= session->variables.*offset;
 
2321
  StorageEngine *engine= session->variables.*offset;
2322
2322
  if (type == OPT_GLOBAL)
2323
 
    plugin= global_system_variables.*offset;
2324
 
  engine= static_cast<StorageEngine*>(plugin->data);
 
2323
    engine= global_system_variables.*offset;
2325
2324
  engine_name= engine->getName();
2326
2325
  result= (unsigned char *) session->strmake(engine_name.c_str(),
2327
2326
                                             engine_name.size());
2331
2330
 
2332
2331
void sys_var_session_storage_engine::set_default(Session *session, enum_var_type type)
2333
2332
{
2334
 
  st_plugin_int *old_value, *new_value, **value;
 
2333
  StorageEngine *old_value, *new_value, **value;
2335
2334
  if (type == OPT_GLOBAL)
2336
2335
  {
2337
2336
    value= &(global_system_variables.*offset);
2338
 
    new_value= ha_lock_engine(NULL, myisam_engine);
 
2337
    new_value= myisam_engine;
2339
2338
  }
2340
2339
  else
2341
2340
  {
2350
2349
 
2351
2350
bool sys_var_session_storage_engine::update(Session *session, set_var *var)
2352
2351
{
2353
 
  st_plugin_int **value= &(global_system_variables.*offset), *old_value;
 
2352
  StorageEngine **value= &(global_system_variables.*offset), *old_value;
2354
2353
   if (var->type != OPT_GLOBAL)
2355
2354
     value= &(session->variables.*offset);
2356
2355
  old_value= *value;
2357
 
  if (old_value != var->save_result.plugin)
 
2356
  if (old_value != var->save_result.storage_engine)
2358
2357
  {
2359
 
    *value= var->save_result.plugin;
 
2358
    *value= var->save_result.storage_engine;
2360
2359
  }
2361
2360
  return 0;
2362
2361
}