~posulliv/drizzle/memcached_applier

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Jay Pipes
  • Date: 2009-08-03 14:23:22 UTC
  • mfrom: (1039.2.68 staging)
  • mto: This revision was merged to the branch mainline in revision 1078.
  • Revision ID: jpipes@serialcoder-20090803142322-1g67h7su9mocg9ig
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <drizzled/connect.h>
37
37
#include <drizzled/lock.h>
38
38
#include <drizzled/select_send.h>
 
39
#include <drizzled/command.h>
 
40
 
39
41
#include <bitset>
40
42
#include <algorithm>
41
43
 
428
430
mysql_execute_command(Session *session)
429
431
{
430
432
  int res= false;
 
433
  bool comm_not_executed= false;
431
434
  bool need_start_waiting= false; // have protection against global read lock
432
435
  LEX  *lex= session->lex;
433
436
  /* first Select_Lex (have special meaning for many of non-SELECTcommands) */
482
485
 
483
486
  assert(session->transaction.stmt.modified_non_trans_table == false);
484
487
 
 
488
 
485
489
  switch (lex->sql_command) {
486
 
  case SQLCOM_SHOW_STATUS:
487
 
  {
488
 
    system_status_var old_status_var= session->status_var;
489
 
    session->initial_status_var= &old_status_var;
490
 
    res= execute_sqlcom_select(session, all_tables);
491
 
    /* Don't log SHOW STATUS commands to slow query log */
492
 
    session->server_status&= ~(SERVER_QUERY_NO_INDEX_USED |
493
 
                           SERVER_QUERY_NO_GOOD_INDEX_USED);
494
 
    /*
495
 
      restore status variables, as we don't want 'show status' to cause
496
 
      changes
497
 
    */
498
 
    pthread_mutex_lock(&LOCK_status);
499
 
    add_diff_to_status(&global_status_var, &session->status_var,
500
 
                       &old_status_var);
501
 
    session->status_var= old_status_var;
502
 
    pthread_mutex_unlock(&LOCK_status);
503
 
    break;
504
 
  }
505
 
  case SQLCOM_SHOW_DATABASES:
506
 
  case SQLCOM_SHOW_TABLES:
507
 
  case SQLCOM_SHOW_TABLE_STATUS:
508
 
  case SQLCOM_SHOW_OPEN_TABLES:
509
 
  case SQLCOM_SHOW_FIELDS:
510
 
  case SQLCOM_SHOW_KEYS:
511
 
  case SQLCOM_SHOW_VARIABLES:
512
 
  case SQLCOM_SELECT:
513
 
  {
514
 
    session->status_var.last_query_cost= 0.0;
515
 
    res= execute_sqlcom_select(session, all_tables);
516
 
    break;
517
 
  }
518
490
  case SQLCOM_EMPTY_QUERY:
519
491
    session->my_ok();
520
492
    break;
1339
1311
    }
1340
1312
    break;
1341
1313
  default:
1342
 
    assert(0);                             /* Impossible */
1343
 
    session->my_ok();
 
1314
    /*
 
1315
     * This occurs now because we have extracted some commands in
 
1316
     * to their own classes and thus there is no matching case
 
1317
     * label in this switch statement for those commands. Pretty soon
 
1318
     * this entire switch statement will be gone along with this 
 
1319
     * comment...
 
1320
     */
 
1321
    comm_not_executed= true;
1344
1322
    break;
1345
1323
  }
 
1324
  /*
 
1325
   * The following conditional statement is only temporary until
 
1326
   * the mongo switch statement that occurs afterwards has been
 
1327
   * fully removed. Once that switch statement is gone, every
 
1328
   * command will have its own class and we won't need this
 
1329
   * check.
 
1330
   */
 
1331
  if (comm_not_executed)
 
1332
  {
 
1333
    /* now we are ready to execute the command */
 
1334
    res= lex->command->execute();
 
1335
  }
 
1336
 
1346
1337
  session->set_proc_info("query end");
1347
1338
 
1348
1339
  /*