~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/session.h

Merged Eric from lp:~eday/drizzle/eday-merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
/* Classes in mysql */
25
25
 
26
26
#include <drizzled/plugin/protocol.h>
 
27
#include <drizzled/plugin/scheduler.h>
27
28
#include <drizzled/sql_locale.h>
28
29
#include <drizzled/ha_trx_info.h>
29
30
#include <mysys/my_alloc.h>
136
137
  size_t max_sort_length;
137
138
  uint64_t min_examined_row_limit;
138
139
  uint32_t net_buffer_length;
139
 
  uint32_t net_read_timeout;
140
 
  uint32_t net_retry_count;
141
 
  uint32_t net_wait_timeout;
142
 
  uint32_t net_write_timeout;
143
140
  bool optimizer_prune_level;
144
141
  bool log_warnings;
145
142
  bool engine_condition_pushdown;
481
478
  static const char * const DEFAULT_WHERE;
482
479
 
483
480
  MEM_ROOT warn_root; /**< Allocation area for warnings and errors */
484
 
  Protocol *protocol;   /**< Pointer to the current protocol */
 
481
  drizzled::plugin::Protocol *protocol; /**< Pointer to protocol object */
 
482
  drizzled::plugin::Scheduler *scheduler; /**< Pointer to scheduler object */
 
483
  void *scheduler_arg; /**< Pointer to the optional scheduler argument */
485
484
  HASH user_vars; /**< Hash of user variables defined during the session's lifetime */
486
485
  String packet; /**< dynamic buffer for network I/O */
487
486
  String convert_buffer; /**< A buffer for charset conversions */
500
499
  char process_list_info[PROCESS_LIST_WIDTH+1];
501
500
 
502
501
  /**
503
 
   * A pointer to the stack frame of handle_one_connection(),
 
502
   * A pointer to the stack frame of the scheduler thread
504
503
   * which is called first in the thread for handling a client
505
504
   */
506
505
  char *thread_stack;
540
539
  enum enum_server_command command;
541
540
  uint32_t file_id;     /**< File ID for LOAD DATA INFILE */
542
541
  /* @note the following three members should likely move to Protocol */
543
 
  uint32_t client_capabilities; /**< What the client supports */
544
542
  uint16_t peer_port; /**< The remote (peer) port */
545
543
  uint32_t max_client_packet_length; /**< Maximum number of bytes a client can send in a single packet */
546
544
  time_t start_time;
786
784
  */
787
785
  Lex_input_stream *m_lip;
788
786
  
789
 
  /** session_scheduler for events */
790
 
  void *scheduler;
791
 
 
792
787
  /** Place to store various things */
793
788
  void *session_marker;
794
789
  /** Keeps a copy of the previous table around in case we are just slamming on particular table */
906
901
    auto_inc_intervals_forced.append(next_id, UINT64_MAX, 0);
907
902
  }
908
903
 
909
 
  Session(Protocol *protocol_arg);
 
904
  Session(drizzled::plugin::Protocol *protocol_arg);
910
905
  ~Session();
911
906
 
912
 
  /**
913
 
    Initialize memory roots necessary for query processing and (!)
914
 
    pre-allocate memory for it. We can't do that in Session constructor because
915
 
    there are use cases (acl_init, watcher threads,
916
 
    killing mysqld) where it's vital to not allocate excessive and not used
917
 
    memory. Note, that we still don't return error from init_for_queries():
918
 
    if preallocation fails, we should notice that at the first call to
919
 
    alloc_root.
920
 
  */
921
 
  void init_for_queries();
922
907
  void cleanup(void);
923
908
  /**
924
909
   * Cleans up after query.
933
918
   * slave.
934
919
   */
935
920
  void cleanup_after_query();
936
 
  bool store_globals();
 
921
  bool storeGlobals();
937
922
  void awake(Session::killed_state state_to_set);
938
923
  /**
939
924
   * Pulls thread-specific variables into Session state.
947
932
  bool initGlobals();
948
933
 
949
934
  /**
950
 
   * Initializes the Session to handle queries.
951
 
   */
 
935
    Initialize memory roots necessary for query processing and (!)
 
936
    pre-allocate memory for it. We can't do that in Session constructor because
 
937
    there are use cases (acl_init, watcher threads,
 
938
    killing mysqld) where it's vital to not allocate excessive and not used
 
939
    memory. Note, that we still don't return error from init_for_queries():
 
940
    if preallocation fails, we should notice that at the first call to
 
941
    alloc_root.
 
942
  */
952
943
  void prepareForQueries();
953
944
 
954
945
  /**
1004
995
   */
1005
996
  bool authenticate();
1006
997
 
 
998
  /**
 
999
   * Run a session.
 
1000
   *
 
1001
   * This will initialize the session and begin the command loop.
 
1002
   */
 
1003
  void run();
 
1004
 
 
1005
  /**
 
1006
   * Schedule a session to be run on the default scheduler.
 
1007
   */
 
1008
  bool schedule();
 
1009
 
1007
1010
  /*
1008
1011
    For enter_cond() / exit_cond() to work the mutex must be got before
1009
1012
    enter_cond(); this mutex is then released by exit_cond().
1326
1329
public:
1327
1330
 
1328
1331
  /** A short cut for session->main_da.set_ok_status(). */
1329
 
  inline void my_ok(ha_rows affected_rows= 0, uint64_t passed_id= 0, const char *message= NULL)
 
1332
  inline void my_ok(ha_rows affected_rows= 0, ha_rows found_rows_arg= 0,
 
1333
                    uint64_t passed_id= 0, const char *message= NULL)
1330
1334
  {
1331
 
    main_da.set_ok_status(this, affected_rows, passed_id, message);
 
1335
    main_da.set_ok_status(this, affected_rows, found_rows_arg, passed_id, message);
1332
1336
  }
1333
1337
 
1334
1338