~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Lee Bieber
  • Date: 2010-01-30 23:42:02 UTC
  • mto: This revision was merged to the branch mainline in revision 1282.
  • Revision ID: lbieber@lee-biebers-macbook-pro.local-20100130234202-sxmqfteqwiq15ptg
add target to japanese tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
/* A lexical scanner on a temporary buffer with a yacc interface */
18
18
 
 
19
#define DRIZZLE_LEX 1
19
20
#include "config.h"
20
 
#define DRIZZLE_LEX 1
21
21
#include "drizzled/configmake.h"
22
22
#include "drizzled/item/num.h"
23
23
#include "drizzled/error.h"
30
30
 
31
31
using namespace std;
32
32
 
33
 
/* Stay outside of the namespace because otherwise bison goes nuts */
 
33
static int lex_one_token(void *arg, void *yysession);
34
34
int DRIZZLElex(void *arg, void *yysession);
35
35
 
36
 
namespace drizzled
37
 
{
38
 
 
39
 
static int lex_one_token(void *arg, void *yysession);
40
 
 
41
36
/**
42
37
  save order by and tables in own lists.
43
38
*/
84
79
  m_body_utf8(NULL),
85
80
  m_cpp_utf8_processed_ptr(NULL),
86
81
  next_state(MY_LEX_START),
 
82
  found_semicolon(NULL),
87
83
  ignore_space(1),
88
84
  in_comment(NO_COMMENT)
89
85
{
576
572
  return ((unsigned char) str[-1] <= (unsigned char) cmp[-1]) ? smaller : bigger;
577
573
}
578
574
 
579
 
} /* namespace drizzled */
580
575
/*
581
576
  DRIZZLElex remember the following states from the following DRIZZLElex()
582
577
 
586
581
*/
587
582
int DRIZZLElex(void *arg, void *yysession)
588
583
{
589
 
  drizzled::Session *session= (drizzled::Session *)yysession;
590
 
  drizzled::Lex_input_stream *lip= session->m_lip;
 
584
  Session *session= (Session *)yysession;
 
585
  Lex_input_stream *lip= session->m_lip;
591
586
  YYSTYPE *yylval=(YYSTYPE*) arg;
592
587
  int token;
593
588
 
604
599
    return token;
605
600
  }
606
601
 
607
 
  token= drizzled::lex_one_token(arg, yysession);
 
602
  token= lex_one_token(arg, yysession);
608
603
 
609
604
  switch(token) {
610
605
  case WITH:
615
610
      to transform the grammar into a LALR(1) grammar,
616
611
      which sql_yacc.yy can process.
617
612
    */
618
 
    token= drizzled::lex_one_token(arg, yysession);
 
613
    token= lex_one_token(arg, yysession);
619
614
    if (token == ROLLUP_SYM)
620
615
    {
621
616
      return WITH_ROLLUP_SYM;
637
632
  return token;
638
633
}
639
634
 
640
 
namespace drizzled
641
 
{
642
 
 
643
635
int lex_one_token(void *arg, void *yysession)
644
636
{
645
637
  register unsigned char c= 0; /* Just set to shutup GCC */
1876
1868
*/
1877
1869
bool LEX::only_view_structure()
1878
1870
{
1879
 
  if (sql_command == SQLCOM_SHOW_CREATE)
 
1871
  switch (sql_command) {
 
1872
  case SQLCOM_SHOW_CREATE:
 
1873
  case SQLCOM_SHOW_TABLES:
 
1874
  case SQLCOM_SHOW_FIELDS:
1880
1875
    return true;
1881
 
 
1882
 
  return false;
 
1876
  default:
 
1877
    return false;
 
1878
  }
1883
1879
}
1884
1880
 
1885
1881
/*
1894
1890
*/
1895
1891
bool LEX::need_correct_ident()
1896
1892
{
1897
 
  if (sql_command== SQLCOM_SHOW_CREATE)
 
1893
  switch(sql_command)
 
1894
  {
 
1895
  case SQLCOM_SHOW_CREATE:
 
1896
  case SQLCOM_SHOW_TABLES:
1898
1897
    return true;
1899
 
 
1900
 
  return false;
 
1898
  default:
 
1899
    return false;
 
1900
  }
1901
1901
}
1902
1902
 
1903
1903
/**
2172
2172
                                            current_index_hint_clause,
2173
2173
                                            str, length));
2174
2174
}
2175
 
 
2176
 
} /* namespace drizzled */