Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
e99e6f29
Commit
e99e6f29
authored
Jan 05, 2019
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: trg2bit() helper
parent
0e1f7f5c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
25 deletions
+16
-25
sql/log_event.cc
sql/log_event.cc
+4
-5
sql/sql_lex.cc
sql/sql_lex.cc
+7
-16
sql/sql_trigger.cc
sql/sql_trigger.cc
+2
-4
sql/sql_trigger.h
sql/sql_trigger.h
+3
-0
No files found.
sql/log_event.cc
View file @
e99e6f29
...
@@ -13445,9 +13445,8 @@ bool Write_rows_compressed_log_event::print(FILE *file,
...
@@ -13445,9 +13445,8 @@ bool Write_rows_compressed_log_event::print(FILE *file,
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
uint8
Write_rows_log_event
::
get_trg_event_map
()
uint8
Write_rows_log_event
::
get_trg_event_map
()
{
{
return
(
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_INSERT
))
|
return
trg2bit
(
TRG_EVENT_INSERT
)
|
trg2bit
(
TRG_EVENT_UPDATE
)
|
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_UPDATE
))
|
trg2bit
(
TRG_EVENT_DELETE
);
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_DELETE
)));
}
}
#endif
#endif
...
@@ -14154,7 +14153,7 @@ bool Delete_rows_compressed_log_event::print(FILE *file,
...
@@ -14154,7 +14153,7 @@ bool Delete_rows_compressed_log_event::print(FILE *file,
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
uint8
Delete_rows_log_event
::
get_trg_event_map
()
uint8
Delete_rows_log_event
::
get_trg_event_map
()
{
{
return
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_DELETE
)
);
return
trg2bit
(
TRG_EVENT_DELETE
);
}
}
#endif
#endif
...
@@ -14429,7 +14428,7 @@ Update_rows_compressed_log_event::print(FILE *file,
...
@@ -14429,7 +14428,7 @@ Update_rows_compressed_log_event::print(FILE *file,
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
#if defined(MYSQL_SERVER) && defined(HAVE_REPLICATION)
uint8
Update_rows_log_event
::
get_trg_event_map
()
uint8
Update_rows_log_event
::
get_trg_event_map
()
{
{
return
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_UPDATE
)
);
return
trg2bit
(
TRG_EVENT_UPDATE
);
}
}
#endif
#endif
...
...
sql/sql_lex.cc
View file @
e99e6f29
...
@@ -3473,12 +3473,8 @@ void LEX::set_trg_event_type_for_tables()
...
@@ -3473,12 +3473,8 @@ void LEX::set_trg_event_type_for_tables()
On a LOCK TABLE, all triggers must be pre-loaded for this TABLE_LIST
On a LOCK TABLE, all triggers must be pre-loaded for this TABLE_LIST
when opening an associated TABLE.
when opening an associated TABLE.
*/
*/
new_trg_event_map
=
static_cast
<
uint8
>
new_trg_event_map
=
trg2bit
(
TRG_EVENT_INSERT
)
|
trg2bit
(
TRG_EVENT_UPDATE
)
|
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_INSERT
))
|
trg2bit
(
TRG_EVENT_DELETE
);
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_UPDATE
))
|
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_DELETE
));
break
;
break
;
/*
/*
Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
Basic INSERT. If there is an additional ON DUPLIATE KEY UPDATE
...
@@ -3509,20 +3505,17 @@ void LEX::set_trg_event_type_for_tables()
...
@@ -3509,20 +3505,17 @@ void LEX::set_trg_event_type_for_tables()
*/
*/
case
SQLCOM_CREATE_TABLE
:
case
SQLCOM_CREATE_TABLE
:
case
SQLCOM_CREATE_SEQUENCE
:
case
SQLCOM_CREATE_SEQUENCE
:
new_trg_event_map
|=
static_cast
<
uint8
>
new_trg_event_map
|=
trg2bit
(
TRG_EVENT_INSERT
);
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_INSERT
));
break
;
break
;
/* Basic update and multi-update */
/* Basic update and multi-update */
case
SQLCOM_UPDATE
:
/* fall through */
case
SQLCOM_UPDATE
:
/* fall through */
case
SQLCOM_UPDATE_MULTI
:
case
SQLCOM_UPDATE_MULTI
:
new_trg_event_map
|=
static_cast
<
uint8
>
new_trg_event_map
|=
trg2bit
(
TRG_EVENT_UPDATE
);
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_UPDATE
));
break
;
break
;
/* Basic delete and multi-delete */
/* Basic delete and multi-delete */
case
SQLCOM_DELETE
:
/* fall through */
case
SQLCOM_DELETE
:
/* fall through */
case
SQLCOM_DELETE_MULTI
:
case
SQLCOM_DELETE_MULTI
:
new_trg_event_map
|=
static_cast
<
uint8
>
new_trg_event_map
|=
trg2bit
(
TRG_EVENT_DELETE
);
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_DELETE
));
break
;
break
;
default:
default:
break
;
break
;
...
@@ -3530,12 +3523,10 @@ void LEX::set_trg_event_type_for_tables()
...
@@ -3530,12 +3523,10 @@ void LEX::set_trg_event_type_for_tables()
switch
(
duplicates
)
{
switch
(
duplicates
)
{
case
DUP_UPDATE
:
case
DUP_UPDATE
:
new_trg_event_map
|=
static_cast
<
uint8
>
new_trg_event_map
|=
trg2bit
(
TRG_EVENT_UPDATE
);
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_UPDATE
));
break
;
break
;
case
DUP_REPLACE
:
case
DUP_REPLACE
:
new_trg_event_map
|=
static_cast
<
uint8
>
new_trg_event_map
|=
trg2bit
(
TRG_EVENT_DELETE
);
(
1
<<
static_cast
<
int
>
(
TRG_EVENT_DELETE
));
break
;
break
;
case
DUP_ERROR
:
case
DUP_ERROR
:
default:
default:
...
...
sql/sql_trigger.cc
View file @
e99e6f29
...
@@ -2192,8 +2192,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
...
@@ -2192,8 +2192,7 @@ bool Table_triggers_list::process_triggers(THD *thd,
This trigger must have been processed by the pre-locking
This trigger must have been processed by the pre-locking
algorithm.
algorithm.
*/
*/
DBUG_ASSERT
(
trigger_table
->
pos_in_table_list
->
trg_event_map
&
DBUG_ASSERT
(
trigger_table
->
pos_in_table_list
->
trg_event_map
&
trg2bit
(
event
));
static_cast
<
uint
>
(
1
<<
static_cast
<
int
>
(
event
)));
thd
->
reset_sub_statement_state
(
&
statement_state
,
SUB_STMT_TRIGGER
);
thd
->
reset_sub_statement_state
(
&
statement_state
,
SUB_STMT_TRIGGER
);
...
@@ -2245,8 +2244,7 @@ add_tables_and_routines_for_triggers(THD *thd,
...
@@ -2245,8 +2244,7 @@ add_tables_and_routines_for_triggers(THD *thd,
for
(
int
i
=
0
;
i
<
(
int
)
TRG_EVENT_MAX
;
i
++
)
for
(
int
i
=
0
;
i
<
(
int
)
TRG_EVENT_MAX
;
i
++
)
{
{
if
(
table_list
->
trg_event_map
&
if
(
table_list
->
trg_event_map
&
trg2bit
(
static_cast
<
trg_event_type
>
(
i
)))
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
i
)))
{
{
for
(
int
j
=
0
;
j
<
(
int
)
TRG_ACTION_MAX
;
j
++
)
for
(
int
j
=
0
;
j
<
(
int
)
TRG_ACTION_MAX
;
j
++
)
{
{
...
...
sql/sql_trigger.h
View file @
e99e6f29
...
@@ -38,6 +38,9 @@ enum trg_event_type
...
@@ -38,6 +38,9 @@ enum trg_event_type
TRG_EVENT_MAX
TRG_EVENT_MAX
};
};
static
inline
uint8
trg2bit
(
enum
trg_event_type
trg
)
{
return
static_cast
<
uint8
>
(
1
<<
static_cast
<
int
>
(
trg
));
}
#include "table.h"
/* GRANT_INFO */
#include "table.h"
/* GRANT_INFO */
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment