MDEV-27766: connect engine; INSERT ignore option, was ignored
Test prior to this change: CURRENT_TEST: connect.mysql mysqltest: At line 485: query 'INSERT IGNORE INTO t3 VALUES (5),(10),(30)' failed: ER_GET_ERRMSG (1296): Got error 122 '(1062) Duplicate entry '10' for key 'PRIMARY' [INSERT INTO `t1` (`a`) VALUES (10)]' from CONNECT So the ignore table option wasn't getting passed to the remove server. Closes #2008
This commit is contained in:
parent
ace2e0301e
commit
b59bc629c8
@ -294,3 +294,15 @@ a
|
|||||||
30
|
30
|
||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# MDEV-27766 CONNECT Engine Support for INSERT IGNORE with Mysql Table type
|
||||||
|
#
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
INSERT INTO t1 VALUES (10),(20),(30);
|
||||||
|
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:PORT/test/t1' OPTION_LIST="Delayed=1,Ignored=1";
|
||||||
|
INSERT INTO t2 VALUES (10),(20),(30),(40);
|
||||||
|
DROP TABLE t2;
|
||||||
|
DROP TABLE t1;
|
||||||
|
#
|
||||||
|
# End of 10.3 tests
|
||||||
|
#
|
||||||
|
@ -470,3 +470,19 @@ SELECT * FROM t2;
|
|||||||
DROP TABLE t2;
|
DROP TABLE t2;
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-27766 CONNECT Engine Support for INSERT IGNORE with Mysql Table type
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE TABLE t1 (a INT PRIMARY KEY);
|
||||||
|
INSERT INTO t1 VALUES (10),(20),(30);
|
||||||
|
--replace_result $PORT PORT
|
||||||
|
--eval CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:$PORT/test/t1' OPTION_LIST="Delayed=1,Ignored=1"
|
||||||
|
INSERT INTO t2 VALUES (10),(20),(30),(40);
|
||||||
|
DROP TABLE t2;
|
||||||
|
DROP TABLE t1;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # End of 10.3 tests
|
||||||
|
--echo #
|
||||||
|
@ -94,6 +94,7 @@ MYSQLDEF::MYSQLDEF(void)
|
|||||||
Isview = false;
|
Isview = false;
|
||||||
Bind = false;
|
Bind = false;
|
||||||
Delayed = false;
|
Delayed = false;
|
||||||
|
Ignored = false;
|
||||||
//Xsrc = false;
|
//Xsrc = false;
|
||||||
Huge = false;
|
Huge = false;
|
||||||
} // end of MYSQLDEF constructor
|
} // end of MYSQLDEF constructor
|
||||||
@ -321,6 +322,9 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
|
|||||||
|
|
||||||
Desc = "MySQL Table";
|
Desc = "MySQL Table";
|
||||||
|
|
||||||
|
Delayed = !!GetIntCatInfo("Delayed", 0);
|
||||||
|
Ignored = !!GetIntCatInfo("Ignored", 0);
|
||||||
|
|
||||||
if (stricmp(am, "MYPRX")) {
|
if (stricmp(am, "MYPRX")) {
|
||||||
// Normal case of specific MYSQL table
|
// Normal case of specific MYSQL table
|
||||||
url = GetStringCatInfo(g, "Connect", NULL);
|
url = GetStringCatInfo(g, "Connect", NULL);
|
||||||
@ -339,7 +343,6 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
Bind = !!GetIntCatInfo("Bind", 0);
|
Bind = !!GetIntCatInfo("Bind", 0);
|
||||||
Delayed = !!GetIntCatInfo("Delayed", 0);
|
|
||||||
} else {
|
} else {
|
||||||
// MYSQL access from a PROXY table
|
// MYSQL access from a PROXY table
|
||||||
TABLE_SHARE* s;
|
TABLE_SHARE* s;
|
||||||
@ -425,6 +428,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp)
|
|||||||
Isview = tdp->Isview;
|
Isview = tdp->Isview;
|
||||||
Prep = tdp->Bind;
|
Prep = tdp->Bind;
|
||||||
Delayed = tdp->Delayed;
|
Delayed = tdp->Delayed;
|
||||||
|
Ignored = tdp->Ignored;
|
||||||
Myc.m_Use = tdp->Huge;
|
Myc.m_Use = tdp->Huge;
|
||||||
} else {
|
} else {
|
||||||
Host = NULL;
|
Host = NULL;
|
||||||
@ -440,6 +444,7 @@ TDBMYSQL::TDBMYSQL(PMYDEF tdp) : TDBEXT(tdp)
|
|||||||
Isview = false;
|
Isview = false;
|
||||||
Prep = false;
|
Prep = false;
|
||||||
Delayed = false;
|
Delayed = false;
|
||||||
|
Ignored = false;
|
||||||
} // endif tdp
|
} // endif tdp
|
||||||
|
|
||||||
Bind = NULL;
|
Bind = NULL;
|
||||||
@ -466,6 +471,7 @@ TDBMYSQL::TDBMYSQL(PTDBMY tdbp) : TDBEXT(tdbp)
|
|||||||
Isview = tdbp->Isview;
|
Isview = tdbp->Isview;
|
||||||
Prep = tdbp->Prep;
|
Prep = tdbp->Prep;
|
||||||
Delayed = tdbp->Delayed;
|
Delayed = tdbp->Delayed;
|
||||||
|
Ignored = tdbp->Ignored;
|
||||||
Bind = NULL;
|
Bind = NULL;
|
||||||
//Query = tdbp->Query;
|
//Query = tdbp->Query;
|
||||||
Fetched = tdbp->Fetched;
|
Fetched = tdbp->Fetched;
|
||||||
@ -623,11 +629,13 @@ bool TDBMYSQL::MakeInsert(PGLOBAL g)
|
|||||||
len += (strlen(TableName) + 40);
|
len += (strlen(TableName) + 40);
|
||||||
Query = new(g) STRING(g, len);
|
Query = new(g) STRING(g, len);
|
||||||
|
|
||||||
|
Query->Set("INSERT ");
|
||||||
if (Delayed)
|
if (Delayed)
|
||||||
Query->Set("INSERT DELAYED INTO ");
|
Query->Append("DELAYED ");
|
||||||
else
|
if (Ignored)
|
||||||
Query->Set("INSERT INTO ");
|
Query->Append("IGNORE ");
|
||||||
|
|
||||||
|
Query->Append("INTO ");
|
||||||
Query->Append(tk);
|
Query->Append(tk);
|
||||||
Query->Append(TableName);
|
Query->Append(TableName);
|
||||||
Query->Append("` (");
|
Query->Append("` (");
|
||||||
|
@ -60,6 +60,7 @@ class MYSQLDEF : public EXTDEF {/* Logical table description */
|
|||||||
bool Isview; /* true if this table is a MySQL view */
|
bool Isview; /* true if this table is a MySQL view */
|
||||||
bool Bind; /* Use prepared statement on insert */
|
bool Bind; /* Use prepared statement on insert */
|
||||||
bool Delayed; /* Delayed insert */
|
bool Delayed; /* Delayed insert */
|
||||||
|
bool Ignored; /* Use insert IGNORE */
|
||||||
//bool Xsrc; /* Execution type */
|
//bool Xsrc; /* Execution type */
|
||||||
bool Huge; /* True for big table */
|
bool Huge; /* True for big table */
|
||||||
}; // end of MYSQLDEF
|
}; // end of MYSQLDEF
|
||||||
@ -132,6 +133,7 @@ class TDBMYSQL : public TDBEXT {
|
|||||||
bool Isview; // True if this table is a MySQL view
|
bool Isview; // True if this table is a MySQL view
|
||||||
bool Prep; // Use prepared statement on insert
|
bool Prep; // Use prepared statement on insert
|
||||||
bool Delayed; // Use delayed insert
|
bool Delayed; // Use delayed insert
|
||||||
|
bool Ignored; // Use insert IGNORE
|
||||||
int m_Rc; // Return code from command
|
int m_Rc; // Return code from command
|
||||||
//int AftRows; // The number of affected rows
|
//int AftRows; // The number of affected rows
|
||||||
int N; // The current table index
|
int N; // The current table index
|
||||||
|
Loading…
x
Reference in New Issue
Block a user