~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Lee Bieber
  • Date: 2010-11-16 17:50:17 UTC
  • mfrom: (1932.3.2 trunk)
  • Revision ID: kalebral@gmail.com-20101116175017-sken3dkkpfcd2snv
Merge Brian - session fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
  bool error= 0;
171
171
  Query_id &query_id= Query_id::get_query_id();
172
172
 
173
 
  DRIZZLE_COMMAND_START(session->thread_id,
174
 
                        command);
 
173
  DRIZZLE_COMMAND_START(session->thread_id, command);
175
174
 
176
175
  session->command= command;
177
176
  session->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
221
220
  {
222
221
    if (not session->readAndStoreQuery(packet, packet_length))
223
222
      break;                                    // fatal error is set
224
 
    DRIZZLE_QUERY_START(session->query.c_str(),
 
223
    DRIZZLE_QUERY_START(session->getQueryString()->c_str(),
225
224
                        session->thread_id,
226
225
                        const_cast<const char *>(session->db.empty() ? "" : session->db.c_str()));
227
226
 
228
 
    plugin::QueryRewriter::rewriteQuery(session->db, session->query);
229
 
    mysql_parse(session, session->query.c_str(), session->query.length());
 
227
    plugin::QueryRewriter::rewriteQuery(session->getSchema(), session->getQueryString());
 
228
    mysql_parse(session, session->getQueryString()->c_str(), session->getQueryString()->length());
230
229
 
231
230
    break;
232
231
  }
320
319
  /* Store temp state for processlist */
321
320
  session->set_proc_info("cleaning up");
322
321
  session->command= COM_SLEEP;
323
 
  memset(session->process_list_info, 0, PROCESS_LIST_WIDTH);
324
 
  session->query.clear();
 
322
  session->resetQueryString();
325
323
 
326
324
  session->set_proc_info(NULL);
327
325
  session->mem_root->free_root(MYF(memory::KEEP_PREALLOC));
432
430
    true        Error
433
431
*/
434
432
 
435
 
static int
436
 
mysql_execute_command(Session *session)
 
433
static int mysql_execute_command(Session *session)
437
434
{
438
435
  bool res= false;
439
436
  LEX  *lex= session->lex;
441
438
  Select_Lex *select_lex= &lex->select_lex;
442
439
  /* list of all tables in query */
443
440
  TableList *all_tables;
444
 
  /* A peek into the query string */
445
 
  size_t proc_info_len= session->query.length() > PROCESS_LIST_WIDTH ?
446
 
                        PROCESS_LIST_WIDTH : session->query.length();
447
 
 
448
 
  memcpy(session->process_list_info, session->query.c_str(), proc_info_len);
449
 
  session->process_list_info[proc_info_len]= '\0';
450
441
 
451
442
  /*
452
443
    In many cases first table of main Select_Lex have special meaning =>
748
739
  if (!err)
749
740
  {
750
741
    {
751
 
      if (! session->is_error())
 
742
      if (not session->is_error())
752
743
      {
753
 
        DRIZZLE_QUERY_EXEC_START(session->query.c_str(),
 
744
        DRIZZLE_QUERY_EXEC_START(session->getQueryString()->c_str(),
754
745
                                 session->thread_id,
755
746
                                 const_cast<const char *>(session->db.empty() ? "" : session->db.c_str()));
756
747
        // Implement Views here --Brian
1771
1762
{
1772
1763
  assert(session->m_lip == NULL);
1773
1764
 
1774
 
  DRIZZLE_QUERY_PARSE_START(session->query.c_str());
 
1765
  DRIZZLE_QUERY_PARSE_START(session->getQueryString()->c_str());
1775
1766
 
1776
1767
  /* Set Lex_input_stream. */
1777
1768