~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/session_dictionary/processlist.cc

  • Committer: Brian Aker
  • Date: 2010-12-08 18:58:56 UTC
  • mfrom: (1976.5.4 real-trunk)
  • Revision ID: brian@tangent.org-20101208185856-577lkcj42ss9xg7s
MErge in fix for session

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
 
66
66
  while ((tmp= session_generator))
67
67
  {
 
68
    drizzled::Session::State::const_shared_ptr state(tmp->state());
68
69
    const SecurityContext *tmp_sctx= &tmp->getSecurityContext();
69
 
    const char *val;
70
70
 
71
71
    /* ID */
72
72
    push((int64_t) tmp->thread_id);
73
73
 
74
 
 
75
74
    /* USER */
76
75
    if (not tmp_sctx->getUser().empty())
77
76
      push(tmp_sctx->getUser());
82
81
    push(tmp_sctx->getIp());
83
82
 
84
83
    /* DB */
85
 
    if (! tmp->db.empty())
 
84
    drizzled::util::string::const_shared_ptr schema(tmp->schema());
 
85
    if (schema and not schema->empty())
86
86
    {
87
 
      push(tmp->db);
 
87
      push(*schema);
88
88
    }
89
89
    else
90
90
    {
92
92
    }
93
93
 
94
94
    /* COMMAND */
95
 
    if ((val= const_cast<char *>(tmp->getKilled() == Session::KILL_CONNECTION ? "Killed" : 0)))
 
95
    const char *val= tmp->getKilled() == Session::KILL_CONNECTION ? "Killed" : NULL;
 
96
    if (val)
96
97
    {
97
98
      push(val);
98
99
    }
105
106
    push(static_cast<uint64_t>(tmp->start_time ?  now - tmp->start_time : 0));
106
107
 
107
108
    /* STATE */
108
 
    val= (char*) (tmp->client->isWriting() ?
109
 
                  "Writing to net" :
110
 
                  tmp->client->isReading() ?
111
 
                  (tmp->command == COM_SLEEP ?
112
 
                   NULL : "Reading from net") :
113
 
                  tmp->get_proc_info() ? tmp->get_proc_info() :
114
 
                  tmp->getThreadVar() &&
115
 
                  tmp->getThreadVar()->current_cond ?
116
 
                  "Waiting on cond" : NULL);
 
109
    val= (tmp->client->isWriting() ?
 
110
          "Writing to net" :
 
111
          tmp->client->isReading() ?
 
112
          (tmp->command == COM_SLEEP ?
 
113
           NULL : "Reading from net") :
 
114
          tmp->get_proc_info() ? tmp->get_proc_info() :
 
115
          tmp->getThreadVar() &&
 
116
          tmp->getThreadVar()->current_cond ?
 
117
          "Waiting on cond" : NULL);
117
118
    val ? push(val) : push();
118
119
 
119
120
    /* INFO */
120
 
    push(*tmp->getQueryString());
 
121
    if (state)
 
122
    {
 
123
      size_t length;
 
124
      const char *tmp_ptr= state->query(length);
 
125
      push(tmp_ptr, length);
 
126
    }
 
127
    else
 
128
    {
 
129
      push();
 
130
    }
121
131
 
122
132
    /* HAS_GLOBAL_LOCK */
123
133
    bool has_global_lock= tmp->isGlobalReadLock();