Fix running ALTER TABLE statements in Execute SQL tab

This fixes a bug introduced in 73efa11680.
Because SQLite reports ALTER TABLE statements to return one column worth
of data, DB4S assumed they are close to a SELECT statement and therefore
did not fully execute them.

See issues #2563 and #2622.
This commit is contained in:
Martin Kleusberg
2021-03-12 19:11:02 +01:00
parent e225dc1e42
commit 5d80f9877d

View File

@@ -165,8 +165,8 @@ bool RunSql::executeNextStatement()
// Get type
StatementType query_part_type = getQueryType(queryPart.trimmed());
// Check if this statement returned any data
if(sqlite3_column_count(vm))
// Check if this statement returned any data. We skip this check if this is an ALTER TABLE statement which, for some reason, are reported to return one column.
if(query_part_type != AlterStatement && sqlite3_column_count(vm))
{
// It did. So it is definitely some SELECT statement or similar and we don't need to actually execute it here
sql3status = SQLITE_ROW;