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
95452ed6
Commit
95452ed6
authored
Apr 22, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Bug#7806 - insert on duplicate key and auto-update of timestamp
Merged fix for bugfix to 5.0. sql/table.h: Auto merged
parents
23e8267d
1f52b312
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
sql/sql_insert.cc
sql/sql_insert.cc
+6
-3
sql/table.h
sql/table.h
+10
-6
No files found.
sql/sql_insert.cc
View file @
95452ed6
...
...
@@ -103,7 +103,8 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
return
-
1
;
}
#endif
*
(
int
*
)
&
table
->
timestamp_field_type
&=
~
(
int
)
TIMESTAMP_AUTO_SET_ON_INSERT
;
clear_timestamp_auto_bits
(
table
->
timestamp_field_type
,
TIMESTAMP_AUTO_SET_ON_INSERT
);
}
else
{
// Part field list
...
...
@@ -150,7 +151,8 @@ static int check_insert_fields(THD *thd, TABLE_LIST *table_list,
}
if
(
table
->
timestamp_field
&&
// Don't set timestamp if used
table
->
timestamp_field
->
query_id
==
thd
->
query_id
)
*
(
int
*
)
&
table
->
timestamp_field_type
&=
~
(
int
)
TIMESTAMP_AUTO_SET_ON_INSERT
;
clear_timestamp_auto_bits
(
table
->
timestamp_field_type
,
TIMESTAMP_AUTO_SET_ON_INSERT
);
}
// For the values we need select_priv
#ifndef NO_EMBEDDED_ACCESS_CHECKS
...
...
@@ -216,7 +218,8 @@ static int check_update_fields(THD *thd, TABLE_LIST *insert_table_list,
{
/* Don't set timestamp column if this is modified. */
if
(
table
->
timestamp_field
->
query_id
==
thd
->
query_id
)
*
(
int
*
)
&
table
->
timestamp_field_type
&=
~
(
int
)
TIMESTAMP_AUTO_SET_ON_UPDATE
;
clear_timestamp_auto_bits
(
table
->
timestamp_field_type
,
TIMESTAMP_AUTO_SET_ON_UPDATE
);
else
table
->
timestamp_field
->
query_id
=
timestamp_query_id
;
}
...
...
sql/table.h
View file @
95452ed6
...
...
@@ -71,18 +71,22 @@ typedef struct st_filesort_info
/*
Values in this enum are used to indicate during which operations value
of TIMESTAMP field should be set to current timestamp.
WARNING: The values are used for bit operations. If you change the enum,
you must keep the bitwise relation of the values. For example:
(int) TIMESTAMP_AUTO_SET_ON_BOTH ==
(int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
Values in this enum are used to indicate how a tables TIMESTAMP field
should be treated. It can be set to the current timestamp on insert or
update or both.
WARNING: The values are used for bit operations. If you change the
enum, you must keep the bitwise relation of the values. For example:
(int) TIMESTAMP_AUTO_SET_ON_BOTH must be equal to
(int) TIMESTAMP_AUTO_SET_ON_INSERT | (int) TIMESTAMP_AUTO_SET_ON_UPDATE.
We use an enum here so that the debugger can display the value names.
*/
enum
timestamp_auto_set_type
{
TIMESTAMP_NO_AUTO_SET
=
0
,
TIMESTAMP_AUTO_SET_ON_INSERT
=
1
,
TIMESTAMP_AUTO_SET_ON_UPDATE
=
2
,
TIMESTAMP_AUTO_SET_ON_BOTH
=
3
};
#define clear_timestamp_auto_bits(_target_, _bits_) \
(_target_)= (enum timestamp_auto_set_type)((int)(_target_) & ~(int)(_bits_))
class
Field_timestamp
;
class
Field_blob
;
...
...
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