~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_parse.cc

MergedĀ trunkĀ up.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
  { C_STRING_WITH_LEN("Drop DB") },
39
39
  { C_STRING_WITH_LEN("Refresh") },
40
40
  { C_STRING_WITH_LEN("Shutdown") },
41
 
  { C_STRING_WITH_LEN("Statistics") },
42
41
  { C_STRING_WITH_LEN("Processlist") },
43
42
  { C_STRING_WITH_LEN("Connect") },
44
43
  { C_STRING_WITH_LEN("Kill") },
526
525
 
527
526
  switch( command ) {
528
527
  /* Ignore these statements. */
529
 
  case COM_STATISTICS:
530
528
  case COM_PING:
531
529
    break;
532
530
  /* Increase id and count all other statements. */
826
824
    error=true;
827
825
    break;
828
826
  }
829
 
  case COM_STATISTICS:
830
 
  {
831
 
    STATUS_VAR current_global_status_var;
832
 
    ulong uptime;
833
 
    uint length;
834
 
    uint64_t queries_per_second1000;
835
 
    char buff[250];
836
 
    uint buff_len= sizeof(buff);
837
 
 
838
 
    general_log_print(thd, command, NullS);
839
 
    status_var_increment(thd->status_var.com_stat[SQLCOM_SHOW_STATUS]);
840
 
    calc_sum_of_all_status(&current_global_status_var);
841
 
    if (!(uptime= (ulong) (thd->start_time - server_start_time)))
842
 
      queries_per_second1000= 0;
843
 
    else
844
 
      queries_per_second1000= thd->query_id * 1000LL / uptime;
845
 
 
846
 
    length= snprintf((char*) buff, buff_len - 1,
847
 
                     "Uptime: %lu  Threads: %d  Questions: %lu  "
848
 
                     "Slow queries: %lu  Opens: %lu  Flush tables: %lu  "
849
 
                     "Open tables: %u  Queries per second avg: %u.%u",
850
 
                     uptime,
851
 
                     (int) thread_count, (ulong) thd->query_id,
852
 
                     current_global_status_var.long_query_count,
853
 
                     current_global_status_var.opened_tables,
854
 
                     refresh_version,
855
 
                     cached_open_tables(),
856
 
                     (uint) (queries_per_second1000 / 1000),
857
 
                     (uint) (queries_per_second1000 % 1000));
858
 
    VOID(my_net_write(net, (uchar*) buff, length));
859
 
    VOID(net_flush(net));
860
 
    thd->main_da.disable_status();
861
 
    break;
862
 
  }
863
827
  case COM_PING:
864
828
    status_var_increment(thd->status_var.com_other);
865
829
    my_ok(thd);                         // Tell client we are alive