~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.cc

  • Committer: Brian Aker
  • Date: 2008-11-18 23:19:19 UTC
  • mfrom: (584.1.16 devel)
  • Revision ID: brian@tangent.org-20081118231919-w9sr347dtiwhccml
Merge of Monty's work.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
/*****************************************************************************
22
22
**
23
 
** This file implements classes defined in sql_class.h
 
23
** This file implements classes defined in session.h
24
24
** Especially the classes to handle a result from a select
25
25
**
26
26
*****************************************************************************/
27
27
#include <drizzled/server_includes.h>
 
28
#include <drizzled/session.h>
28
29
#include <drizzled/replication/rli.h>
29
30
#include <drizzled/replication/record.h>
30
31
#include <drizzled/log_event.h>
34
35
#include <drizzled/error.h>
35
36
#include <drizzled/query_id.h>
36
37
#include <drizzled/data_home.h>
 
38
#include <drizzled/sql_base.h>
37
39
 
38
40
extern scheduler_functions thread_scheduler;
39
41
/*
688
690
/*
689
691
  Init Session for query processing.
690
692
  This has to be called once before we call mysql_parse.
691
 
  See also comments in sql_class.h.
 
693
  See also comments in session.h.
692
694
*/
693
695
 
694
696
void Session::init_for_queries()
2128
2130
  return;
2129
2131
}
2130
2132
 
 
2133
void TMP_TABLE_PARAM::cleanup(void)
 
2134
{
 
2135
  /* Fix for Intel compiler */
 
2136
  if (copy_field)
 
2137
  {
 
2138
    delete [] copy_field;
 
2139
    save_copy_field= copy_field= 0;
 
2140
  }
 
2141
}
 
2142
 
2131
2143
 
2132
2144
void session_increment_bytes_sent(ulong length)
2133
2145
{
2473
2485
      flush the pending event and replace it with the newly created
2474
2486
      event...
2475
2487
    */
2476
 
    if (unlikely(mysql_bin_log.flush_and_set_pending_rows_event(this, ev)))
 
2488
    if (unlikely(drizzle_bin_log.flush_and_set_pending_rows_event(this, ev)))
2477
2489
    {
2478
2490
      delete ev;
2479
2491
      return(NULL);
2619
2631
int Session::binlog_write_row(Table* table, bool is_trans, 
2620
2632
                          unsigned char const *record) 
2621
2633
2622
 
  assert(mysql_bin_log.is_open());
 
2634
  assert(drizzle_bin_log.is_open());
2623
2635
 
2624
2636
  /*
2625
2637
    Pack records into format for transfer. We are allocating more
2647
2659
                           const unsigned char *before_record,
2648
2660
                           const unsigned char *after_record)
2649
2661
2650
 
  assert(mysql_bin_log.is_open());
 
2662
  assert(drizzle_bin_log.is_open());
2651
2663
 
2652
2664
  size_t const before_maxlen = table->max_row_length(before_record);
2653
2665
  size_t const after_maxlen  = table->max_row_length(after_record);
2680
2692
int Session::binlog_delete_row(Table* table, bool is_trans, 
2681
2693
                           unsigned char const *record)
2682
2694
2683
 
  assert(mysql_bin_log.is_open());
 
2695
  assert(drizzle_bin_log.is_open());
2684
2696
 
2685
2697
  /* 
2686
2698
     Pack records into format for transfer. We are allocating more
2712
2724
    mode: it might be the case that we left row-based mode before
2713
2725
    flushing anything (e.g., if we have explicitly locked tables).
2714
2726
   */
2715
 
  if (!mysql_bin_log.is_open())
 
2727
  if (!drizzle_bin_log.is_open())
2716
2728
    return(0);
2717
2729
 
2718
2730
  /*
2729
2741
      binlog_table_maps= 0;
2730
2742
    }
2731
2743
 
2732
 
    error= mysql_bin_log.flush_and_set_pending_rows_event(this, 0);
 
2744
    error= drizzle_bin_log.flush_and_set_pending_rows_event(this, 0);
2733
2745
  }
2734
2746
 
2735
2747
  return(error);
2763
2775
                      ulong query_len, bool is_trans, bool suppress_use,
2764
2776
                      Session::killed_state killed_status_arg)
2765
2777
{
2766
 
  assert(query_arg && mysql_bin_log.is_open());
 
2778
  assert(query_arg && drizzle_bin_log.is_open());
2767
2779
 
2768
2780
  if (int error= binlog_flush_pending_rows_event(true))
2769
2781
    return(error);
2816
2828
        log event is written to the binary log, we pretend that no
2817
2829
        table maps were written.
2818
2830
       */
2819
 
      int error= mysql_bin_log.write(&qinfo);
 
2831
      int error= drizzle_bin_log.write(&qinfo);
2820
2832
      binlog_table_maps= 0;
2821
2833
      return(error);
2822
2834
    }