~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_error.cc

  • Committer: Monty Taylor
  • Date: 2011-01-26 19:15:55 UTC
  • mto: This revision was merged to the branch mainline in revision 2126.
  • Revision ID: mordred@inaugust.com-20110126191555-nq5nnzyscvngsip2
Turns on -fvisibility=hidden by default. Symbols intended to be used by
plugins need to be marked with DRIZZLED_API.

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