sql_yacc.yy, sql_parse.cc, sql_lex.h, mysqld.cc, lex.h:

Add syntax SAVEPOINT id and ROLLBACK TO SAVEPOINT id. This is compatible with DB2 and Oracle but not with SQL Server. Savepoints do not do anything yet, this is just parsing.


sql/lex.h:
  Add syntax SAVEPOINT id and ROLLBACK TO SAVEPOINT id. This is compatible with DB2 and Oracle but not with SQL Server. Savepoints do not do anything yet, this is just parsing.
sql/mysqld.cc:
  Add syntax SAVEPOINT id and ROLLBACK TO SAVEPOINT id. This is compatible with DB2 and Oracle but not with SQL Server. Savepoints do not do anything yet, this is just parsing.
sql/sql_lex.h:
  Add syntax SAVEPOINT id and ROLLBACK TO SAVEPOINT id. This is compatible with DB2 and Oracle but not with SQL Server. Savepoints do not do anything yet, this is just parsing.
sql/sql_parse.cc:
  Add syntax SAVEPOINT id and ROLLBACK TO SAVEPOINT id. This is compatible with DB2 and Oracle but not with SQL Server. Savepoints do not do anything yet, this is just parsing.
sql/sql_yacc.yy:
  Add syntax SAVEPOINT id and ROLLBACK TO SAVEPOINT id. This is compatible with DB2 and Oracle but not with SQL Server. Savepoints do not do anything yet, this is just parsing.
This commit is contained in:
unknown 2003-06-06 04:18:58 +03:00
parent bd414c301c
commit 1e7dfec5c7
5 changed files with 29 additions and 4 deletions

View File

@ -309,6 +309,7 @@ static SYMBOL symbols[] = {
{ "ROLLUP", SYM(ROLLUP_SYM),0,0},
{ "ROW", SYM(ROW_SYM),0,0},
{ "ROWS", SYM(ROWS_SYM),0,0},
{ "SAVEPOINT", SYM(SAVEPOINT_SYM),0,0},
{ "SECOND", SYM(SECOND_SYM),0,0},
{ "SELECT", SYM(SELECT_SYM),0,0},
{ "SERIALIZABLE", SYM(SERIALIZABLE_SYM),0,0},

View File

@ -4021,6 +4021,7 @@ struct show_var_st status_vars[]= {
{"Com_restore_table", (char*) (com_stat+(uint) SQLCOM_RESTORE_TABLE),SHOW_LONG},
{"Com_revoke", (char*) (com_stat+(uint) SQLCOM_REVOKE),SHOW_LONG},
{"Com_rollback", (char*) (com_stat+(uint) SQLCOM_ROLLBACK),SHOW_LONG},
{"Com_savepoint", (char*) (com_stat+(uint) SQLCOM_SAVEPOINT),SHOW_LONG},
{"Com_select", (char*) (com_stat+(uint) SQLCOM_SELECT),SHOW_LONG},
{"Com_set_option", (char*) (com_stat+(uint) SQLCOM_SET_OPTION),SHOW_LONG},
{"Com_show_binlog_events", (char*) (com_stat+(uint) SQLCOM_SHOW_BINLOG_EVENTS),SHOW_LONG},

View File

@ -54,7 +54,8 @@ enum enum_sql_command {
SQLCOM_CREATE_FUNCTION, SQLCOM_DROP_FUNCTION,
SQLCOM_REVOKE,SQLCOM_OPTIMIZE, SQLCOM_CHECK,
SQLCOM_FLUSH, SQLCOM_KILL, SQLCOM_ANALYZE,
SQLCOM_ROLLBACK, SQLCOM_COMMIT, SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
SQLCOM_ROLLBACK, SQLCOM_COMMIT, SQLCOM_SAVEPOINT,
SQLCOM_SLAVE_START, SQLCOM_SLAVE_STOP,
SQLCOM_BEGIN, SQLCOM_LOAD_MASTER_TABLE, SQLCOM_CHANGE_MASTER,
SQLCOM_RENAME_TABLE, SQLCOM_BACKUP_TABLE, SQLCOM_RESTORE_TABLE,
SQLCOM_RESET, SQLCOM_PURGE, SQLCOM_SHOW_BINLOGS,
@ -154,6 +155,7 @@ typedef struct st_lex
SQL_LIST proc_list, auxilliary_table_list;
TYPELIB *interval;
create_field *last_field;
char* savepoint_name; // Transaction savepoint id
Item *default_value;
CONVERT *convert_set;
CONVERT *thd_convert_set; // Set with SET CHAR SET

View File

@ -2533,6 +2533,9 @@ mysql_execute_command(void)
res= -1;
thd->options&= ~(ulong) (OPTION_BEGIN | OPTION_STATUS_NO_TRANS_UPDATE);
break;
case SQLCOM_SAVEPOINT:
send_ok(&thd->net);
break;
default: /* Impossible */
send_ok(&thd->net);
break;

View File

@ -135,6 +135,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token RESET_SYM
%token ROLLBACK_SYM
%token ROLLUP_SYM
%token SAVEPOINT_SYM
%token SELECT_SYM
%token SHOW
%token SLAVE
@ -573,7 +574,8 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
query verb_clause create change select do drop insert replace insert2
insert_values update delete truncate rename
show describe load alter optimize flush
reset purge begin commit rollback slave master_def master_defs
reset purge begin commit rollback savepoint
slave master_def master_defs
repair restore backup analyze check start
field_list field_list_item field_spec kill column_def key_def
select_item_list select_item values_list no_braces
@ -649,6 +651,7 @@ verb_clause:
| restore
| revoke
| rollback
| savepoint
| select
| set
| slave
@ -3382,6 +3385,7 @@ keyword:
| ROWS_SYM {}
| ROW_FORMAT_SYM {}
| ROW_SYM {}
| SAVEPOINT_SYM {}
| SECOND_SYM {}
| SERIALIZABLE_SYM {}
| SESSION_SYM {}
@ -3915,8 +3919,22 @@ commit:
COMMIT_SYM { Lex->sql_command = SQLCOM_COMMIT;};
rollback:
ROLLBACK_SYM { Lex->sql_command = SQLCOM_ROLLBACK;};
ROLLBACK_SYM
{
Lex->sql_command = SQLCOM_ROLLBACK;
Lex->savepoint_name = NULL;
}
| ROLLBACK_SYM TO_SYM SAVEPOINT_SYM ident
{
Lex->sql_command = SQLCOM_ROLLBACK;
Lex->savepoint_name = $4.str;
};
savepoint:
SAVEPOINT_SYM ident
{
Lex->sql_command = SQLCOM_SAVEPOINT;
Lex->savepoint_name = $2.str;
};
/*
** UNIONS : glue selects together