17
17
/* A lexical scanner on a temporary buffer with a yacc interface */
20
19
#define DRIZZLE_LEX 1
21
#include "drizzled/configmake.h"
20
#include "drizzled/server_includes.h"
22
21
#include "drizzled/item/num.h"
23
22
#include "drizzled/error.h"
24
23
#include "drizzled/session.h"
31
30
using namespace std;
33
/* Stay outside of the namespace because otherwise bison goes nuts */
32
static int lex_one_token(void *arg, void *yysession);
34
33
int DRIZZLElex(void *arg, void *yysession);
39
static int lex_one_token(void *arg, void *yysession);
42
36
save order by and tables in own lists.
219
222
lex->select_lex.init_query();
220
223
lex->value_list.empty();
221
224
lex->update_list.empty();
225
lex->param_list.empty();
222
226
lex->auxiliary_table_list.empty();
223
227
lex->unit.next= lex->unit.master=
224
228
lex->unit.link_next= lex->unit.return_to= 0;
413
420
assert(end >= str);
415
422
if (!(start= (char*) lip->m_session->alloc((uint32_t) (end-str)+1)))
416
return (char*) ""; // memory::SqlAlloc has set error flag
423
return (char*) ""; // Sql_alloc has set error flag
418
425
lip->m_cpp_text_start= lip->get_cpp_tok_start() + pre_skip;
419
426
lip->m_cpp_text_end= lip->get_cpp_ptr() - post_skip;
587
593
int DRIZZLElex(void *arg, void *yysession)
589
drizzled::Session *session= (drizzled::Session *)yysession;
590
drizzled::Lex_input_stream *lip= session->m_lip;
595
Session *session= (Session *)yysession;
596
Lex_input_stream *lip= session->m_lip;
591
597
YYSTYPE *yylval=(YYSTYPE*) arg;
615
621
to transform the grammar into a LALR(1) grammar,
616
622
which sql_yacc.yy can process.
618
token= drizzled::lex_one_token(arg, yysession);
624
token= lex_one_token(arg, yysession);
619
625
if (token == ROLLUP_SYM)
621
627
return WITH_ROLLUP_SYM;
1269
Construct a copy of this object to be used for mysql_alter_table
1270
and mysql_create_table.
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.
1277
@return You need to use check the error in Session for out
1278
of memory condition after calling this function.
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),
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)
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.
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);
1265
1308
void trim_whitespace(const CHARSET_INFO * const cs, LEX_STRING *str)