~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/diagnostics_area.cc

  • Committer: Brian Aker
  • Date: 2009-05-23 17:13:03 UTC
  • mfrom: (1034.1.8 merge)
  • Revision ID: brian@gaz-20090523171303-d28xhutqic0xe2b4
Merge Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
 
20
#include "drizzled/global.h"
21
21
#include "drizzled/session.h"
22
22
#include "drizzled/diagnostics_area.h"
23
23
 
24
 
namespace drizzled
25
 
{
26
 
 
27
24
/**
28
25
  Clear this diagnostics area.
29
26
 
37
34
  m_sql_errno= 0;
38
35
  m_server_status= 0;
39
36
  m_affected_rows= 0;
40
 
  m_found_rows= 0;
41
37
  m_last_insert_id= 0;
42
38
  m_total_warn_count= 0;
43
39
  is_sent= false;
45
41
  m_status= DA_EMPTY;
46
42
}
47
43
 
48
 
const char *Diagnostics_area::message() const
49
 
{
50
 
  assert(m_status == DA_ERROR || m_status == DA_OK);
51
 
  return m_message;
52
 
}
53
 
 
54
 
 
55
 
uint32_t Diagnostics_area::sql_errno() const
56
 
{
57
 
  assert(m_status == DA_ERROR);
58
 
  return m_sql_errno;
59
 
}
60
 
 
61
 
uint32_t Diagnostics_area::server_status() const
62
 
{
63
 
  assert(m_status == DA_OK || m_status == DA_EOF);
64
 
  return m_server_status;
65
 
}
66
 
 
67
 
ha_rows Diagnostics_area::affected_rows() const
68
 
{ assert(m_status == DA_OK); return m_affected_rows; }
69
 
 
70
 
ha_rows Diagnostics_area::found_rows() const
71
 
{ assert(m_status == DA_OK); return m_found_rows; }
72
 
 
73
 
uint64_t Diagnostics_area::last_insert_id() const
74
 
{ assert(m_status == DA_OK); return m_last_insert_id; }
75
 
 
76
 
uint32_t Diagnostics_area::total_warn_count() const
77
 
{
78
 
  assert(m_status == DA_OK || m_status == DA_EOF);
79
 
  return m_total_warn_count;
80
 
}
81
 
 
82
44
/**
83
45
  Set OK status -- ends commands that do not return a
84
46
  result set, e.g. INSERT/UPDATE/DELETE.
85
47
*/
86
 
void Diagnostics_area::set_ok_status(Session *session,
87
 
                                     ha_rows affected_rows_arg,
88
 
                                     ha_rows found_rows_arg,
89
 
                                     uint64_t last_insert_id_arg,
90
 
                                     const char *message_arg)
 
48
void Diagnostics_area::set_ok_status(Session *session, ha_rows affected_rows_arg,
 
49
                                uint64_t last_insert_id_arg,
 
50
                                const char *message_arg)
91
51
{
92
52
  assert(! is_set());
93
53
  /*
101
61
  m_server_status= session->server_status;
102
62
  m_total_warn_count= session->total_warn_count;
103
63
  m_affected_rows= affected_rows_arg;
104
 
  m_found_rows= found_rows_arg;
105
64
  m_last_insert_id= last_insert_id_arg;
106
65
  if (message_arg)
107
66
    strncpy(m_message, message_arg, sizeof(m_message) - 1);
173
132
  assert(! is_set());
174
133
  m_status= DA_DISABLED;
175
134
}
176
 
 
177
 
} /* namespace drizzled */