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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
f45aacd9
Commit
f45aacd9
authored
Oct 15, 2004
by
jan@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use already parsed SQL-query in the current thread when determining
was the query REPLACE or LOAD DATA INFILE REPLACE.
parent
d0930b8e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
10 deletions
+37
-10
innobase/row/row0ins.c
innobase/row/row0ins.c
+12
-10
sql/ha_innodb.cc
sql/ha_innodb.cc
+25
-0
No files found.
innobase/row/row0ins.c
View file @
f45aacd9
...
@@ -50,6 +50,15 @@ innobase_invalidate_query_cache(
...
@@ -50,6 +50,15 @@ innobase_invalidate_query_cache(
ulint
full_name_len
);
/* in: full name length where also the null
ulint
full_name_len
);
/* in: full name length where also the null
chars count */
chars count */
/**********************************************************************
This function returns true if SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
innobase_query_is_replace
(
void
);
/*===========================*/
/*************************************************************************
/*************************************************************************
Creates an insert node struct. */
Creates an insert node struct. */
...
@@ -1524,10 +1533,7 @@ row_ins_scan_sec_index_for_duplicate(
...
@@ -1524,10 +1533,7 @@ row_ins_scan_sec_index_for_duplicate(
trx
=
thr_get_trx
(
thr
);
trx
=
thr_get_trx
(
thr
);
ut_ad
(
trx
);
ut_ad
(
trx
);
ptr
=
dict_scan_to
(
*
(
trx
->
mysql_query_str
),
if
(
innobase_query_is_replace
())
{
"REPLACE"
);
if
(
ptr
&&
*
ptr
!=
'\0'
)
{
/* The manual defines the REPLACE semantics that it
/* The manual defines the REPLACE semantics that it
is either an INSERT or DELETE(s) for duplicate key
is either an INSERT or DELETE(s) for duplicate key
...
@@ -1641,9 +1647,7 @@ row_ins_duplicate_error_in_clust(
...
@@ -1641,9 +1647,7 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
sure that in roll-forward we get the same duplicate
errors as in original execution */
errors as in original execution */
ptr
=
dict_scan_to
(
*
(
trx
->
mysql_query_str
),
"REPLACE"
);
if
(
innobase_query_is_replace
())
{
if
(
ptr
&&
*
ptr
!=
'\0'
)
{
/* The manual defines the REPLACE semantics
/* The manual defines the REPLACE semantics
that it is either an INSERT or DELETE(s)
that it is either an INSERT or DELETE(s)
...
@@ -1686,9 +1690,7 @@ row_ins_duplicate_error_in_clust(
...
@@ -1686,9 +1690,7 @@ row_ins_duplicate_error_in_clust(
+ INSERT. Therefore, we should take X-lock for
+ INSERT. Therefore, we should take X-lock for
duplicates. */
duplicates. */
ptr
=
dict_scan_to
(
*
(
trx
->
mysql_query_str
),
"REPLACE"
);
if
(
innobase_query_is_replace
())
{
if
(
ptr
&&
*
ptr
!=
'\0'
)
{
err
=
row_ins_set_exclusive_rec_lock
(
err
=
row_ins_set_exclusive_rec_lock
(
LOCK_REC_NOT_GAP
,
LOCK_REC_NOT_GAP
,
...
...
sql/ha_innodb.cc
View file @
f45aacd9
...
@@ -5468,4 +5468,29 @@ innobase_get_at_most_n_mbchars(
...
@@ -5468,4 +5468,29 @@ innobase_get_at_most_n_mbchars(
}
}
}
}
extern
"C"
{
/**********************************************************************
This function returns true if SQL-query in the current thread
is either REPLACE or LOAD DATA INFILE REPLACE.
NOTE that /mysql/innobase/row/row0ins.c must contain the
prototype for this function ! */
ibool
innobase_query_is_replace
(
void
)
/*===========================*/
{
THD
*
thd
;
thd
=
(
THD
*
)
innobase_current_thd
();
if
(
thd
->
lex
->
sql_command
==
SQLCOM_REPLACE
||
(
thd
->
lex
->
sql_command
==
SQLCOM_LOAD
&&
thd
->
lex
->
duplicates
==
DUP_REPLACE
))
{
return
true
;
}
else
{
return
false
;
}
}
}
#endif
/* HAVE_INNOBASE_DB */
#endif
/* HAVE_INNOBASE_DB */
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