public static async Task VerifyTableForTriggerSupported()

in src/MySqlBindingUtilities.cs [75:96]


        public static async Task VerifyTableForTriggerSupported(MySqlConnection connection, string tableName, ILogger logger, CancellationToken cancellationToken)
        {
            string verifyTableExistQuery = $"SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '{tableName}'";
            using (var verifyTableExistCommand = new MySqlCommand(verifyTableExistQuery, connection))
            using (MySqlDataReader reader = verifyTableExistCommand.ExecuteReaderWithLogging(logger))
            {
                if (!await reader.ReadAsync(cancellationToken))
                {
                    throw new InvalidOperationException($"Could not find the specified table in the database.");
                }
            }

            string verifyTableSupportedQuery = $"SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '{tableName}' AND COLUMN_NAME = '{UpdateAtColumnName}'";
            using (var verifyTableSupportedCommand = new MySqlCommand(verifyTableSupportedQuery, connection))
            using (MySqlDataReader reader = verifyTableSupportedCommand.ExecuteReaderWithLogging(logger))
            {
                if (!await reader.ReadAsync(cancellationToken))
                {
                    throw new InvalidOperationException($"The specified table does not have the column named '{UpdateAtColumnName}', hence trigger binding cannot be created on this table.");
                }
            }
        }