Problem/Motivation
If a database does not support transactional DDL, executing statements that alter the database structure in the midst of a transaction lead to the transaction to self-commit.
In our data processing layer, this is less of an edge case than we may think, especially since when we started creating tables dynamically and not via the hook_schema() called at installation time.
While PostgreSql and SQLite allow transactional DDL, MySQL does not. In the current PDO MySQL driver we can adjust (=reset) the transaction stack when this happens, because it allows to detect if a transaction is active on the client directly. However, in the to-be mysqli driver this is not possible because there is not such a method - we will have to try and interpret exceptions (if they are thrown).
In both cases, though, this would be reactive rather than proactive.
Proposed resolution
1) Introduce a Connection::executeDdlStatement method that, in case of unsupported transactional DDL, will preventively commit an active transaction if it exists and make the necessary adjustments in TransactionManager BEFORE the DDL statement is executed. In other words, get to execute the DDL statement with NO transaction active.
2) Change in the Schema classes the Connection::query calls that execute DDL to use Connection::executeDdlStatement instead.