Skip to content

Commit

Permalink
handle exception
Browse files Browse the repository at this point in the history
  • Loading branch information
area363 committed Jun 10, 2024
1 parent d9773f1 commit d176a90
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,19 @@ string mysqlDatabase
DateTimeOffset postDataPrep = DateTimeOffset.Now;
Console.WriteLine("Data Preparation Complete! Time Elapsed: {0}", postDataPrep - start);

// Disable foreign key checks
MySqlCommand disableForeignKeyCheck = new MySqlCommand("SET foreign_key_checks = 0;", connection);
disableForeignKeyCheck.ExecuteNonQuery();

// Perform bulk insert operation
foreach (var path in _avatarFiles)
{
BulkInsert(AvatarDbName, path);
}

// Re-enable foreign key checks
MySqlCommand enableForeignKeyCheck = new MySqlCommand("SET foreign_key_checks = 1;", connection);
enableForeignKeyCheck.ExecuteNonQuery();
}
catch (Exception)
{
Expand Down

0 comments on commit d176a90

Please sign in to comment.