~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Lee Bieber
  • Date: 2011-04-18 21:48:09 UTC
  • mfrom: (2280.2.3 build)
  • Revision ID: kalebral@gmail.com-20110418214809-dsdfrc8f90a9p2x1
Merge Olaf - code refactor and pruning dead functions

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
  m_cpp_ptr= m_cpp_buf;
109
109
}
110
110
 
111
 
Lex_input_stream::~Lex_input_stream()
112
 
{}
113
 
 
114
 
/**
115
 
  The operation is called from the parser in order to
116
 
  1) designate the intention to have utf8 body;
117
 
  1) Indicate to the lexer that we will need a utf8 representation of this
118
 
     statement;
119
 
  2) Determine the beginning of the body.
120
 
 
121
 
  @param session        Thread context.
122
 
  @param begin_ptr  Pointer to the start of the body in the pre-processed
123
 
                    buffer.
124
 
*/
125
 
void Lex_input_stream::body_utf8_start(Session *session, const char *begin_ptr)
126
 
{
127
 
  assert(begin_ptr);
128
 
  assert(m_cpp_buf <= begin_ptr && begin_ptr <= m_cpp_buf + m_buf_length);
129
 
 
130
 
  uint32_t body_utf8_length=
131
 
    (m_buf_length / default_charset_info->mbminlen) *
132
 
    my_charset_utf8_bin.mbmaxlen;
133
 
 
134
 
  m_body_utf8= (char *) session->getMemRoot()->allocate(body_utf8_length + 1);
135
 
  m_body_utf8_ptr= m_body_utf8;
136
 
  *m_body_utf8_ptr= 0;
137
 
 
138
 
  m_cpp_utf8_processed_ptr= begin_ptr;
139
 
}
140
 
 
141
111
/**
142
112
  @brief The operation appends unprocessed part of pre-processed buffer till
143
113
  the given pointer (ptr) and sets m_cpp_utf8_processed_ptr to end_ptr.
333
303
  return 0;
334
304
}
335
305
 
336
 
bool is_lex_native_function(const LEX_STRING *name)
337
 
{
338
 
  assert(name != NULL);
339
 
  return (lookup_symbol(name->str, name->length, 1) != 0);
340
 
}
341
 
 
342
306
/* make a copy of token before ptr and set yytoklen */
343
307
static LEX_STRING get_token(Lex_input_stream *lip, uint32_t skip, uint32_t length)
344
308
{
1303
1267
  }
1304
1268
}
1305
1269
 
1306
 
void trim_whitespace(const charset_info_st * const cs, LEX_STRING *str)
1307
 
{
1308
 
  /*
1309
 
    TODO:
1310
 
    This code assumes that there are no multi-bytes characters
1311
 
    that can be considered white-space.
1312
 
  */
1313
 
  while ((str->length > 0) && (my_isspace(cs, str->str[0])))
1314
 
  {
1315
 
    str->length--;
1316
 
    str->str++;
1317
 
  }
1318
 
 
1319
 
  /*
1320
 
    FIXME:
1321
 
    Also, parsing backward is not safe with multi bytes characters
1322
 
  */
1323
 
  while ((str->length > 0) && (my_isspace(cs, str->str[str->length-1])))
1324
 
  {
1325
 
    str->length--;
1326
 
  }
1327
 
}
1328
 
 
1329
1270
/*
1330
1271
  Select_Lex structures initialisations
1331
1272
*/
2174
2115
  index_hints->push_front(new (session->mem_root) Index_hint(current_index_hint_type, current_index_hint_clause, str, length));
2175
2116
}
2176
2117
 
2177
 
bool check_for_sql_keyword(drizzled::lex_string_t const& string)
2178
 
{
2179
 
  return sql_reserved_words::in_word_set(string.str, string.length);
2180
 
}
2181
 
 
2182
 
bool check_for_sql_keyword(drizzled::st_lex_symbol const& string)
2183
 
{
2184
 
  return sql_reserved_words::in_word_set(string.str, string.length);
2185
 
}
2186
 
 
2187
2118
message::AlterTable *LEX::alter_table()
2188
2119
{
2189
2120
  if (not _alter_table)