Loading mysql-test/r/ndb_replace.result +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); insert into t1 (gesuchnr,benutzer_id) values (1,1); ERROR 23000: Can't write; duplicate key in table 't1' ERROR 23000: Duplicate entry '1-1' for key 1 replace into t1 (gesuchnr,benutzer_id) values (1,1); select * from t1 order by gesuchnr; gesuchnr benutzer_id Loading mysql-test/t/ndb_replace.test +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1); insert into t1 (gesuchnr, benutzer_id) value (3,2); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); --error 1022 --error 1062 insert into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); select * from t1 order by gesuchnr; Loading sql/ha_ndbcluster.cc +14 −3 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ static int ndb_to_mysql_error(const NdbError *err) int ha_ndbcluster::ndb_err(NdbConnection *trans) { int res; const NdbError err= trans->getNdbError(); if (!err.code) return 0; // Don't log things to DBUG log if no error Loading @@ -161,7 +162,13 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans) default: break; } DBUG_RETURN(ndb_to_mysql_error(&err)); res= ndb_to_mysql_error(&err); DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d", err.code, res)); if (res == HA_ERR_FOUND_DUPP_KEY) dupkey= table->primary_key; DBUG_RETURN(res); } Loading Loading @@ -2167,7 +2174,10 @@ void ha_ndbcluster::info(uint flag) if (flag & HA_STATUS_VARIABLE) DBUG_PRINT("info", ("HA_STATUS_VARIABLE")); if (flag & HA_STATUS_ERRKEY) { DBUG_PRINT("info", ("HA_STATUS_ERRKEY")); errkey= dupkey; } if (flag & HA_STATUS_AUTO) DBUG_PRINT("info", ("HA_STATUS_AUTO")); DBUG_VOID_RETURN; Loading Loading @@ -3126,7 +3136,8 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg): ops_pending(0), skip_auto_increment(true), blobs_buffer(0), blobs_buffer_size(0) blobs_buffer_size(0), dupkey((uint) -1) { int i; Loading sql/ha_ndbcluster.h +1 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,7 @@ class ha_ndbcluster: public handler // memory for blobs in one tuple char *blobs_buffer; uint32 blobs_buffer_size; uint dupkey; }; bool ndbcluster_init(void); Loading Loading
mysql-test/r/ndb_replace.result +1 −1 Original line number Diff line number Diff line Loading @@ -11,7 +11,7 @@ insert into t1 (gesuchnr, benutzer_id) value (3,2); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); insert into t1 (gesuchnr,benutzer_id) values (1,1); ERROR 23000: Can't write; duplicate key in table 't1' ERROR 23000: Duplicate entry '1-1' for key 1 replace into t1 (gesuchnr,benutzer_id) values (1,1); select * from t1 order by gesuchnr; gesuchnr benutzer_id Loading
mysql-test/t/ndb_replace.test +1 −1 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ replace into t1 (gesuchnr,benutzer_id) values (1,1); insert into t1 (gesuchnr, benutzer_id) value (3,2); replace into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); --error 1022 --error 1062 insert into t1 (gesuchnr,benutzer_id) values (1,1); replace into t1 (gesuchnr,benutzer_id) values (1,1); select * from t1 order by gesuchnr; Loading
sql/ha_ndbcluster.cc +14 −3 Original line number Diff line number Diff line Loading @@ -144,6 +144,7 @@ static int ndb_to_mysql_error(const NdbError *err) int ha_ndbcluster::ndb_err(NdbConnection *trans) { int res; const NdbError err= trans->getNdbError(); if (!err.code) return 0; // Don't log things to DBUG log if no error Loading @@ -161,7 +162,13 @@ int ha_ndbcluster::ndb_err(NdbConnection *trans) default: break; } DBUG_RETURN(ndb_to_mysql_error(&err)); res= ndb_to_mysql_error(&err); DBUG_PRINT("info", ("transformed ndbcluster error %d to mysql error %d", err.code, res)); if (res == HA_ERR_FOUND_DUPP_KEY) dupkey= table->primary_key; DBUG_RETURN(res); } Loading Loading @@ -2167,7 +2174,10 @@ void ha_ndbcluster::info(uint flag) if (flag & HA_STATUS_VARIABLE) DBUG_PRINT("info", ("HA_STATUS_VARIABLE")); if (flag & HA_STATUS_ERRKEY) { DBUG_PRINT("info", ("HA_STATUS_ERRKEY")); errkey= dupkey; } if (flag & HA_STATUS_AUTO) DBUG_PRINT("info", ("HA_STATUS_AUTO")); DBUG_VOID_RETURN; Loading Loading @@ -3126,7 +3136,8 @@ ha_ndbcluster::ha_ndbcluster(TABLE *table_arg): ops_pending(0), skip_auto_increment(true), blobs_buffer(0), blobs_buffer_size(0) blobs_buffer_size(0), dupkey((uint) -1) { int i; Loading
sql/ha_ndbcluster.h +1 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,7 @@ class ha_ndbcluster: public handler // memory for blobs in one tuple char *blobs_buffer; uint32 blobs_buffer_size; uint dupkey; }; bool ndbcluster_init(void); Loading