Commit bf303419 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub Committed by Alexander Barkov

Part2: MDEV-12518 Unify sql_yacc.yy and sql_yacc_ora.yy

Generate sql_yacc_ora.yy from sql_yacc.yy , by using cmake script
which does some simple string(REPLACE)
parent 3f9d7072
......@@ -173,6 +173,7 @@ sql/sql_yacc.cc
sql/sql_yacc.hh
sql/sql_yacc_ora.cc
sql/sql_yacc_ora.hh
sql/sql_yacc_ora.yy
storage/heap/hp_test1
storage/heap/hp_test2
storage/maria/aria_chk
......
......@@ -62,6 +62,17 @@ ADD_CUSTOM_COMMAND(
DEPENDS gen_lex_token
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy
COMMAND ${CMAKE_COMMAND}
"-DIN=${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy"
"-DOUT=${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy"
-P ${CMAKE_CURRENT_SOURCE_DIR}/gen_sql_yacc_ora_yy.cmake
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy
)
ADD_CUSTOM_TARGET(gen_sql_yacc_ora_yy DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy)
ADD_DEFINITIONS(-DMYSQL_SERVER -DHAVE_EVENT_SCHEDULER)
IF(SSL_DEFINES)
......@@ -367,8 +378,7 @@ IF (NOT BISON_FOUND)
ELSE()
BISON_TARGET(gen_sql_yacc ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc.yy ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc.cc
COMPILE_FLAGS "-p MYSQL")
BISON_TARGET(gen_sql_yacc_ora ${CMAKE_CURRENT_SOURCE_DIR}/sql_yacc_ora.yy ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc
BISON_TARGET(gen_sql_yacc_ora ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.yy ${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc
COMPILE_FLAGS "-p ORA")
ENDIF()
......@@ -396,6 +406,8 @@ ADD_CUSTOM_TARGET(
${CMAKE_CURRENT_BINARY_DIR}/sql_yacc_ora.cc
)
ADD_DEPENDENCIES(GenServerSource gen_sql_yacc_ora_yy)
IF(WIN32 OR HAVE_DLOPEN AND NOT DISABLE_SHARED)
ADD_LIBRARY(udf_example MODULE udf_example.c udf_example.def)
SET_TARGET_PROPERTIES(udf_example PROPERTIES PREFIX "")
......
file(READ "${IN}" yytmp)
# Comment out sql_mode=DEFAULT rules and directives (e.g. %expect, %type)
string(REPLACE "/* Start SQL_MODE_DEFAULT_SPECIFIC */"
"/* Start SQL_MODE_DEFAULT_SPECIFIC" yytmp "${yytmp}")
string(REPLACE "/* End SQL_MODE_DEFAULT_SPECIFIC */"
"End SQL_MODE_DEFAULT_SPECIFIC */" yytmp "${yytmp}")
# Uncomment sql_mode=ORACLE rules and directives
string(REPLACE "/* Start SQL_MODE_ORACLE_SPECIFIC"
"/* Start SQL_MODE_ORACLE_SPECIFIC */" yytmp "${yytmp}")
string(REPLACE "End SQL_MODE_ORACLE_SPECIFIC */"
"/* End SQL_MODE_ORACLE_SPECIFIC */" yytmp "${yytmp}")
file(WRITE "${OUT}" "${yytmp}")
......@@ -322,14 +322,16 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
/*
We should not introduce new conflicts any more.
*/
//%{#ifdef SQL_MODE_DEFAULT_SPECIFIC
/* Start SQL_MODE_DEFAULT_SPECIFIC */
%expect 37
//#endif %} // SQL_MODE_DEFAULT_SPECIFIC
/* End SQL_MODE_DEFAULT_SPECIFIC */
%{#ifdef SQL_MODE_ORACLE_SPECIFIC
/* Start SQL_MODE_ORACLE_SPECIFIC
%expect 40
#endif %} // SQL_MODE_ORACLE_SPECIFIC
End SQL_MODE_ORACLE_SPECIFIC */
/*
Comments for TOKENS.
......@@ -1721,7 +1723,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <vers_history_point> history_point
%type <vers_column_versioning> with_or_without_system
//%{#ifdef SQL_MODE_DEFAULT_SPECIFIC
/* Start SQL_MODE_DEFAULT_SPECIFIC */
%type <NONE> sp_tail_standalone
%type <NONE> sp_unlabeled_block_not_atomic
%type <NONE> sp_proc_stmt_in_returns_clause
......@@ -1733,10 +1735,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <spblock> sp_decl_variable_list
%type <spblock> sp_decl_variable_list_anchored
%type <kwd> reserved_keyword_udt_param_type
//#endif %} // SQL_MODE_DEFAULT_SPECIFIC
/* End SQL_MODE_DEFAULT_SPECIFIC */
%{#ifdef SQL_MODE_ORACLE_SPECIFIC
/* Start SQL_MODE_ORACLE_SPECIFIC
%type <NONE> set_assign
%type <spvar_mode> sp_opt_inout
%type <NONE> sp_tail_standalone
......@@ -1771,7 +1773,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
%type <lex> package_routine_lex
%type <lex> package_specification_function
%type <lex> package_specification_procedure
#endif %} // SQL_MODE_ORACLE_SPECIFIC
End SQL_MODE_ORACLE_SPECIFIC */
%%
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment