Пример #1
0
 private DataTable ExecuteQuery(string query)
 {
     using (var connection = new LegacyDatabaseConnection(connectionString))
     {
         return(connection.Execute(query));
     }
 }
Пример #2
0
 public Participant Get(long id)
 {
     try
     {
         using (var connection = new LegacyDatabaseConnection(connectionString))
         {
             var dataTable = connection.Execute($"Select...{id}");
             return(GetParticipant(dataTable));
         }
     }
     catch (DatabaseNotFoundException e)
     {
         Logger.Log($"DB {e.Database} not found in server {e.Server}.");
         throw;
         //throw e;
     }
     catch (AccessDeniedException e)
     {
         //We know that actual reason is size of a table
         Logger.Log($"Table {e.Table} size exceeded in {e.Server}.{e.Database}");
         throw;
     }
     catch (InvalidSQLOperationException e) when(e.Code == "SQL_BUSY")
     {
         //another connection is using the database
         //Retry;
         return(Get(id));
     }
     catch (InvalidSQLOperationException e)
     {
         Logger.Log(e.Message);
         throw;
     }
     catch (TimeoutException e)
     {
         //Retry
         return(Get(id));
     }
 }