Exemple #1
0
        public static DatabaseModel.Columns CreateTestTable(string createTableStatement, ConnectionType connectionType)
        {
            try
            {
                RemoveTestTable(connectionType);
            }
            catch { }

            try
            {
                DatabaseHelpers.ExecuteSqlStatement(createTableStatement, connectionType);

                DatabaseAssistant databaseAssistant = DatabaseAssistant.GetDatabaseAssistant(connectionType);
                using (var connection = databaseAssistant.CreateConnection(DatabaseHelpers.GetDefaultConnectionString(connectionType)))
                {
                    connection.Open();
                    return(new DatabaseModel.Columns(databaseAssistant.GetTableColumns(connection, "TESTTABLE")));
                }
            }
            catch
            {
                try
                {
                    RemoveTestTable(connectionType);
                }
                catch { }
                throw;
            }
        }
Exemple #2
0
        public static DatabaseModel.ProcedureParameters CreateTestProc(string createProcedureStatement, ConnectionType connectionType)
        {
            try
            {
                RemoveTestProc(connectionType);
            }
            catch { }

            try
            {
                DatabaseHelpers.ExecuteSqlStatement(createProcedureStatement, connectionType);

                DatabaseAssistant databaseAssistant = DatabaseAssistant.GetDatabaseAssistant(connectionType);
                using (var connection = databaseAssistant.CreateConnection(DatabaseHelpers.GetDefaultConnectionString(connectionType)))
                {
                    connection.Open();
                    return(new DatabaseModel.ProcedureParameters(databaseAssistant.GetStoredProcedureParameters(connection, "Test Proc")));
                }
            }
            catch
            {
                try
                {
                    RemoveTestProc(connectionType);
                }
                catch { }
                throw;
            }
        }
Exemple #3
0
        internal static void CreateTestFunction(string createFunctionStatement, ConnectionType connectionType)
        {
            try
            {
                RemoveTestFunction(connectionType);
            }
            catch { }

            try
            {
                DatabaseHelpers.ExecuteSqlStatement(createFunctionStatement, connectionType);
            }
            catch
            {
                try
                {
                    RemoveTestFunction(connectionType);
                }
                catch { }
                throw;
            }
        }
Exemple #4
0
 public static void RemoveTestTable(ConnectionType connectionType)
 {
     DatabaseHelpers.ExecuteSqlStatement(@"DROP TABLE TESTTABLE", connectionType);
 }
Exemple #5
0
 internal static void RemoveTestFunction(ConnectionType connectionType)
 {
     DatabaseHelpers.ExecuteSqlStatement("DROP Function TestFunction", connectionType);
 }
Exemple #6
0
 public static void RemoveTestProc(ConnectionType connectionType)
 {
     DatabaseHelpers.ExecuteSqlStatement("DROP PROCEDURE \"Test Proc\"", connectionType);
 }