Beispiel #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;
            }
        }
Beispiel #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;
            }
        }