Skip to content

Commit c4e87cb

Browse files
spliticegrooverdan
authored andcommitted
MDEV-9020: Connect issues ALTER TABLE DISABLE KEYS when inserting data
If the connecting user doesn't have alter table privilege this isn't allowed. This patch removes enable / disable key commands that should never have been here Closes #2002
1 parent 31e3032 commit c4e87cb

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

storage/connect/tabmysql.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -946,15 +946,6 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
946946

947947
} // endif MakeInsert
948948

949-
if (m_Rc != RC_FX) {
950-
char cmd[64];
951-
int w;
952-
953-
sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", TableName);
954-
955-
m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines
956-
} // endif m_Rc
957-
958949
} else
959950
// m_Rc = (Mode == MODE_DELETE) ? MakeDelete(g) : MakeUpdate(g);
960951
m_Rc = (MakeCommand(g)) ? RC_FX : RC_OK;
@@ -1216,16 +1207,6 @@ int TDBMYSQL::DeleteDB(PGLOBAL g, int irc)
12161207
void TDBMYSQL::CloseDB(PGLOBAL g)
12171208
{
12181209
if (Myc.Connected()) {
1219-
if (Mode == MODE_INSERT) {
1220-
char cmd[64];
1221-
int w;
1222-
PDBUSER dup = PlgGetUser(g);
1223-
1224-
dup->Step = "Enabling indexes";
1225-
sprintf(cmd, "ALTER TABLE `%s` ENABLE KEYS", TableName);
1226-
Myc.m_Rows = -1; // To execute the query
1227-
m_Rc = Myc.ExecSQL(g, cmd, &w); // May fail for some engines
1228-
} // endif m_Rc
12291210

12301211
Myc.Close();
12311212
} // endif Myc

0 commit comments

Comments
 (0)