~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Mark Atwood
  • Date: 2011-10-07 05:07:22 UTC
  • mfrom: (2429.1.1 drizzle-build)
  • Revision ID: me@mark.atwood.name-20111007050722-eigkrbzyepmg900c
mergeĀ lp:~brianaker/drizzle/remove-copy-schema-test-pl

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include <drizzled/statement.h>
35
35
#include <drizzled/sql_lex.h>
36
36
#include <drizzled/plugin.h>
 
37
#include <drizzled/lex_input_stream.h>
37
38
 
38
39
#include <cstdio>
39
40
#include <ctype.h>
297
298
  lex_string_t tmp;
298
299
  lip->yyUnget();                       // ptr points now after last token char
299
300
  tmp.length=lip->yytoklen=length;
300
 
  tmp.str= lip->m_session->mem.strmake(lip->get_tok_start() + skip, tmp.length);
 
301
  tmp.str= lip->m_session->mem.strdup(lip->get_tok_start() + skip, tmp.length);
301
302
 
302
303
  lip->m_cpp_text_start= lip->get_cpp_tok_start() + skip;
303
304
  lip->m_cpp_text_end= lip->m_cpp_text_start + tmp.length;
316
317
                                   uint32_t length, char quote)
317
318
{
318
319
  lex_string_t tmp;
319
 
  const char *from, *end;
320
 
  char *to;
321
320
  lip->yyUnget();                       // ptr points now after last token char
322
321
  tmp.length= lip->yytoklen=length;
323
322
  tmp.str=(char*) lip->m_session->mem.alloc(tmp.length+1);
324
 
  from= lip->get_tok_start() + skip;
325
 
  to= tmp.str;
326
 
  end= to+length;
 
323
  const char* from= lip->get_tok_start() + skip;
 
324
  char* to= (char*)tmp.str;
 
325
  const char* end= to+length;
327
326
 
328
327
  lip->m_cpp_text_start= lip->get_cpp_tok_start() + skip;
329
328
  lip->m_cpp_text_end= lip->m_cpp_text_start + length;
1820
1819
  reset_query_tables_list(true);
1821
1820
}
1822
1821
 
1823
 
/**
1824
 
  This method should be called only during parsing.
1825
 
  It is aware of compound statements (stored routine bodies)
1826
 
  and will initialize the destination with the default
1827
 
  database of the stored routine, rather than the default
1828
 
  database of the connection it is parsed in.
1829
 
  E.g. if one has no current database selected, or current database
1830
 
  set to 'bar' and then issues:
1831
 
 
1832
 
  CREATE PROCEDURE foo.p1() BEGIN SELECT * FROM t1 END//
1833
 
 
1834
 
  t1 is meant to refer to foo.t1, not to bar.t1.
1835
 
 
1836
 
  This method is needed to support this rule.
1837
 
 
1838
 
  @return true in case of error (parsing should be aborted, false in
1839
 
  case of success
1840
 
*/
1841
 
bool LEX::copy_db_to(char **p_db, size_t *p_db_length) const
1842
 
{
1843
 
  return session->copy_db_to(p_db, p_db_length);
1844
 
}
1845
 
 
1846
1822
/*
1847
1823
  initialize limit counters
1848
1824
 
2054
2030
    Then the context variable index_hint_type can be reset to the
2055
2031
    next hint type.
2056
2032
*/
2057
 
void Select_Lex::set_index_hint_type(enum index_hint_type type_arg, index_clause_map clause)
 
2033
void Select_Lex::set_index_hint_type(index_hint_type type_arg, index_clause_map clause)
2058
2034
{
2059
2035
  current_index_hint_type= type_arg;
2060
2036
  current_index_hint_clause= clause;
2085
2061
  RETURN VALUE
2086
2062
    0 on success, non-zero otherwise
2087
2063
*/
2088
 
void Select_Lex::add_index_hint(Session *session, char *str, uint32_t length)
 
2064
void Select_Lex::add_index_hint(Session *session, const char *str)
2089
2065
{
2090
 
  index_hints->push_front(new (session->mem_root) Index_hint(current_index_hint_type, current_index_hint_clause, str, length));
 
2066
  index_hints->push_front(new (session->mem_root) Index_hint(current_index_hint_type, current_index_hint_clause, str));
2091
2067
}
2092
2068
 
2093
2069
message::AlterTable *LEX::alter_table()