~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_error.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
 
42
42
***********************************************************************/
43
43
 
44
 
#include "config.h"
 
44
#include <config.h>
45
45
 
46
46
#include <cstdio>
47
47
#include <stdarg.h>
51
51
#include <drizzled/item/empty_string.h>
52
52
#include <drizzled/item/return_int.h>
53
53
#include <drizzled/plugin/client.h>
 
54
#include <drizzled/sql_lex.h>
 
55
#include <drizzled/system_variables.h>
 
56
#include <drizzled/diagnostics_area.h>
54
57
 
55
58
using namespace std;
56
59
 
57
 
namespace drizzled
58
 
{
 
60
namespace drizzled {
59
61
 
60
62
/*
61
63
  Store a new message in an error object
91
93
    memset(session->warn_count, 0, sizeof(session->warn_count));
92
94
    if (force)
93
95
      session->total_warn_count= 0;
94
 
    session->warn_list.empty();
 
96
    session->main_da().m_warn_list.clear();
95
97
    session->row_count= 1; // by default point to row 1
96
98
  }
97
 
  return;
98
99
}
99
100
 
100
101
 
115
116
DRIZZLE_ERROR *push_warning(Session *session, DRIZZLE_ERROR::enum_warning_level level,
116
117
                            drizzled::error_t code, const char *msg)
117
118
{
118
 
  DRIZZLE_ERROR *err= 0;
119
 
 
120
119
  if (level == DRIZZLE_ERROR::WARN_LEVEL_NOTE && !(session->options & OPTION_SQL_NOTES))
121
120
  {
122
121
    return NULL;
143
142
    level= DRIZZLE_ERROR::WARN_LEVEL_ERROR;
144
143
  }
145
144
 
146
 
  if (session->handle_error(code, msg, level))
147
 
    return NULL;
148
 
 
149
 
  if (session->warn_list.elements < session->variables.max_error_count)
 
145
  DRIZZLE_ERROR *err= NULL;
 
146
  if (session->main_da().m_warn_list.size() < session->variables.max_error_count)
150
147
  {
151
148
    /* We have to use warn_root, as mem_root is freed after each query */
152
 
    if ((err= new (&session->warn_root) DRIZZLE_ERROR(session, code, level, msg)))
153
 
    {
154
 
      session->warn_list.push_back(err, &session->warn_root);
155
 
    }
 
149
    err= new (&session->warn_root) DRIZZLE_ERROR(session, code, level, msg);
 
150
    session->main_da().m_warn_list.push_back(err, &session->warn_root);
156
151
  }
157
152
  session->warn_count[(uint32_t) level]++;
158
153
  session->total_warn_count++;
220
215
  if (session->getClient()->sendFields(&field_list))
221
216
    return true;
222
217
 
223
 
  DRIZZLE_ERROR *err;
224
 
  Select_Lex *sel= &session->lex->select_lex;
225
 
  Select_Lex_Unit *unit= &session->lex->unit;
 
218
  Select_Lex *sel= &session->lex().select_lex;
 
219
  Select_Lex_Unit *unit= &session->lex().unit;
226
220
  ha_rows idx= 0;
227
221
 
228
222
  unit->set_limit(sel);
229
223
 
230
 
  List_iterator_fast<DRIZZLE_ERROR> it(session->warn_list);
231
 
  while ((err= it++))
 
224
  List<DRIZZLE_ERROR>::iterator it(session->main_da().m_warn_list.begin());
 
225
  while (DRIZZLE_ERROR* err= it++)
232
226
  {
233
227
    /* Skip levels that the user is not interested in */
234
228
    if (! levels_to_show.test(err->level))