~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_yacc.yy

  • Committer: Monty Taylor
  • Date: 2010-02-04 08:14:46 UTC
  • mfrom: (1277.2.1 build) (1280.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1283.
  • Revision ID: mordred@inaugust.com-20100204081446-ldh9m486va30uap6
Put everything in drizzled into drizzled namespace.
Put internal stuff into drizzled::internal namespace.
Removed some cruft.
Now every symbol that is shipped in a header is in the drizzled namespace
and everything in the server that's not shipped is labeled internal. woot. 
Removed a lot of the extra extern "C" stuff that was in there. Less ugliness for
internal callbacks now for Sun Studio.

Show diffs side-by-side

added added

removed removed

Lines of Context:
136
136
#include "drizzled/internal/m_string.h"
137
137
 
138
138
 
139
 
using namespace drizzled;
140
 
 
141
 
class Table_ident;
142
 
class Item;
143
 
class Item_num;
144
 
 
145
139
int yylex(void *yylval, void *yysession);
146
140
 
147
141
#define yyoverflow(A,B,C,D,E,F)               \
148
142
  {                                           \
149
143
    ulong val= *(F);                          \
150
 
    if (my_yyoverflow((B), (D), &val))        \
 
144
    if (drizzled::my_yyoverflow((B), (D), &val)) \
151
145
    {                                         \
152
146
      yyerror((char*) (A));                   \
153
147
      return 2;                               \
175
169
 
176
170
#define YYDEBUG 0
177
171
 
 
172
namespace drizzled
 
173
{
 
174
 
 
175
class Table_ident;
 
176
class Item;
 
177
class Item_num;
 
178
 
 
179
 
178
180
static bool check_reserved_words(LEX_STRING *name)
179
181
{
180
182
  if (!my_strcasecmp(system_charset_info, name->str, "GLOBAL") ||
395
397
  return false;
396
398
}
397
399
 
 
400
} /* namespace drizzled; */
 
401
 
 
402
using namespace drizzled;
398
403
%}
399
404
%union {
400
405
  int  num;
401
406
  ulong ulong_num;
402
407
  uint64_t ulonglong_number;
403
408
  int64_t longlong_number;
404
 
  LEX_STRING lex_str;
405
 
  LEX_STRING *lex_str_ptr;
406
 
  LEX_SYMBOL symbol;
407
 
  Table_ident *table;
 
409
  drizzled::LEX_STRING lex_str;
 
410
  drizzled::LEX_STRING *lex_str_ptr;
 
411
  drizzled::LEX_SYMBOL symbol;
 
412
  drizzled::Table_ident *table;
408
413
  char *simple_string;
409
 
  Item *item;
410
 
  Item_num *item_num;
411
 
  List<Item> *item_list;
412
 
  List<String> *string_list;
413
 
  String *string;
414
 
  Key_part_spec *key_part;
415
 
  const ::drizzled::plugin::Function *udf;
416
 
  TableList *table_list;
417
 
  struct sys_var_with_base variable;
418
 
  enum enum_var_type var_type;
419
 
  Key::Keytype key_type;
420
 
  enum ha_key_alg key_alg;
421
 
  enum row_type row_type;
422
 
  enum column_format_type column_format_type;
423
 
  enum ha_rkey_function ha_rkey_mode;
424
 
  enum enum_tx_isolation tx_isolation;
425
 
  enum Cast_target cast_type;
426
 
  const CHARSET_INFO *charset;
427
 
  thr_lock_type lock_type;
428
 
  interval_type interval, interval_time_st;
429
 
  enum enum_drizzle_timestamp_type date_time_type;
430
 
  Select_Lex *select_lex;
431
 
  chooser_compare_func_creator boolfunc2creator;
432
 
  struct st_lex *lex;
433
 
  struct p_elem_val *p_elem_value;
434
 
  enum index_hint_type index_hint;
435
 
  enum enum_filetype filetype;
436
 
  enum ha_build_method build_method;
437
 
  enum Foreign_key::fk_option m_fk_option;
 
414
  drizzled::Item *item;
 
415
  drizzled::Item_num *item_num;
 
416
  drizzled::List<drizzled::Item> *item_list;
 
417
  drizzled::List<drizzled::String> *string_list;
 
418
  drizzled::String *string;
 
419
  drizzled::Key_part_spec *key_part;
 
420
  const drizzled::plugin::Function *udf;
 
421
  drizzled::TableList *table_list;
 
422
  struct drizzled::sys_var_with_base variable;
 
423
  enum drizzled::enum_var_type var_type;
 
424
  drizzled::Key::Keytype key_type;
 
425
  enum drizzled::ha_key_alg key_alg;
 
426
  enum drizzled::row_type row_type;
 
427
  enum drizzled::column_format_type column_format_type;
 
428
  enum drizzled::ha_rkey_function ha_rkey_mode;
 
429
  enum drizzled::enum_tx_isolation tx_isolation;
 
430
  enum drizzled::Cast_target cast_type;
 
431
  const drizzled::CHARSET_INFO *charset;
 
432
  drizzled::thr_lock_type lock_type;
 
433
  drizzled::interval_type interval, interval_time_st;
 
434
  enum drizzled::enum_drizzle_timestamp_type date_time_type;
 
435
  drizzled::Select_Lex *select_lex;
 
436
  drizzled::chooser_compare_func_creator boolfunc2creator;
 
437
  struct drizzled::st_lex *lex;
 
438
  enum drizzled::index_hint_type index_hint;
 
439
  enum drizzled::enum_filetype filetype;
 
440
  enum drizzled::ha_build_method build_method;
 
441
  enum drizzled::Foreign_key::fk_option m_fk_option;
438
442
}
439
443
 
440
444
%{
 
445
namespace drizzled
 
446
{
441
447
bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
 
448
}
442
449
%}
443
450
 
444
451
%pure_parser                                    /* We have threads */
4131
4138
opt_table_alias:
4132
4139
          /* empty */ { $$=0; }
4133
4140
        | table_alias ident
4134
 
          { $$= (LEX_STRING*) memory::sql_memdup(&$2,sizeof(LEX_STRING)); }
 
4141
          { $$= (drizzled::LEX_STRING*) memory::sql_memdup(&$2,sizeof(drizzled::LEX_STRING)); }
4135
4142
        ;
4136
4143
 
4137
4144
opt_all:
4367
4374
        ;
4368
4375
 
4369
4376
ulong_num:
4370
 
          NUM           { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
 
4377
          NUM           { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4371
4378
        | HEX_NUM       { $$= (ulong) strtol($1.str, (char**) 0, 16); }
4372
 
        | LONG_NUM      { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4373
 
        | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4374
 
        | DECIMAL_NUM   { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4375
 
        | FLOAT_NUM     { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
 
4379
        | LONG_NUM      { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4380
        | ULONGLONG_NUM { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4381
        | DECIMAL_NUM   { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4382
        | FLOAT_NUM     { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4376
4383
        ;
4377
4384
 
4378
4385
real_ulong_num:
4379
 
          NUM           { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
 
4386
          NUM           { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4380
4387
        | HEX_NUM       { $$= (ulong) strtol($1.str, (char**) 0, 16); }
4381
 
        | LONG_NUM      { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
4382
 
        | ULONGLONG_NUM { int error; $$= (ulong) my_strtoll10($1.str, (char**) 0, &error); }
 
4388
        | LONG_NUM      { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4389
        | ULONGLONG_NUM { int error; $$= (ulong) internal::my_strtoll10($1.str, (char**) 0, &error); }
4383
4390
        | dec_num_error { }
4384
4391
        ;
4385
4392
 
4386
4393
ulonglong_num:
4387
 
          NUM           { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4388
 
        | ULONGLONG_NUM { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4389
 
        | LONG_NUM      { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4390
 
        | DECIMAL_NUM   { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
4391
 
        | FLOAT_NUM     { int error; $$= (uint64_t) my_strtoll10($1.str, (char**) 0, &error); }
 
4394
          NUM           { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4395
        | ULONGLONG_NUM { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4396
        | LONG_NUM      { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4397
        | DECIMAL_NUM   { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
 
4398
        | FLOAT_NUM     { int error; $$= (uint64_t) internal::my_strtoll10($1.str, (char**) 0, &error); }
4392
4399
        ;
4393
4400
 
4394
4401
dec_num_error:
5357
5364
          NUM
5358
5365
          {
5359
5366
            int error;
5360
 
            $$ = new Item_int($1.str, (int64_t) my_strtoll10($1.str, NULL, &error), $1.length);
 
5367
            $$ = new Item_int($1.str, (int64_t) internal::my_strtoll10($1.str, NULL, &error), $1.length);
5361
5368
          }
5362
5369
        | LONG_NUM
5363
5370
          {
5364
5371
            int error;
5365
 
            $$ = new Item_int($1.str, (int64_t) my_strtoll10($1.str, NULL, &error), $1.length);
 
5372
            $$ = new Item_int($1.str, (int64_t) internal::my_strtoll10($1.str, NULL, &error), $1.length);
5366
5373
          }
5367
5374
        | ULONGLONG_NUM
5368
5375
          { $$ = new Item_uint($1.str, $1.length); }