~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2008-12-23 05:59:22 UTC
  • Revision ID: brian@tangent.org-20081223055922-ycotcrvxc2zwupoo
Refactor session.

Show diffs side-by-side

added added

removed removed

Lines of Context:
500
500
  thread_stack= 0;
501
501
  catalog= (char*)"std"; // the only catalog we have for now
502
502
  some_tables_deleted=no_errors=password= 0;
503
 
  query_start_used= 0;
504
503
  count_cuted_fields= CHECK_FIELD_IGNORE;
505
504
  killed= NOT_KILLED;
506
505
  col_access=0;
2555
2554
  if (lock)
2556
2555
    (void) pthread_mutex_unlock(&LOCK_thread_count);
2557
2556
}
 
2557
 
 
2558
 
 
2559
 
 
2560
/**
 
2561
 Reset Session part responsible for command processing state.
 
2562
 
 
2563
   This needs to be called before execution of every statement
 
2564
   (prepared or conventional).
 
2565
   It is not called by substatements of routines.
 
2566
 
 
2567
  @todo
 
2568
   Make it a method of Session and align its name with the rest of
 
2569
   reset/end/start/init methods.
 
2570
  @todo
 
2571
   Call it after we use Session for queries, not before.
 
2572
*/
 
2573
 
 
2574
void Session::reset_for_next_command()
 
2575
{
 
2576
  free_list= 0;
 
2577
  select_number= 1;
 
2578
  /*
 
2579
    Those two lines below are theoretically unneeded as
 
2580
    Session::cleanup_after_query() should take care of this already.
 
2581
  */
 
2582
  auto_inc_intervals_in_cur_stmt_for_binlog.empty();
 
2583
 
 
2584
  is_fatal_error= 0;
 
2585
  server_status&= ~ (SERVER_MORE_RESULTS_EXISTS |
 
2586
                          SERVER_QUERY_NO_INDEX_USED |
 
2587
                          SERVER_QUERY_NO_GOOD_INDEX_USED);
 
2588
  /*
 
2589
    If in autocommit mode and not in a transaction, reset
 
2590
    OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG to not get warnings
 
2591
    in ha_rollback_trans() about some tables couldn't be rolled back.
 
2592
  */
 
2593
  if (!(options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
 
2594
  {
 
2595
    options&= ~OPTION_KEEP_LOG;
 
2596
    transaction.all.modified_non_trans_table= false;
 
2597
  }
 
2598
  thread_specific_used= false;
 
2599
 
 
2600
  if (opt_bin_log)
 
2601
  {
 
2602
    reset_dynamic(&user_var_events);
 
2603
    user_var_events_alloc= mem_root;
 
2604
  }
 
2605
  clear_error();
 
2606
  main_da.reset_diagnostics_area();
 
2607
  total_warn_count=0;                   // Warnings for this query
 
2608
  sent_row_count= examined_row_count= 0;
 
2609
 
 
2610
  return;
 
2611
}