~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/show.cc

MergedĀ build.

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
#include <algorithm>
61
61
 
62
62
using namespace std;
63
 
using namespace drizzled;
 
63
 
 
64
namespace drizzled
 
65
{
64
66
 
65
67
inline const char *
66
68
str_or_nil(const char *str)
70
72
 
71
73
static void store_key_options(String *packet, Table *table, KEY *key_info);
72
74
 
73
 
 
74
 
 
75
75
int wild_case_compare(const CHARSET_INFO * const cs, const char *str,const char *wildstr)
76
76
{
77
77
  register int flag;
78
78
  while (*wildstr)
79
79
  {
80
 
    while (*wildstr && *wildstr != wild_many && *wildstr != wild_one)
 
80
    while (*wildstr && *wildstr != internal::wild_many && *wildstr != internal::wild_one)
81
81
    {
82
 
      if (*wildstr == wild_prefix && wildstr[1])
 
82
      if (*wildstr == internal::wild_prefix && wildstr[1])
83
83
        wildstr++;
84
84
      if (my_toupper(cs, *wildstr++) != my_toupper(cs, *str++))
85
85
        return (1);
86
86
    }
87
87
    if (! *wildstr )
88
88
      return (*str != 0);
89
 
    if (*wildstr++ == wild_one)
 
89
    if (*wildstr++ == internal::wild_one)
90
90
    {
91
91
      if (! *str++)
92
92
        return (1);     /* One char; skip */
95
95
    {                                           /* Found '*' */
96
96
      if (! *wildstr)
97
97
        return (0);             /* '*' as last char: OK */
98
 
      flag=(*wildstr != wild_many && *wildstr != wild_one);
 
98
      flag=(*wildstr != internal::wild_many && *wildstr != internal::wild_one);
99
99
      do
100
100
      {
101
101
        if (flag)
102
102
        {
103
103
          char cmp;
104
 
          if ((cmp= *wildstr) == wild_prefix && wildstr[1])
 
104
          if ((cmp= *wildstr) == internal::wild_prefix && wildstr[1])
105
105
            cmp= wildstr[1];
106
106
          cmp= my_toupper(cs, cmp);
107
107
          while (*str && my_toupper(cs, *str) != cmp)
178
178
 
179
179
    file_name_len= filename_to_tablename(entry->filename.c_str(), uname,
180
180
                                         sizeof(uname));
181
 
    if (wild && wild_compare(uname, wild, 0))
 
181
    if (wild && internal::wild_compare(uname, wild, 0))
182
182
    {
183
183
      ++entry_iter;
184
184
      continue;
681
681
      table->s->getKeyBlockSize() != key_info->block_size)
682
682
  {
683
683
    packet->append(STRING_WITH_LEN(" KEY_BLOCK_SIZE="));
684
 
    end= int64_t10_to_str(key_info->block_size, buff, 10);
 
684
    end= internal::int64_t10_to_str(key_info->block_size, buff, 10);
685
685
    packet->append(buff, (uint32_t) (end - buff));
686
686
  }
687
687
 
708
708
  uint64_t thread_id;
709
709
  time_t start_time;
710
710
  uint32_t   command;
711
 
  string user, host, db, proc_info, state_info, query;
 
711
  string user;
 
712
  string host;
 
713
  string db;
 
714
  string proc_info;
 
715
  string state_info;
 
716
  string query;
712
717
  thread_info(uint64_t thread_id_arg,
713
718
              time_t start_time_arg,
714
719
              uint32_t command_arg,
724
729
  {}
725
730
};
726
731
 
727
 
void mysqld_list_processes(Session *session,const char *user, bool)
 
732
void mysqld_list_processes(Session *session, const char *user, bool)
728
733
{
729
734
  Item *field;
730
735
  List<Item> field_list;
751
756
    for(vector<Session*>::iterator it= getSessionList().begin(); it != getSessionList().end(); ++it)
752
757
    {
753
758
      tmp= *it;
754
 
      Security_context *tmp_sctx= &tmp->security_ctx;
755
 
      struct st_my_thread_var *mysys_var;
756
 
      if (tmp->client->isConnected() && (!user || (tmp_sctx->user.c_str() && !strcmp(tmp_sctx->user.c_str(), user))))
 
759
      const SecurityContext *tmp_sctx= &tmp->getSecurityContext();
 
760
      internal::st_my_thread_var *mysys_var;
 
761
      if (tmp->client->isConnected() && (not user || (not tmp_sctx->getUser().compare(user))))
757
762
      {
758
763
 
759
764
        if ((mysys_var= tmp->mysys_var))
779
784
        thread_infos.push_back(thread_info(tmp->thread_id,
780
785
                                           tmp->start_time,
781
786
                                           tmp->command,
782
 
                                           tmp_sctx->user.empty()
 
787
                                           tmp_sctx->getUser().empty()
783
788
                                             ? string("unauthenticated user")
784
 
                                             : tmp_sctx->user,
785
 
                                           tmp_sctx->ip,
 
789
                                             : tmp_sctx->getUser(),
 
790
                                           tmp_sctx->getIp(),
786
791
                                           tmp->db,
787
792
                                           tmp_proc_info,
788
793
                                           tmp_state_info,
1475
1480
    file_name= session->make_lex_string(file_name, (*it).c_str(),
1476
1481
                                        (*it).length(), true);
1477
1482
    const char* wild= lookup_field_vals->table_value.str;
1478
 
    if (wild && wild_compare((*it).c_str(), wild, 0))
 
1483
    if (wild && internal::wild_compare((*it).c_str(), wild, 0))
1479
1484
      continue;
1480
1485
 
1481
1486
    table_names.push_back(file_name);
2111
2116
  return false;
2112
2117
}
2113
2118
 
 
2119
} /* namespace drizzled */