Commit f752e64d authored by osku's avatar osku

Changes to InnoDB's SQL parser:

 -Change default mode of SELECT from "lock in share mode" to "consistent
 read".

 -Remove support from SELECT for specifying "consistent read".

 -Add support in SELECT for specifying "lock in share mode".

 -Change all uses of SQL parser to specify "lock in share mode".
parent 651c12c6
...@@ -69,57 +69,59 @@ ...@@ -69,57 +69,59 @@
PARS_WHERE_TOKEN = 295, PARS_WHERE_TOKEN = 295,
PARS_FOR_TOKEN = 296, PARS_FOR_TOKEN = 296,
PARS_DDOT_TOKEN = 297, PARS_DDOT_TOKEN = 297,
PARS_CONSISTENT_TOKEN = 298, PARS_READ_TOKEN = 298,
PARS_READ_TOKEN = 299, PARS_ORDER_TOKEN = 299,
PARS_ORDER_TOKEN = 300, PARS_BY_TOKEN = 300,
PARS_BY_TOKEN = 301, PARS_ASC_TOKEN = 301,
PARS_ASC_TOKEN = 302, PARS_DESC_TOKEN = 302,
PARS_DESC_TOKEN = 303, PARS_INSERT_TOKEN = 303,
PARS_INSERT_TOKEN = 304, PARS_INTO_TOKEN = 304,
PARS_INTO_TOKEN = 305, PARS_VALUES_TOKEN = 305,
PARS_VALUES_TOKEN = 306, PARS_UPDATE_TOKEN = 306,
PARS_UPDATE_TOKEN = 307, PARS_SET_TOKEN = 307,
PARS_SET_TOKEN = 308, PARS_DELETE_TOKEN = 308,
PARS_DELETE_TOKEN = 309, PARS_CURRENT_TOKEN = 309,
PARS_CURRENT_TOKEN = 310, PARS_OF_TOKEN = 310,
PARS_OF_TOKEN = 311, PARS_CREATE_TOKEN = 311,
PARS_CREATE_TOKEN = 312, PARS_TABLE_TOKEN = 312,
PARS_TABLE_TOKEN = 313, PARS_INDEX_TOKEN = 313,
PARS_INDEX_TOKEN = 314, PARS_UNIQUE_TOKEN = 314,
PARS_UNIQUE_TOKEN = 315, PARS_CLUSTERED_TOKEN = 315,
PARS_CLUSTERED_TOKEN = 316, PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 317, PARS_ON_TOKEN = 317,
PARS_ON_TOKEN = 318, PARS_ASSIGN_TOKEN = 318,
PARS_ASSIGN_TOKEN = 319, PARS_DECLARE_TOKEN = 319,
PARS_DECLARE_TOKEN = 320, PARS_CURSOR_TOKEN = 320,
PARS_CURSOR_TOKEN = 321, PARS_SQL_TOKEN = 321,
PARS_SQL_TOKEN = 322, PARS_OPEN_TOKEN = 322,
PARS_OPEN_TOKEN = 323, PARS_FETCH_TOKEN = 323,
PARS_FETCH_TOKEN = 324, PARS_CLOSE_TOKEN = 324,
PARS_CLOSE_TOKEN = 325, PARS_NOTFOUND_TOKEN = 325,
PARS_NOTFOUND_TOKEN = 326, PARS_TO_CHAR_TOKEN = 326,
PARS_TO_CHAR_TOKEN = 327, PARS_TO_NUMBER_TOKEN = 327,
PARS_TO_NUMBER_TOKEN = 328, PARS_TO_BINARY_TOKEN = 328,
PARS_TO_BINARY_TOKEN = 329, PARS_BINARY_TO_NUMBER_TOKEN = 329,
PARS_BINARY_TO_NUMBER_TOKEN = 330, PARS_SUBSTR_TOKEN = 330,
PARS_SUBSTR_TOKEN = 331, PARS_REPLSTR_TOKEN = 331,
PARS_REPLSTR_TOKEN = 332, PARS_CONCAT_TOKEN = 332,
PARS_CONCAT_TOKEN = 333, PARS_INSTR_TOKEN = 333,
PARS_INSTR_TOKEN = 334, PARS_LENGTH_TOKEN = 334,
PARS_LENGTH_TOKEN = 335, PARS_SYSDATE_TOKEN = 335,
PARS_SYSDATE_TOKEN = 336, PARS_PRINTF_TOKEN = 336,
PARS_PRINTF_TOKEN = 337, PARS_ASSERT_TOKEN = 337,
PARS_ASSERT_TOKEN = 338, PARS_RND_TOKEN = 338,
PARS_RND_TOKEN = 339, PARS_RND_STR_TOKEN = 339,
PARS_RND_STR_TOKEN = 340, PARS_ROW_PRINTF_TOKEN = 340,
PARS_ROW_PRINTF_TOKEN = 341, PARS_COMMIT_TOKEN = 341,
PARS_COMMIT_TOKEN = 342, PARS_ROLLBACK_TOKEN = 342,
PARS_ROLLBACK_TOKEN = 343, PARS_WORK_TOKEN = 343,
PARS_WORK_TOKEN = 344, PARS_UNSIGNED_TOKEN = 344,
PARS_UNSIGNED_TOKEN = 345, PARS_EXIT_TOKEN = 345,
PARS_EXIT_TOKEN = 346, PARS_FUNCTION_TOKEN = 346,
PARS_FUNCTION_TOKEN = 347, PARS_LOCK_TOKEN = 347,
NEG = 348 PARS_SHARE_TOKEN = 348,
PARS_MODE_TOKEN = 349,
NEG = 350
}; };
#endif #endif
#define PARS_INT_LIT 258 #define PARS_INT_LIT 258
...@@ -162,57 +164,59 @@ ...@@ -162,57 +164,59 @@
#define PARS_WHERE_TOKEN 295 #define PARS_WHERE_TOKEN 295
#define PARS_FOR_TOKEN 296 #define PARS_FOR_TOKEN 296
#define PARS_DDOT_TOKEN 297 #define PARS_DDOT_TOKEN 297
#define PARS_CONSISTENT_TOKEN 298 #define PARS_READ_TOKEN 298
#define PARS_READ_TOKEN 299 #define PARS_ORDER_TOKEN 299
#define PARS_ORDER_TOKEN 300 #define PARS_BY_TOKEN 300
#define PARS_BY_TOKEN 301 #define PARS_ASC_TOKEN 301
#define PARS_ASC_TOKEN 302 #define PARS_DESC_TOKEN 302
#define PARS_DESC_TOKEN 303 #define PARS_INSERT_TOKEN 303
#define PARS_INSERT_TOKEN 304 #define PARS_INTO_TOKEN 304
#define PARS_INTO_TOKEN 305 #define PARS_VALUES_TOKEN 305
#define PARS_VALUES_TOKEN 306 #define PARS_UPDATE_TOKEN 306
#define PARS_UPDATE_TOKEN 307 #define PARS_SET_TOKEN 307
#define PARS_SET_TOKEN 308 #define PARS_DELETE_TOKEN 308
#define PARS_DELETE_TOKEN 309 #define PARS_CURRENT_TOKEN 309
#define PARS_CURRENT_TOKEN 310 #define PARS_OF_TOKEN 310
#define PARS_OF_TOKEN 311 #define PARS_CREATE_TOKEN 311
#define PARS_CREATE_TOKEN 312 #define PARS_TABLE_TOKEN 312
#define PARS_TABLE_TOKEN 313 #define PARS_INDEX_TOKEN 313
#define PARS_INDEX_TOKEN 314 #define PARS_UNIQUE_TOKEN 314
#define PARS_UNIQUE_TOKEN 315 #define PARS_CLUSTERED_TOKEN 315
#define PARS_CLUSTERED_TOKEN 316 #define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 317 #define PARS_ON_TOKEN 317
#define PARS_ON_TOKEN 318 #define PARS_ASSIGN_TOKEN 318
#define PARS_ASSIGN_TOKEN 319 #define PARS_DECLARE_TOKEN 319
#define PARS_DECLARE_TOKEN 320 #define PARS_CURSOR_TOKEN 320
#define PARS_CURSOR_TOKEN 321 #define PARS_SQL_TOKEN 321
#define PARS_SQL_TOKEN 322 #define PARS_OPEN_TOKEN 322
#define PARS_OPEN_TOKEN 323 #define PARS_FETCH_TOKEN 323
#define PARS_FETCH_TOKEN 324 #define PARS_CLOSE_TOKEN 324
#define PARS_CLOSE_TOKEN 325 #define PARS_NOTFOUND_TOKEN 325
#define PARS_NOTFOUND_TOKEN 326 #define PARS_TO_CHAR_TOKEN 326
#define PARS_TO_CHAR_TOKEN 327 #define PARS_TO_NUMBER_TOKEN 327
#define PARS_TO_NUMBER_TOKEN 328 #define PARS_TO_BINARY_TOKEN 328
#define PARS_TO_BINARY_TOKEN 329 #define PARS_BINARY_TO_NUMBER_TOKEN 329
#define PARS_BINARY_TO_NUMBER_TOKEN 330 #define PARS_SUBSTR_TOKEN 330
#define PARS_SUBSTR_TOKEN 331 #define PARS_REPLSTR_TOKEN 331
#define PARS_REPLSTR_TOKEN 332 #define PARS_CONCAT_TOKEN 332
#define PARS_CONCAT_TOKEN 333 #define PARS_INSTR_TOKEN 333
#define PARS_INSTR_TOKEN 334 #define PARS_LENGTH_TOKEN 334
#define PARS_LENGTH_TOKEN 335 #define PARS_SYSDATE_TOKEN 335
#define PARS_SYSDATE_TOKEN 336 #define PARS_PRINTF_TOKEN 336
#define PARS_PRINTF_TOKEN 337 #define PARS_ASSERT_TOKEN 337
#define PARS_ASSERT_TOKEN 338 #define PARS_RND_TOKEN 338
#define PARS_RND_TOKEN 339 #define PARS_RND_STR_TOKEN 339
#define PARS_RND_STR_TOKEN 340 #define PARS_ROW_PRINTF_TOKEN 340
#define PARS_ROW_PRINTF_TOKEN 341 #define PARS_COMMIT_TOKEN 341
#define PARS_COMMIT_TOKEN 342 #define PARS_ROLLBACK_TOKEN 342
#define PARS_ROLLBACK_TOKEN 343 #define PARS_WORK_TOKEN 343
#define PARS_WORK_TOKEN 344 #define PARS_UNSIGNED_TOKEN 344
#define PARS_UNSIGNED_TOKEN 345 #define PARS_EXIT_TOKEN 345
#define PARS_EXIT_TOKEN 346 #define PARS_FUNCTION_TOKEN 346
#define PARS_FUNCTION_TOKEN 347 #define PARS_LOCK_TOKEN 347
#define NEG 348 #define PARS_SHARE_TOKEN 348
#define PARS_MODE_TOKEN 349
#define NEG 350
......
...@@ -63,7 +63,7 @@ extern pars_res_word_t pars_asc_token; ...@@ -63,7 +63,7 @@ extern pars_res_word_t pars_asc_token;
extern pars_res_word_t pars_desc_token; extern pars_res_word_t pars_desc_token;
extern pars_res_word_t pars_open_token; extern pars_res_word_t pars_open_token;
extern pars_res_word_t pars_close_token; extern pars_res_word_t pars_close_token;
extern pars_res_word_t pars_consistent_token; extern pars_res_word_t pars_share_token;
extern pars_res_word_t pars_unique_token; extern pars_res_word_t pars_unique_token;
extern pars_res_word_t pars_clustered_token; extern pars_res_word_t pars_clustered_token;
......
This diff is collapsed.
This diff is collapsed.
...@@ -69,57 +69,59 @@ ...@@ -69,57 +69,59 @@
PARS_WHERE_TOKEN = 295, PARS_WHERE_TOKEN = 295,
PARS_FOR_TOKEN = 296, PARS_FOR_TOKEN = 296,
PARS_DDOT_TOKEN = 297, PARS_DDOT_TOKEN = 297,
PARS_CONSISTENT_TOKEN = 298, PARS_READ_TOKEN = 298,
PARS_READ_TOKEN = 299, PARS_ORDER_TOKEN = 299,
PARS_ORDER_TOKEN = 300, PARS_BY_TOKEN = 300,
PARS_BY_TOKEN = 301, PARS_ASC_TOKEN = 301,
PARS_ASC_TOKEN = 302, PARS_DESC_TOKEN = 302,
PARS_DESC_TOKEN = 303, PARS_INSERT_TOKEN = 303,
PARS_INSERT_TOKEN = 304, PARS_INTO_TOKEN = 304,
PARS_INTO_TOKEN = 305, PARS_VALUES_TOKEN = 305,
PARS_VALUES_TOKEN = 306, PARS_UPDATE_TOKEN = 306,
PARS_UPDATE_TOKEN = 307, PARS_SET_TOKEN = 307,
PARS_SET_TOKEN = 308, PARS_DELETE_TOKEN = 308,
PARS_DELETE_TOKEN = 309, PARS_CURRENT_TOKEN = 309,
PARS_CURRENT_TOKEN = 310, PARS_OF_TOKEN = 310,
PARS_OF_TOKEN = 311, PARS_CREATE_TOKEN = 311,
PARS_CREATE_TOKEN = 312, PARS_TABLE_TOKEN = 312,
PARS_TABLE_TOKEN = 313, PARS_INDEX_TOKEN = 313,
PARS_INDEX_TOKEN = 314, PARS_UNIQUE_TOKEN = 314,
PARS_UNIQUE_TOKEN = 315, PARS_CLUSTERED_TOKEN = 315,
PARS_CLUSTERED_TOKEN = 316, PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 316,
PARS_DOES_NOT_FIT_IN_MEM_TOKEN = 317, PARS_ON_TOKEN = 317,
PARS_ON_TOKEN = 318, PARS_ASSIGN_TOKEN = 318,
PARS_ASSIGN_TOKEN = 319, PARS_DECLARE_TOKEN = 319,
PARS_DECLARE_TOKEN = 320, PARS_CURSOR_TOKEN = 320,
PARS_CURSOR_TOKEN = 321, PARS_SQL_TOKEN = 321,
PARS_SQL_TOKEN = 322, PARS_OPEN_TOKEN = 322,
PARS_OPEN_TOKEN = 323, PARS_FETCH_TOKEN = 323,
PARS_FETCH_TOKEN = 324, PARS_CLOSE_TOKEN = 324,
PARS_CLOSE_TOKEN = 325, PARS_NOTFOUND_TOKEN = 325,
PARS_NOTFOUND_TOKEN = 326, PARS_TO_CHAR_TOKEN = 326,
PARS_TO_CHAR_TOKEN = 327, PARS_TO_NUMBER_TOKEN = 327,
PARS_TO_NUMBER_TOKEN = 328, PARS_TO_BINARY_TOKEN = 328,
PARS_TO_BINARY_TOKEN = 329, PARS_BINARY_TO_NUMBER_TOKEN = 329,
PARS_BINARY_TO_NUMBER_TOKEN = 330, PARS_SUBSTR_TOKEN = 330,
PARS_SUBSTR_TOKEN = 331, PARS_REPLSTR_TOKEN = 331,
PARS_REPLSTR_TOKEN = 332, PARS_CONCAT_TOKEN = 332,
PARS_CONCAT_TOKEN = 333, PARS_INSTR_TOKEN = 333,
PARS_INSTR_TOKEN = 334, PARS_LENGTH_TOKEN = 334,
PARS_LENGTH_TOKEN = 335, PARS_SYSDATE_TOKEN = 335,
PARS_SYSDATE_TOKEN = 336, PARS_PRINTF_TOKEN = 336,
PARS_PRINTF_TOKEN = 337, PARS_ASSERT_TOKEN = 337,
PARS_ASSERT_TOKEN = 338, PARS_RND_TOKEN = 338,
PARS_RND_TOKEN = 339, PARS_RND_STR_TOKEN = 339,
PARS_RND_STR_TOKEN = 340, PARS_ROW_PRINTF_TOKEN = 340,
PARS_ROW_PRINTF_TOKEN = 341, PARS_COMMIT_TOKEN = 341,
PARS_COMMIT_TOKEN = 342, PARS_ROLLBACK_TOKEN = 342,
PARS_ROLLBACK_TOKEN = 343, PARS_WORK_TOKEN = 343,
PARS_WORK_TOKEN = 344, PARS_UNSIGNED_TOKEN = 344,
PARS_UNSIGNED_TOKEN = 345, PARS_EXIT_TOKEN = 345,
PARS_EXIT_TOKEN = 346, PARS_FUNCTION_TOKEN = 346,
PARS_FUNCTION_TOKEN = 347, PARS_LOCK_TOKEN = 347,
NEG = 348 PARS_SHARE_TOKEN = 348,
PARS_MODE_TOKEN = 349,
NEG = 350
}; };
#endif #endif
#define PARS_INT_LIT 258 #define PARS_INT_LIT 258
...@@ -162,57 +164,59 @@ ...@@ -162,57 +164,59 @@
#define PARS_WHERE_TOKEN 295 #define PARS_WHERE_TOKEN 295
#define PARS_FOR_TOKEN 296 #define PARS_FOR_TOKEN 296
#define PARS_DDOT_TOKEN 297 #define PARS_DDOT_TOKEN 297
#define PARS_CONSISTENT_TOKEN 298 #define PARS_READ_TOKEN 298
#define PARS_READ_TOKEN 299 #define PARS_ORDER_TOKEN 299
#define PARS_ORDER_TOKEN 300 #define PARS_BY_TOKEN 300
#define PARS_BY_TOKEN 301 #define PARS_ASC_TOKEN 301
#define PARS_ASC_TOKEN 302 #define PARS_DESC_TOKEN 302
#define PARS_DESC_TOKEN 303 #define PARS_INSERT_TOKEN 303
#define PARS_INSERT_TOKEN 304 #define PARS_INTO_TOKEN 304
#define PARS_INTO_TOKEN 305 #define PARS_VALUES_TOKEN 305
#define PARS_VALUES_TOKEN 306 #define PARS_UPDATE_TOKEN 306
#define PARS_UPDATE_TOKEN 307 #define PARS_SET_TOKEN 307
#define PARS_SET_TOKEN 308 #define PARS_DELETE_TOKEN 308
#define PARS_DELETE_TOKEN 309 #define PARS_CURRENT_TOKEN 309
#define PARS_CURRENT_TOKEN 310 #define PARS_OF_TOKEN 310
#define PARS_OF_TOKEN 311 #define PARS_CREATE_TOKEN 311
#define PARS_CREATE_TOKEN 312 #define PARS_TABLE_TOKEN 312
#define PARS_TABLE_TOKEN 313 #define PARS_INDEX_TOKEN 313
#define PARS_INDEX_TOKEN 314 #define PARS_UNIQUE_TOKEN 314
#define PARS_UNIQUE_TOKEN 315 #define PARS_CLUSTERED_TOKEN 315
#define PARS_CLUSTERED_TOKEN 316 #define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 316
#define PARS_DOES_NOT_FIT_IN_MEM_TOKEN 317 #define PARS_ON_TOKEN 317
#define PARS_ON_TOKEN 318 #define PARS_ASSIGN_TOKEN 318
#define PARS_ASSIGN_TOKEN 319 #define PARS_DECLARE_TOKEN 319
#define PARS_DECLARE_TOKEN 320 #define PARS_CURSOR_TOKEN 320
#define PARS_CURSOR_TOKEN 321 #define PARS_SQL_TOKEN 321
#define PARS_SQL_TOKEN 322 #define PARS_OPEN_TOKEN 322
#define PARS_OPEN_TOKEN 323 #define PARS_FETCH_TOKEN 323
#define PARS_FETCH_TOKEN 324 #define PARS_CLOSE_TOKEN 324
#define PARS_CLOSE_TOKEN 325 #define PARS_NOTFOUND_TOKEN 325
#define PARS_NOTFOUND_TOKEN 326 #define PARS_TO_CHAR_TOKEN 326
#define PARS_TO_CHAR_TOKEN 327 #define PARS_TO_NUMBER_TOKEN 327
#define PARS_TO_NUMBER_TOKEN 328 #define PARS_TO_BINARY_TOKEN 328
#define PARS_TO_BINARY_TOKEN 329 #define PARS_BINARY_TO_NUMBER_TOKEN 329
#define PARS_BINARY_TO_NUMBER_TOKEN 330 #define PARS_SUBSTR_TOKEN 330
#define PARS_SUBSTR_TOKEN 331 #define PARS_REPLSTR_TOKEN 331
#define PARS_REPLSTR_TOKEN 332 #define PARS_CONCAT_TOKEN 332
#define PARS_CONCAT_TOKEN 333 #define PARS_INSTR_TOKEN 333
#define PARS_INSTR_TOKEN 334 #define PARS_LENGTH_TOKEN 334
#define PARS_LENGTH_TOKEN 335 #define PARS_SYSDATE_TOKEN 335
#define PARS_SYSDATE_TOKEN 336 #define PARS_PRINTF_TOKEN 336
#define PARS_PRINTF_TOKEN 337 #define PARS_ASSERT_TOKEN 337
#define PARS_ASSERT_TOKEN 338 #define PARS_RND_TOKEN 338
#define PARS_RND_TOKEN 339 #define PARS_RND_STR_TOKEN 339
#define PARS_RND_STR_TOKEN 340 #define PARS_ROW_PRINTF_TOKEN 340
#define PARS_ROW_PRINTF_TOKEN 341 #define PARS_COMMIT_TOKEN 341
#define PARS_COMMIT_TOKEN 342 #define PARS_ROLLBACK_TOKEN 342
#define PARS_ROLLBACK_TOKEN 343 #define PARS_WORK_TOKEN 343
#define PARS_WORK_TOKEN 344 #define PARS_UNSIGNED_TOKEN 344
#define PARS_UNSIGNED_TOKEN 345 #define PARS_EXIT_TOKEN 345
#define PARS_EXIT_TOKEN 346 #define PARS_FUNCTION_TOKEN 346
#define PARS_FUNCTION_TOKEN 347 #define PARS_LOCK_TOKEN 347
#define NEG 348 #define PARS_SHARE_TOKEN 348
#define PARS_MODE_TOKEN 349
#define NEG 350
......
...@@ -70,7 +70,6 @@ yylex(void); ...@@ -70,7 +70,6 @@ yylex(void);
%token PARS_WHERE_TOKEN %token PARS_WHERE_TOKEN
%token PARS_FOR_TOKEN %token PARS_FOR_TOKEN
%token PARS_DDOT_TOKEN %token PARS_DDOT_TOKEN
%token PARS_CONSISTENT_TOKEN
%token PARS_READ_TOKEN %token PARS_READ_TOKEN
%token PARS_ORDER_TOKEN %token PARS_ORDER_TOKEN
%token PARS_BY_TOKEN %token PARS_BY_TOKEN
...@@ -120,6 +119,9 @@ yylex(void); ...@@ -120,6 +119,9 @@ yylex(void);
%token PARS_UNSIGNED_TOKEN %token PARS_UNSIGNED_TOKEN
%token PARS_EXIT_TOKEN %token PARS_EXIT_TOKEN
%token PARS_FUNCTION_TOKEN %token PARS_FUNCTION_TOKEN
%token PARS_LOCK_TOKEN
%token PARS_SHARE_TOKEN
%token PARS_MODE_TOKEN
%left PARS_AND_TOKEN PARS_OR_TOKEN %left PARS_AND_TOKEN PARS_OR_TOKEN
%left PARS_NOT_TOKEN %left PARS_NOT_TOKEN
...@@ -301,10 +303,10 @@ for_update_clause: ...@@ -301,10 +303,10 @@ for_update_clause:
{ $$ = &pars_update_token; } { $$ = &pars_update_token; }
; ;
consistent_read_clause: lock_shared_clause:
/* Nothing */ { $$ = NULL; } /* Nothing */ { $$ = NULL; }
| PARS_CONSISTENT_TOKEN PARS_READ_TOKEN | PARS_LOCK_TOKEN PARS_IN_TOKEN PARS_SHARE_TOKEN PARS_MODE_TOKEN
{ $$ = &pars_consistent_token; } { $$ = &pars_share_token; }
; ;
order_direction: order_direction:
...@@ -324,7 +326,7 @@ select_statement: ...@@ -324,7 +326,7 @@ select_statement:
PARS_FROM_TOKEN table_list PARS_FROM_TOKEN table_list
search_condition search_condition
for_update_clause for_update_clause
consistent_read_clause lock_shared_clause
order_by_clause { $$ = pars_select_statement($2, $4, $5, order_by_clause { $$ = pars_select_statement($2, $4, $5,
$6, $7, $8); } $6, $7, $8); }
; ;
......
...@@ -325,10 +325,6 @@ In the state 'id', only two actions are possible (defined below). */ ...@@ -325,10 +325,6 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FOR_TOKEN); return(PARS_FOR_TOKEN);
} }
"CONSISTENT" {
return(PARS_CONSISTENT_TOKEN);
}
"READ" { "READ" {
return(PARS_READ_TOKEN); return(PARS_READ_TOKEN);
} }
...@@ -517,6 +513,18 @@ In the state 'id', only two actions are possible (defined below). */ ...@@ -517,6 +513,18 @@ In the state 'id', only two actions are possible (defined below). */
return(PARS_FUNCTION_TOKEN); return(PARS_FUNCTION_TOKEN);
} }
"LOCK" {
return(PARS_LOCK_TOKEN);
}
"SHARE" {
return(PARS_SHARE_TOKEN);
}
"MODE" {
return(PARS_MODE_TOKEN);
}
{ID} { {ID} {
yylval = sym_tab_add_id(pars_sym_tab_global, yylval = sym_tab_add_id(pars_sym_tab_global,
(byte*)yytext, (byte*)yytext,
......
...@@ -72,7 +72,7 @@ pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN}; ...@@ -72,7 +72,7 @@ pars_res_word_t pars_asc_token = {PARS_ASC_TOKEN};
pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN}; pars_res_word_t pars_desc_token = {PARS_DESC_TOKEN};
pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN}; pars_res_word_t pars_open_token = {PARS_OPEN_TOKEN};
pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN}; pars_res_word_t pars_close_token = {PARS_CLOSE_TOKEN};
pars_res_word_t pars_consistent_token = {PARS_CONSISTENT_TOKEN}; pars_res_word_t pars_share_token = {PARS_SHARE_TOKEN};
pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN}; pars_res_word_t pars_unique_token = {PARS_UNIQUE_TOKEN};
pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN}; pars_res_word_t pars_clustered_token = {PARS_CLUSTERED_TOKEN};
...@@ -699,8 +699,7 @@ pars_select_statement( ...@@ -699,8 +699,7 @@ pars_select_statement(
sym_node_t* table_list, /* in: table list */ sym_node_t* table_list, /* in: table list */
que_node_t* search_cond, /* in: search condition or NULL */ que_node_t* search_cond, /* in: search condition or NULL */
pars_res_word_t* for_update, /* in: NULL or &pars_update_token */ pars_res_word_t* for_update, /* in: NULL or &pars_update_token */
pars_res_word_t* consistent_read,/* in: NULL or pars_res_word_t* lock_shared, /* in: NULL or &pars_share_token */
&pars_consistent_token */
order_node_t* order_by) /* in: NULL or an order-by node */ order_node_t* order_by) /* in: NULL or an order-by node */
{ {
select_node->state = SEL_NODE_OPEN; select_node->state = SEL_NODE_OPEN;
...@@ -734,19 +733,24 @@ pars_select_statement( ...@@ -734,19 +733,24 @@ pars_select_statement(
} }
if (for_update) { if (for_update) {
ut_a(!consistent_read); ut_a(!lock_shared);
select_node->set_x_locks = TRUE; select_node->set_x_locks = TRUE;
select_node->row_lock_mode = LOCK_X; select_node->row_lock_mode = LOCK_X;
} else {
select_node->consistent_read = FALSE;
select_node->read_view = NULL;
} else if (lock_shared){
select_node->set_x_locks = FALSE; select_node->set_x_locks = FALSE;
select_node->row_lock_mode = LOCK_S; select_node->row_lock_mode = LOCK_S;
}
if (consistent_read) {
select_node->consistent_read = TRUE;
} else {
select_node->consistent_read = FALSE; select_node->consistent_read = FALSE;
select_node->read_view = NULL; select_node->read_view = NULL;
} else {
select_node->set_x_locks = FALSE;
select_node->row_lock_mode = LOCK_S;
select_node->consistent_read = TRUE;
} }
select_node->order_by = order_by; select_node->order_by = order_by;
...@@ -976,7 +980,7 @@ pars_update_statement( ...@@ -976,7 +980,7 @@ pars_update_statement(
sel_node = pars_select_list(NULL, NULL); sel_node = pars_select_list(NULL, NULL);
pars_select_statement(sel_node, table_sym, search_cond, NULL, pars_select_statement(sel_node, table_sym, search_cond, NULL,
NULL, NULL); &pars_share_token, NULL);
node->searched_update = TRUE; node->searched_update = TRUE;
sel_node->common.parent = node; sel_node->common.parent = node;
} }
......
...@@ -2503,7 +2503,8 @@ do not allow the discard. We also reserve the data dictionary latch. */ ...@@ -2503,7 +2503,8 @@ do not allow the discard. We also reserve the data dictionary latch. */
"BEGIN\n" "BEGIN\n"
"SELECT ID INTO old_id\n" "SELECT ID INTO old_id\n"
"FROM SYS_TABLES\n" "FROM SYS_TABLES\n"
"WHERE NAME = :table_name;\n" "WHERE NAME = :table_name\n"
"LOCK IN SHARE MODE;\n"
"IF (SQL % NOTFOUND) THEN\n" "IF (SQL % NOTFOUND) THEN\n"
" COMMIT WORK;\n" " COMMIT WORK;\n"
" RETURN;\n" " RETURN;\n"
...@@ -3182,7 +3183,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3182,7 +3183,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"BEGIN\n" "BEGIN\n"
"SELECT ID INTO table_id\n" "SELECT ID INTO table_id\n"
"FROM SYS_TABLES\n" "FROM SYS_TABLES\n"
"WHERE NAME = :table_name;\n" "WHERE NAME = :table_name\n"
"LOCK IN SHARE MODE;\n"
"IF (SQL % NOTFOUND) THEN\n" "IF (SQL % NOTFOUND) THEN\n"
" COMMIT WORK;\n" " COMMIT WORK;\n"
" RETURN;\n" " RETURN;\n"
...@@ -3190,7 +3192,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3190,7 +3192,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"found := 1;\n" "found := 1;\n"
"SELECT ID INTO sys_foreign_id\n" "SELECT ID INTO sys_foreign_id\n"
"FROM SYS_TABLES\n" "FROM SYS_TABLES\n"
"WHERE NAME = 'SYS_FOREIGN';\n" "WHERE NAME = 'SYS_FOREIGN'\n"
"LOCK IN SHARE MODE;\n"
"IF (SQL % NOTFOUND) THEN\n" "IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
"END IF;\n" "END IF;\n"
...@@ -3204,7 +3207,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3204,7 +3207,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
" SELECT ID INTO foreign_id\n" " SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n" " FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = :table_name\n" " WHERE FOR_NAME = :table_name\n"
" AND TO_BINARY(FOR_NAME) = TO_BINARY(:table_name);\n" " AND TO_BINARY(FOR_NAME) = TO_BINARY(:table_name)\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n" " IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
" ELSE" " ELSE"
...@@ -3216,7 +3220,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr); ...@@ -3216,7 +3220,8 @@ fputs(" InnoDB: You are trying to drop table ", stderr);
"WHILE found = 1 LOOP\n" "WHILE found = 1 LOOP\n"
" SELECT ID INTO index_id\n" " SELECT ID INTO index_id\n"
" FROM SYS_INDEXES\n" " FROM SYS_INDEXES\n"
" WHERE TABLE_ID = table_id;\n" " WHERE TABLE_ID = table_id\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n" " IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
" ELSE" " ELSE"
...@@ -3641,7 +3646,8 @@ row_rename_table_for_mysql( ...@@ -3641,7 +3646,8 @@ row_rename_table_for_mysql(
" SELECT ID INTO foreign_id\n" " SELECT ID INTO foreign_id\n"
" FROM SYS_FOREIGN\n" " FROM SYS_FOREIGN\n"
" WHERE FOR_NAME = :old_table_name\n" " WHERE FOR_NAME = :old_table_name\n"
" AND TO_BINARY(FOR_NAME) = TO_BINARY(:old_table_name);\n" " AND TO_BINARY(FOR_NAME) = TO_BINARY(:old_table_name)\n"
" LOCK IN SHARE MODE;\n"
" IF (SQL % NOTFOUND) THEN\n" " IF (SQL % NOTFOUND) THEN\n"
" found := 0;\n" " found := 0;\n"
" ELSE\n" " ELSE\n"
......
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