summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorunknown <jan@hundin.mysql.fi>2004-10-15 11:28:19 +0300
committerunknown <jan@hundin.mysql.fi>2004-10-15 11:28:19 +0300
commit1927d24ec0aa7589f370564c09686d8edcfeef32 (patch)
tree6381a679c742567c4419849501278ea4192605d3 /innobase
parenta55e476913aec3e2e1bdb5301b2dc581f7b268e0 (diff)
downloadmariadb-git-1927d24ec0aa7589f370564c09686d8edcfeef32.tar.gz
Use already parsed SQL-query in the current thread when determining
was the query REPLACE or LOAD DATA INFILE REPLACE. innobase/row/row0ins.c: Find SQL-query directly from current thread and see if the query was REPLACE or LOAD DATA INFILE REPLACE. sql/ha_innodb.cc: Find current thread and return true if SQL-query in the current thread was either REPLACE or LOAD DATA INFILE REPLACE.
Diffstat (limited to 'innobase')
-rw-r--r--innobase/row/row0ins.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/innobase/row/row0ins.c b/innobase/row/row0ins.c
index 3008d6a3812..c9c784403c8 100644
--- a/innobase/row/row0ins.c
+++ b/innobase/row/row0ins.c
@@ -50,6 +50,15 @@ innobase_invalidate_query_cache(
ulint full_name_len); /* in: full name length where also the null
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. */
@@ -1524,10 +1533,7 @@ row_ins_scan_sec_index_for_duplicate(
trx = thr_get_trx(thr);
ut_ad(trx);
- ptr = dict_scan_to(*(trx->mysql_query_str),
- "REPLACE");
-
- if ( ptr && *ptr != '\0') {
+ if (innobase_query_is_replace()) {
/* The manual defines the REPLACE semantics that it
is either an INSERT or DELETE(s) for duplicate key
@@ -1641,9 +1647,7 @@ row_ins_duplicate_error_in_clust(
sure that in roll-forward we get the same duplicate
errors as in original execution */
- ptr = dict_scan_to(*(trx->mysql_query_str), "REPLACE");
-
- if (ptr && *ptr != '\0') {
+ if (innobase_query_is_replace()) {
/* The manual defines the REPLACE semantics
that it is either an INSERT or DELETE(s)
@@ -1686,9 +1690,7 @@ row_ins_duplicate_error_in_clust(
+ INSERT. Therefore, we should take X-lock for
duplicates. */
- ptr = dict_scan_to(*(trx->mysql_query_str), "REPLACE");
-
- if (ptr && *ptr != '\0') {
+ if (innobase_query_is_replace()) {
err = row_ins_set_exclusive_rec_lock(
LOCK_REC_NOT_GAP,