~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Brian Aker
  • Date: 2009-08-18 07:20:29 UTC
  • mfrom: (1117.1.9 merge)
  • Revision ID: brian@gaz-20090818072029-s9ch5lcmltxwidn7
Merge of Brian

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
 
12
12
   You should have received a copy of the GNU General Public License
13
13
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA */
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
 
17
17
/* A lexical scanner on a temporary buffer with a yacc interface */
18
18
 
19
 
#include <config.h>
20
 
 
21
19
#define DRIZZLE_LEX 1
22
 
 
23
 
#include <drizzled/sql_reserved_words.h>
24
 
 
25
 
#include <drizzled/configmake.h>
26
 
#include <drizzled/item/num.h>
27
 
#include <drizzled/error.h>
28
 
#include <drizzled/session.h>
29
 
#include <drizzled/sql_base.h>
30
 
#include <drizzled/lookup_symbol.h>
31
 
#include <drizzled/index_hint.h>
32
 
#include <drizzled/select_result.h>
33
 
 
34
 
#include <cstdio>
 
20
#include "drizzled/server_includes.h"
 
21
#include "drizzled/item/num.h"
 
22
#include "drizzled/error.h"
 
23
#include "drizzled/session.h"
 
24
#include "drizzled/sql_base.h"
 
25
#include "drizzled/lookup_symbol.h"
 
26
#include "drizzled/index_hint.h"
 
27
 
35
28
#include <ctype.h>
36
29
 
37
 
union ParserType;
38
 
 
39
30
using namespace std;
40
31
 
41
 
/* Stay outside of the namespace because otherwise bison goes nuts */
42
 
int base_sql_lex(ParserType *arg, drizzled::Session *yysession);
43
 
 
44
 
namespace drizzled
45
 
{
46
 
 
47
 
static int lex_one_token(ParserType *arg, drizzled::Session *yysession);
 
32
static int lex_one_token(void *arg, void *yysession);
 
33
int DRIZZLElex(void *arg, void *yysession);
48
34
 
49
35
/**
50
36
  save order by and tables in own lists.
51
37
*/
52
38
static bool add_to_list(Session *session, SQL_LIST &list, Item *item, bool asc)
53
39
{
54
 
  Order *order;
55
 
 
56
 
  if (!(order = (Order *) session->getMemRoot()->allocate(sizeof(Order))))
57
 
    return true;
58
 
 
 
40
  order_st *order;
 
41
  if (!(order = (order_st *) session->alloc(sizeof(order_st))))
 
42
    return(1);
59
43
  order->item_ptr= item;
60
44
  order->item= &order->item_ptr;
61
45
  order->asc = asc;
62
46
  order->free_me=0;
63
47
  order->used=0;
64
48
  order->counter_used= 0;
65
 
  list.link_in_list((unsigned char*) order, (unsigned char**) &order->next);
66
 
 
67
 
  return false;
 
49
  list.link_in_list((unsigned char*) order,(unsigned char**) &order->next);
 
50
  return(0);
68
51
}
69
52
 
 
53
 
 
54
 
 
55
/*
 
56
  We are using pointer to this variable for distinguishing between assignment
 
57
  to NEW row field (when parsing trigger definition) and structured variable.
 
58
*/
 
59
sys_var *trg_new_row_fake_var= (sys_var*) 0x01;
 
60
 
70
61
/**
71
62
  LEX_STRING constant for null-string to be used in parser and other places.
72
63
*/
74
65
 
75
66
Lex_input_stream::Lex_input_stream(Session *session,
76
67
                                   const char* buffer,
77
 
                                   unsigned int length) :
78
 
  m_session(session),
 
68
                                   unsigned int length)
 
69
: m_session(session),
79
70
  yylineno(1),
80
71
  yytoklen(0),
81
72
  yylval(NULL),
95
86
  m_body_utf8(NULL),
96
87
  m_cpp_utf8_processed_ptr(NULL),
97
88
  next_state(MY_LEX_START),
 
89
  found_semicolon(NULL),
98
90
  ignore_space(1),
99
91
  in_comment(NO_COMMENT)
100
92
{
101
 
  m_cpp_buf= (char*) session->getMemRoot()->allocate(length + 1);
 
93
  m_cpp_buf= (char*) session->alloc(length + 1);
102
94
  m_cpp_ptr= m_cpp_buf;
103
95
}
104
96
 
125
117
    (m_buf_length / default_charset_info->mbminlen) *
126
118
    my_charset_utf8_bin.mbmaxlen;
127
119
 
128
 
  m_body_utf8= (char *) session->getMemRoot()->allocate(body_utf8_length + 1);
 
120
  m_body_utf8= (char *) session->alloc(body_utf8_length + 1);
129
121
  m_body_utf8_ptr= m_body_utf8;
130
122
  *m_body_utf8_ptr= 0;
131
123
 
216
208
  Because of this, it's critical to not do too much things here.
217
209
  (We already do too much here)
218
210
*/
219
 
void LEX::start(Session *arg)
220
 
{
221
 
  lex_start(arg);
222
 
}
223
 
 
224
211
void lex_start(Session *session)
225
212
{
226
 
  LEX *lex= session->getLex();
 
213
  LEX *lex= session->lex;
227
214
 
228
215
  lex->session= lex->unit.session= session;
229
216
 
230
 
  lex->context_stack.clear();
 
217
  lex->context_stack.empty();
231
218
  lex->unit.init_query();
232
219
  lex->unit.init_select();
233
220
  /* 'parent_lex' is used in init_query() so it must be before it. */
234
221
  lex->select_lex.parent_lex= lex;
235
222
  lex->select_lex.init_query();
236
 
  lex->value_list.clear();
237
 
  lex->update_list.clear();
238
 
  lex->auxiliary_table_list.clear();
 
223
  lex->value_list.empty();
 
224
  lex->update_list.empty();
 
225
  lex->param_list.empty();
 
226
  lex->auxiliary_table_list.empty();
239
227
  lex->unit.next= lex->unit.master=
240
228
    lex->unit.link_next= lex->unit.return_to= 0;
241
229
  lex->unit.prev= lex->unit.link_prev= 0;
247
235
  lex->select_lex.link_prev= (Select_Lex_Node**)&(lex->all_selects_list);
248
236
  lex->select_lex.options= 0;
249
237
  lex->select_lex.init_order();
250
 
  lex->select_lex.group_list.clear();
 
238
  lex->select_lex.group_list.empty();
251
239
  lex->describe= 0;
252
240
  lex->derived_tables= 0;
253
241
  lex->lock_option= TL_READ;
254
242
  lex->leaf_tables_insert= 0;
255
 
  lex->var_list.clear();
256
243
  lex->select_lex.select_number= 1;
257
244
  lex->length=0;
258
245
  lex->select_lex.in_sum_expr=0;
259
 
  lex->select_lex.group_list.clear();
260
 
  lex->select_lex.order_list.clear();
 
246
  lex->select_lex.group_list.empty();
 
247
  lex->select_lex.order_list.empty();
261
248
  lex->sql_command= SQLCOM_END;
262
249
  lex->duplicates= DUP_ERROR;
263
250
  lex->ignore= 0;
272
259
  lex->nest_level=0 ;
273
260
  lex->allow_sum_func= 0;
274
261
  lex->in_sum_func= NULL;
275
 
  lex->type= 0;
276
262
 
277
263
  lex->is_lex_started= true;
 
264
  lex->create_table_proto= NULL;
278
265
  lex->statement= NULL;
279
 
  
280
 
  lex->is_cross= false;
281
 
  lex->reset();
282
266
}
283
267
 
284
 
void LEX::end()
 
268
void lex_end(LEX *lex)
285
269
{
286
 
  if (yacc_yyss)
 
270
  if (lex->yacc_yyss)
287
271
  {
288
 
    free(yacc_yyss);
289
 
    free(yacc_yyvs);
290
 
    yacc_yyss= 0;
291
 
    yacc_yyvs= 0;
 
272
    free(lex->yacc_yyss);
 
273
    free(lex->yacc_yyvs);
 
274
    lex->yacc_yyss= 0;
 
275
    lex->yacc_yyvs= 0;
292
276
  }
293
277
 
294
 
  safe_delete(result);
295
 
  safe_delete(_create_table);
296
 
  _create_table= NULL;
297
 
  _create_field= NULL;
298
 
 
299
 
  result= 0;
300
 
  setCacheable(true);
301
 
 
302
 
  safe_delete(statement);
 
278
  delete lex->result;
 
279
 
 
280
  if(lex->create_table_proto)
 
281
    delete lex->create_table_proto;
 
282
  lex->result= 0;
 
283
 
 
284
  if (lex->statement) 
 
285
    delete lex->statement;
303
286
}
304
287
 
305
288
static int find_keyword(Lex_input_stream *lip, uint32_t len, bool function)
360
343
  char *to;
361
344
  lip->yyUnget();                       // ptr points now after last token char
362
345
  tmp.length= lip->yytoklen=length;
363
 
  tmp.str=(char*) lip->m_session->getMemRoot()->allocate(tmp.length+1);
 
346
  tmp.str=(char*) lip->m_session->alloc(tmp.length+1);
364
347
  from= lip->get_tok_start() + skip;
365
348
  to= tmp.str;
366
349
  end= to+length;
387
370
*/
388
371
static char *get_text(Lex_input_stream *lip, int pre_skip, int post_skip)
389
372
{
390
 
  unsigned char c,sep;
 
373
  register unsigned char c,sep;
391
374
  bool found_escape= false;
392
375
  const CHARSET_INFO * const cs= lip->m_session->charset();
393
376
 
436
419
      end-= post_skip;
437
420
      assert(end >= str);
438
421
 
439
 
      if (!(start= (char*) lip->m_session->getMemRoot()->allocate((uint32_t) (end-str)+1)))
440
 
        return (char*) "";              // memory::SqlAlloc has set error flag
 
422
      if (!(start= (char*) lip->m_session->alloc((uint32_t) (end-str)+1)))
 
423
        return (char*) "";              // Sql_alloc has set error flag
441
424
 
442
425
      lip->m_cpp_text_start= lip->get_cpp_tok_start() + pre_skip;
443
426
      lip->m_cpp_text_end= lip->get_cpp_ptr() - post_skip;
600
583
  return ((unsigned char) str[-1] <= (unsigned char) cmp[-1]) ? smaller : bigger;
601
584
}
602
585
 
603
 
} /* namespace drizzled */
604
586
/*
605
 
  base_sql_lex remember the following states from the following sql_baselex()
 
587
  DRIZZLElex remember the following states from the following DRIZZLElex()
606
588
 
607
589
  - MY_LEX_EOQ                  Found end of query
608
590
  - MY_LEX_OPERATOR_OR_IDENT    Last state was an ident, text or number
609
591
                                (which can't be followed by a signed number)
610
592
*/
611
 
int base_sql_lex(union ParserType *yylval, drizzled::Session *session)
 
593
int DRIZZLElex(void *arg, void *yysession)
612
594
{
613
 
  drizzled::Lex_input_stream *lip= session->m_lip;
 
595
  Session *session= (Session *)yysession;
 
596
  Lex_input_stream *lip= session->m_lip;
 
597
  YYSTYPE *yylval=(YYSTYPE*) arg;
614
598
  int token;
615
599
 
616
600
  if (lip->lookahead_token != END_OF_INPUT)
626
610
    return token;
627
611
  }
628
612
 
629
 
  token= drizzled::lex_one_token(yylval, session);
 
613
  token= lex_one_token(arg, yysession);
630
614
 
631
615
  switch(token) {
632
616
  case WITH:
637
621
      to transform the grammar into a LALR(1) grammar,
638
622
      which sql_yacc.yy can process.
639
623
    */
640
 
    token= drizzled::lex_one_token(yylval, session);
 
624
    token= lex_one_token(arg, yysession);
641
625
    if (token == ROLLUP_SYM)
642
626
    {
643
627
      return WITH_ROLLUP_SYM;
659
643
  return token;
660
644
}
661
645
 
662
 
namespace drizzled
663
 
{
664
 
 
665
 
int lex_one_token(ParserType *yylval, drizzled::Session *session)
666
 
{
667
 
  unsigned char c= 0; /* Just set to shutup GCC */
 
646
int lex_one_token(void *arg, void *yysession)
 
647
{
 
648
  register unsigned char c= 0; /* Just set to shutup GCC */
668
649
  bool comment_closed;
669
650
  int   tokval, result_state;
670
651
  unsigned int length;
671
652
  enum my_lex_states state;
 
653
  Session *session= (Session *)yysession;
672
654
  Lex_input_stream *lip= session->m_lip;
673
 
  LEX *lex= session->getLex();
 
655
  LEX *lex= session->lex;
 
656
  YYSTYPE *yylval=(YYSTYPE*) arg;
674
657
  const CHARSET_INFO * const cs= session->charset();
675
658
  unsigned char *state_map= cs->state_map;
676
659
  unsigned char *ident_map= cs->ident_map;
1282
1265
  }
1283
1266
}
1284
1267
 
 
1268
/**
 
1269
  Construct a copy of this object to be used for mysql_alter_table
 
1270
  and mysql_create_table.
 
1271
 
 
1272
  Historically, these two functions modify their Alter_info
 
1273
  arguments. This behaviour breaks re-execution of prepared
 
1274
  statements and stored procedures and is compensated by always
 
1275
  supplying a copy of Alter_info to these functions.
 
1276
 
 
1277
  @return You need to use check the error in Session for out
 
1278
  of memory condition after calling this function.
 
1279
*/
 
1280
Alter_info::Alter_info(const Alter_info &rhs, MEM_ROOT *mem_root)
 
1281
  :drop_list(rhs.drop_list, mem_root),
 
1282
  alter_list(rhs.alter_list, mem_root),
 
1283
  key_list(rhs.key_list, mem_root),
 
1284
  create_list(rhs.create_list, mem_root),
 
1285
  flags(rhs.flags),
 
1286
  keys_onoff(rhs.keys_onoff),
 
1287
  tablespace_op(rhs.tablespace_op),
 
1288
  no_parts(rhs.no_parts),
 
1289
  build_method(rhs.build_method),
 
1290
  datetime_field(rhs.datetime_field),
 
1291
  error_if_not_empty(rhs.error_if_not_empty)
 
1292
{
 
1293
  /*
 
1294
    Make deep copies of used objects.
 
1295
    This is not a fully deep copy - clone() implementations
 
1296
    of Alter_drop, Alter_column, Key, foreign_key, Key_part_spec
 
1297
    do not copy string constants. At the same length the only
 
1298
    reason we make a copy currently is that ALTER/CREATE TABLE
 
1299
    code changes input Alter_info definitions, but string
 
1300
    constants never change.
 
1301
  */
 
1302
  list_copy_and_replace_each_value(drop_list, mem_root);
 
1303
  list_copy_and_replace_each_value(alter_list, mem_root);
 
1304
  list_copy_and_replace_each_value(key_list, mem_root);
 
1305
  list_copy_and_replace_each_value(create_list, mem_root);
 
1306
}
 
1307
 
1285
1308
void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str)
1286
1309
{
1287
1310
  /*
1313
1336
  options= 0;
1314
1337
  linkage= UNSPECIFIED_TYPE;
1315
1338
  no_error= no_table_names_allowed= 0;
1316
 
  uncacheable.reset();
 
1339
  uncacheable= 0;
1317
1340
}
1318
1341
 
1319
1342
void Select_Lex_Node::init_select()
1334
1357
  table= 0;
1335
1358
  fake_select_lex= 0;
1336
1359
  cleaned= 0;
1337
 
  item_list.clear();
 
1360
  item_list.empty();
1338
1361
  describe= 0;
1339
1362
  found_rows_for_union= 0;
1340
1363
}
1342
1365
void Select_Lex::init_query()
1343
1366
{
1344
1367
  Select_Lex_Node::init_query();
1345
 
  table_list.clear();
1346
 
  top_join_list.clear();
 
1368
  table_list.empty();
 
1369
  top_join_list.empty();
1347
1370
  join_list= &top_join_list;
1348
1371
  embedding= leaf_tables= 0;
1349
 
  item_list.clear();
 
1372
  item_list.empty();
1350
1373
  join= 0;
1351
1374
  having= where= 0;
1352
1375
  olap= UNSPECIFIED_OLAP_TYPE;
1378
1401
 
1379
1402
void Select_Lex::init_select()
1380
1403
{
1381
 
  sj_nests.clear();
1382
 
  group_list.clear();
1383
 
  db= 0;
 
1404
  sj_nests.empty();
 
1405
  group_list.empty();
 
1406
  type= db= 0;
1384
1407
  having= 0;
 
1408
  table_join_options= 0;
1385
1409
  in_sum_expr= with_wild= 0;
1386
1410
  options= 0;
1387
1411
  braces= 0;
1388
 
  interval_list.clear();
 
1412
  interval_list.empty();
1389
1413
  inner_sum_func_list= 0;
1390
1414
  linkage= UNSPECIFIED_TYPE;
1391
1415
  order_list.elements= 0;
1395
1419
  select_limit= 0;      /* denotes the default limit = HA_POS_ERROR */
1396
1420
  offset_limit= 0;      /* denotes the default offset = 0 */
1397
1421
  with_sum_func= 0;
1398
 
  is_cross= false;
1399
1422
  is_correlated= 0;
1400
1423
  cur_pos_in_select_list= UNDEF_POS;
1401
 
  non_agg_fields.clear();
 
1424
  non_agg_fields.empty();
1402
1425
  cond_value= having_value= Item::COND_UNDEF;
1403
 
  inner_refs_list.clear();
 
1426
  inner_refs_list.empty();
1404
1427
  full_group_by_flag.reset();
1405
1428
}
1406
1429
 
1579
1602
       s && s != last;
1580
1603
       s= s->outer_select())
1581
1604
  {
1582
 
    if (! (s->uncacheable.test(UNCACHEABLE_DEPENDENT)))
 
1605
    if (!(s->uncacheable & UNCACHEABLE_DEPENDENT))
1583
1606
    {
1584
1607
      // Select is dependent of outer select
1585
 
      s->uncacheable.set(UNCACHEABLE_DEPENDENT);
1586
 
      s->uncacheable.set(UNCACHEABLE_UNITED);
 
1608
      s->uncacheable= (s->uncacheable & ~UNCACHEABLE_UNITED) |
 
1609
                       UNCACHEABLE_DEPENDENT;
1587
1610
      Select_Lex_Unit *munit= s->master_unit();
1588
 
      munit->uncacheable.set(UNCACHEABLE_UNITED);
1589
 
      munit->uncacheable.set(UNCACHEABLE_DEPENDENT);
 
1611
      munit->uncacheable= (munit->uncacheable & ~UNCACHEABLE_UNITED) |
 
1612
                       UNCACHEABLE_DEPENDENT;
1590
1613
      for (Select_Lex *sl= munit->first_select(); sl ; sl= sl->next_select())
1591
1614
      {
1592
1615
        if (sl != s &&
1593
 
            ! (sl->uncacheable.test(UNCACHEABLE_DEPENDENT) && sl->uncacheable.test(UNCACHEABLE_UNITED)))
1594
 
          sl->uncacheable.set(UNCACHEABLE_UNITED);
 
1616
            !(sl->uncacheable & (UNCACHEABLE_DEPENDENT | UNCACHEABLE_UNITED)))
 
1617
          sl->uncacheable|= UNCACHEABLE_UNITED;
1595
1618
      }
1596
1619
    }
1597
1620
    s->is_correlated= true;
1616
1639
List<Item>* Select_Lex_Node::get_item_list()
1617
1640
{ return NULL; }
1618
1641
 
1619
 
TableList *Select_Lex_Node::add_table_to_list(Session *, 
1620
 
                                              Table_ident *, 
1621
 
                                              LEX_STRING *, 
1622
 
                                              const bitset<NUM_OF_TABLE_OPTIONS>&,
1623
 
                                              thr_lock_type, 
1624
 
                                              List<Index_hint> *, 
1625
 
                                              LEX_STRING *)
 
1642
TableList *Select_Lex_Node::add_table_to_list (Session *, Table_ident *, LEX_STRING *, uint32_t,
 
1643
                                                  thr_lock_type, List<Index_hint> *, LEX_STRING *)
1626
1644
{
1627
1645
  return 0;
1628
1646
}
1629
1647
 
 
1648
uint32_t Select_Lex_Node::get_table_join_options()
 
1649
{
 
1650
  return 0;
 
1651
}
1630
1652
 
1631
1653
/*
1632
1654
  prohibit using LIMIT clause
1704
1726
  return &item_list;
1705
1727
}
1706
1728
 
 
1729
uint32_t Select_Lex::get_table_join_options()
 
1730
{
 
1731
  return table_join_options;
 
1732
}
1707
1733
 
1708
1734
bool Select_Lex::setup_ref_array(Session *session, uint32_t order_group_num)
1709
1735
{
1711
1737
    return false;
1712
1738
 
1713
1739
  return (ref_pointer_array=
1714
 
          (Item **)session->getMemRoot()->allocate(sizeof(Item*) * (n_child_sum_items +
 
1740
          (Item **)session->alloc(sizeof(Item*) * (n_child_sum_items +
1715
1741
                                                 item_list.elements +
1716
1742
                                                 select_n_having_items +
1717
1743
                                                 select_n_where_fields +
1744
1770
      str->append(STRING_WITH_LEN(" order by "));
1745
1771
      fake_select_lex->print_order(
1746
1772
        str,
1747
 
        (Order *) fake_select_lex->order_list.first,
 
1773
        (order_st *) fake_select_lex->order_list.first,
1748
1774
        query_type);
1749
1775
    }
1750
1776
    fake_select_lex->print_limit(session, str, query_type);
1752
1778
}
1753
1779
 
1754
1780
void Select_Lex::print_order(String *str,
1755
 
                                Order *order,
 
1781
                                order_st *order,
1756
1782
                                enum_query_type query_type)
1757
1783
{
1758
1784
  for (; order; order= order->next)
1811
1837
  }
1812
1838
}
1813
1839
 
1814
 
LEX::~LEX()
 
1840
/**
 
1841
  @brief Restore the LEX and Session in case of a parse error.
 
1842
 
 
1843
  This is a clean up call that is invoked by the Bison generated
 
1844
  parser before returning an error from DRIZZLEparse. If your
 
1845
  semantic actions manipulate with the global thread state (which
 
1846
  is a very bad practice and should not normally be employed) and
 
1847
  need a clean-up in case of error, and you can not use %destructor
 
1848
  rule in the grammar file itself, this function should be used
 
1849
  to implement the clean up.
 
1850
*/
 
1851
void LEX::cleanup_lex_after_parse_error(Session *)
1815
1852
{
1816
 
  delete _create_table;
1817
1853
}
1818
1854
 
1819
1855
/*
1863
1899
    statement parsing. On should use lex_start() function to prepare LEX
1864
1900
    for this.
1865
1901
*/
1866
 
LEX::LEX() :
1867
 
    result(0), 
1868
 
    yacc_yyss(0), 
1869
 
    yacc_yyvs(0),
1870
 
    session(NULL),
1871
 
    charset(NULL),
1872
 
    var_list(),
1873
 
    sql_command(SQLCOM_END), 
1874
 
    statement(NULL),
1875
 
    option_type(OPT_DEFAULT), 
1876
 
    is_lex_started(0),
1877
 
    cacheable(true),
1878
 
    sum_expr_used(false),
1879
 
    _create_table(NULL),
1880
 
    _create_field(NULL),
1881
 
    _exists(false)
 
1902
LEX::LEX()
 
1903
  :result(0), yacc_yyss(0), yacc_yyvs(0),
 
1904
   sql_command(SQLCOM_END), option_type(OPT_DEFAULT), is_lex_started(0)
1882
1905
{
1883
1906
  reset_query_tables_list(true);
 
1907
  create_table_proto= NULL;
 
1908
  statement= NULL;
 
1909
}
 
1910
 
 
1911
/*
 
1912
  Detect that we need only table structure of derived table/view
 
1913
 
 
1914
  SYNOPSIS
 
1915
    only_view_structure()
 
1916
 
 
1917
  RETURN
 
1918
    true yes, we need only structure
 
1919
    false no, we need data
 
1920
*/
 
1921
bool LEX::only_view_structure()
 
1922
{
 
1923
  switch (sql_command) {
 
1924
  case SQLCOM_SHOW_CREATE:
 
1925
  case SQLCOM_SHOW_TABLES:
 
1926
  case SQLCOM_SHOW_FIELDS:
 
1927
    return true;
 
1928
  default:
 
1929
    return false;
 
1930
  }
 
1931
}
 
1932
 
 
1933
/*
 
1934
  Should Items_ident be printed correctly
 
1935
 
 
1936
  SYNOPSIS
 
1937
    need_correct_ident()
 
1938
 
 
1939
  RETURN
 
1940
    true yes, we need only structure
 
1941
    false no, we need data
 
1942
*/
 
1943
bool LEX::need_correct_ident()
 
1944
{
 
1945
  switch(sql_command)
 
1946
  {
 
1947
  case SQLCOM_SHOW_CREATE:
 
1948
  case SQLCOM_SHOW_TABLES:
 
1949
    return true;
 
1950
  default:
 
1951
    return false;
 
1952
  }
1884
1953
}
1885
1954
 
1886
1955
/**
2068
2137
void LEX::cleanup_after_one_table_open()
2069
2138
{
2070
2139
  /*
2071
 
    session->getLex()->derived_tables & additional units may be set if we open
2072
 
    a view. It is necessary to clear session->getLex()->derived_tables flag
 
2140
    session->lex->derived_tables & additional units may be set if we open
 
2141
    a view. It is necessary to clear session->lex->derived_tables flag
2073
2142
    to prevent processing of derived tables during next openTablesLock
2074
2143
    if next table is a real table and cleanup & remove underlying units
2075
 
    NOTE: all units will be connected to session->getLex()->select_lex, because we
 
2144
    NOTE: all units will be connected to session->lex->select_lex, because we
2076
2145
    have not UNION on most upper level.
2077
2146
    */
2078
2147
  if (all_selects_list != &select_lex)
2155
2224
                                            current_index_hint_clause,
2156
2225
                                            str, length));
2157
2226
}
2158
 
 
2159
 
bool check_for_sql_keyword(drizzled::lex_string_t const& string)
2160
 
{
2161
 
  if (sql_reserved_words::in_word_set(string.str, string.length))
2162
 
      return true;
2163
 
 
2164
 
  return false;
2165
 
}
2166
 
 
2167
 
bool check_for_sql_keyword(drizzled::st_lex_symbol const& string)
2168
 
{
2169
 
  if (sql_reserved_words::in_word_set(string.str, string.length))
2170
 
      return true;
2171
 
 
2172
 
  return false;
2173
 
}
2174
 
 
2175
 
 
2176
 
} /* namespace drizzled */