~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

  • Committer: Monty Taylor
  • Date: 2008-10-13 09:29:43 UTC
  • mfrom: (509 drizzle)
  • mto: (509.1.4 codestyle)
  • mto: This revision was merged to the branch mainline in revision 511.
  • Revision ID: monty@inaugust.com-20081013092943-rwvx4a6d85b5l2dh
MergedĀ inĀ trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
183
183
  sql_command_flags[SQLCOM_SHOW_FIELDS]=      CF_STATUS_COMMAND;
184
184
  sql_command_flags[SQLCOM_SHOW_KEYS]=        CF_STATUS_COMMAND;
185
185
  sql_command_flags[SQLCOM_SHOW_VARIABLES]=   CF_STATUS_COMMAND;
186
 
  sql_command_flags[SQLCOM_SHOW_CHARSETS]=    CF_STATUS_COMMAND;
187
 
  sql_command_flags[SQLCOM_SHOW_COLLATIONS]=  CF_STATUS_COMMAND;
188
186
  sql_command_flags[SQLCOM_SHOW_BINLOGS]= CF_STATUS_COMMAND;
189
 
  sql_command_flags[SQLCOM_SHOW_BINLOG_EVENTS]= CF_STATUS_COMMAND;
190
187
  sql_command_flags[SQLCOM_SHOW_WARNS]= CF_STATUS_COMMAND;
191
188
  sql_command_flags[SQLCOM_SHOW_ERRORS]= CF_STATUS_COMMAND;
192
189
  sql_command_flags[SQLCOM_SHOW_ENGINE_STATUS]= CF_STATUS_COMMAND;
222
219
  Vio* save_vio;
223
220
  ulong save_client_capabilities;
224
221
 
225
 
  thd_proc_info(thd, "Execution of init_command");
 
222
  thd->set_proc_info("Execution of init_command");
226
223
  /*
227
224
    We need to lock init_command_var because
228
225
    during execution of init_command_var query
498
495
  bool error= 0;
499
496
 
500
497
  thd->command=command;
501
 
  /*
502
 
    Commands which always take a long time are logged into
503
 
    the slow log only if opt_log_slow_admin_statements is set.
504
 
  */
505
 
  thd->enable_slow_log= true;
506
498
  thd->lex->sql_command= SQLCOM_END; /* to avoid confusing VIEW detectors */
507
499
  thd->set_time();
508
500
  pthread_mutex_lock(&LOCK_thread_count);
761
753
      uint32_t slave_server_id;
762
754
 
763
755
      status_var_increment(thd->status_var.com_other);
764
 
      thd->enable_slow_log= opt_log_slow_admin_statements;
765
756
      /* TODO: The following has to be changed to an 8 byte integer */
766
757
      pos = uint4korr(packet);
767
758
      flags = uint2korr(packet + 4);
856
847
 
857
848
  log_slow_statement(thd);
858
849
 
859
 
  thd_proc_info(thd, "cleaning up");
 
850
  thd->set_proc_info("cleaning up");
860
851
  pthread_mutex_lock(&LOCK_thread_count); // For process list
861
 
  thd_proc_info(thd, 0);
 
852
  thd->set_proc_info(0);
862
853
  thd->command=COM_SLEEP;
863
854
  thd->query=0;
864
855
  thd->query_length=0;
1203
1194
  case SQLCOM_SHOW_FIELDS:
1204
1195
  case SQLCOM_SHOW_KEYS:
1205
1196
  case SQLCOM_SHOW_VARIABLES:
1206
 
  case SQLCOM_SHOW_CHARSETS:
1207
 
  case SQLCOM_SHOW_COLLATIONS:
1208
1197
  case SQLCOM_SELECT:
1209
1198
  {
1210
1199
    thd->status_var.last_query_cost= 0.0;
1256
1245
                              (1L << (uint32_t) DRIZZLE_ERROR::WARN_LEVEL_ERROR));
1257
1246
    break;
1258
1247
  }
1259
 
  case SQLCOM_SHOW_BINLOG_EVENTS:
1260
 
  {
1261
 
    res = mysql_show_binlog_events(thd);
1262
 
    break;
1263
 
  }
1264
 
 
1265
1248
  case SQLCOM_ASSIGN_TO_KEYCACHE:
1266
1249
  {
1267
1250
    assert(first_table == all_tables && first_table != 0);
1487
1470
    assert(first_table == all_tables && first_table != 0);
1488
1471
    if (end_active_trans(thd))
1489
1472
      goto error;
1490
 
    /*
1491
 
      Currently CREATE INDEX or DROP INDEX cause a full table rebuild
1492
 
      and thus classify as slow administrative statements just like
1493
 
      ALTER TABLE.
1494
 
    */
1495
 
    thd->enable_slow_log= opt_log_slow_admin_statements;
1496
1473
 
1497
1474
    memset(&create_info, 0, sizeof(create_info));
1498
1475
    create_info.db_type= 0;
1584
1561
        break;
1585
1562
      }
1586
1563
 
1587
 
      thd->enable_slow_log= opt_log_slow_admin_statements;
1588
1564
      res= mysql_alter_table(thd, select_lex->db, lex->name.str,
1589
1565
                             &create_info,
1590
1566
                             first_table,
1635
1611
  case SQLCOM_REPAIR:
1636
1612
  {
1637
1613
    assert(first_table == all_tables && first_table != 0);
1638
 
    thd->enable_slow_log= opt_log_slow_admin_statements;
1639
1614
    res= mysql_repair_table(thd, first_table, &lex->check_opt);
1640
1615
    /* ! we write after unlocking the table */
1641
1616
    /*
1649
1624
  case SQLCOM_CHECK:
1650
1625
  {
1651
1626
    assert(first_table == all_tables && first_table != 0);
1652
 
    thd->enable_slow_log= opt_log_slow_admin_statements;
1653
1627
    res = mysql_check_table(thd, first_table, &lex->check_opt);
1654
1628
    select_lex->table_list.first= (unsigned char*) first_table;
1655
1629
    lex->query_tables=all_tables;
1658
1632
  case SQLCOM_ANALYZE:
1659
1633
  {
1660
1634
    assert(first_table == all_tables && first_table != 0);
1661
 
    thd->enable_slow_log= opt_log_slow_admin_statements;
1662
1635
    res= mysql_analyze_table(thd, first_table, &lex->check_opt);
1663
1636
    /* ! we write after unlocking the table */
1664
1637
    write_bin_log(thd, true, thd->query, thd->query_length);
1670
1643
  case SQLCOM_OPTIMIZE:
1671
1644
  {
1672
1645
    assert(first_table == all_tables && first_table != 0);
1673
 
    thd->enable_slow_log= opt_log_slow_admin_statements;
1674
1646
    res= mysql_optimize_table(thd, first_table, &lex->check_opt);
1675
1647
    /* ! we write after unlocking the table */
1676
1648
    write_bin_log(thd, true, thd->query, thd->query_length);
1893
1865
    if (add_item_to_list(thd, new Item_null()))
1894
1866
      goto error;
1895
1867
 
1896
 
    thd_proc_info(thd, "init");
 
1868
    thd->set_proc_info("init");
1897
1869
    if ((res= open_and_lock_tables(thd, all_tables)))
1898
1870
      break;
1899
1871
 
2396
2368
    my_ok(thd);
2397
2369
    break;
2398
2370
  }
2399
 
  thd_proc_info(thd, "query end");
 
2371
  thd->set_proc_info("query end");
2400
2372
 
2401
2373
  /*
2402
2374
    Binlog-related cleanup:
2825
2797
      assert(thd->is_error());
2826
2798
    }
2827
2799
    lex->unit.cleanup();
2828
 
    thd_proc_info(thd, "freeing items");
 
2800
    thd->set_proc_info("freeing items");
2829
2801
    thd->end_statement();
2830
2802
    thd->cleanup_after_query();
2831
2803
    assert(thd->change_list.is_empty());