~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.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:
669
669
    table_list.select_lex= &(session->lex->select_lex);
670
670
 
671
671
    lex_start(session);
672
 
    mysql_reset_session_for_next_command(session);
 
672
    session->reset_for_next_command();
673
673
 
674
674
    session->lex->
675
675
      select_lex.table_list.link_in_list((unsigned char*) &table_list,
2317
2317
}
2318
2318
 
2319
2319
 
2320
 
/**
2321
 
 Reset Session part responsible for command processing state.
2322
 
 
2323
 
   This needs to be called before execution of every statement
2324
 
   (prepared or conventional).
2325
 
   It is not called by substatements of routines.
2326
 
 
2327
 
  @todo
2328
 
   Make it a method of Session and align its name with the rest of
2329
 
   reset/end/start/init methods.
2330
 
  @todo
2331
 
   Call it after we use Session for queries, not before.
2332
 
*/
2333
 
 
2334
 
void mysql_reset_session_for_next_command(Session *session)
2335
 
{
2336
 
  session->free_list= 0;
2337
 
  session->select_number= 1;
2338
 
  /*
2339
 
    Those two lines below are theoretically unneeded as
2340
 
    Session::cleanup_after_query() should take care of this already.
2341
 
  */
2342
 
  session->auto_inc_intervals_in_cur_stmt_for_binlog.empty();
2343
 
 
2344
 
  session->query_start_used= 0;
2345
 
  session->is_fatal_error= 0;
2346
 
  session->server_status&= ~ (SERVER_MORE_RESULTS_EXISTS |
2347
 
                          SERVER_QUERY_NO_INDEX_USED |
2348
 
                          SERVER_QUERY_NO_GOOD_INDEX_USED);
2349
 
  /*
2350
 
    If in autocommit mode and not in a transaction, reset
2351
 
    OPTION_STATUS_NO_TRANS_UPDATE | OPTION_KEEP_LOG to not get warnings
2352
 
    in ha_rollback_trans() about some tables couldn't be rolled back.
2353
 
  */
2354
 
  if (!(session->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)))
2355
 
  {
2356
 
    session->options&= ~OPTION_KEEP_LOG;
2357
 
    session->transaction.all.modified_non_trans_table= false;
2358
 
  }
2359
 
  session->thread_specific_used= false;
2360
 
 
2361
 
  if (opt_bin_log)
2362
 
  {
2363
 
    reset_dynamic(&session->user_var_events);
2364
 
    session->user_var_events_alloc= session->mem_root;
2365
 
  }
2366
 
  session->clear_error();
2367
 
  session->main_da.reset_diagnostics_area();
2368
 
  session->total_warn_count=0;                  // Warnings for this query
2369
 
  session->sent_row_count= session->examined_row_count= 0;
2370
 
 
2371
 
  return;
2372
 
}
2373
 
 
2374
 
 
2375
2320
void
2376
2321
mysql_init_select(LEX *lex)
2377
2322
{
2541
2486
    FIXME: cleanup the dependencies in the code to simplify this.
2542
2487
  */
2543
2488
  lex_start(session);
2544
 
  mysql_reset_session_for_next_command(session);
 
2489
  session->reset_for_next_command();
2545
2490
 
2546
2491
  {
2547
2492
    LEX *lex= session->lex;
2606
2551
 
2607
2552
  Lex_input_stream lip(session, inBuf, length);
2608
2553
  lex_start(session);
2609
 
  mysql_reset_session_for_next_command(session);
 
2554
  session->reset_for_next_command();
2610
2555
 
2611
2556
  if (!parse_sql(session, &lip) &&
2612
2557
      all_tables_not_ok(session,(TableList*) lex->select_lex.table_list.first))