public static int DropDatabase(string databaseName)
        {
            OdbcIntegrationTestHelper.CloseAllOdbcConnections();

            using (var con = new OdbcConnection(MasterConnectionString))
            {
                con.Open();

                ExecuteNonQuery(string.Format(CultureInfo.InvariantCulture, "SELECT SYSLIB.AbortSessions(1, '{0}', 0, 'Y', 'Y');", User), con);
                ExecuteNonQuery("DELETE DATABASE " + '"' + databaseName + '"', con);
                return(ExecuteNonQuery("DROP DATABASE " + '"' + databaseName + '"', con));
            }
        }
Ejemplo n.º 2
0
        public int DropDatabase(string databaseName)
        {
            OdbcIntegrationTestHelper.CloseAllOdbcConnections();

            using (var con = new OdbcConnection(MasterConnectionString))
            {
                con.Open();

                using (var com = new OdbcCommand("DROP USER " + databaseName + " CASCADE", con))
                {
                    try
                    {
                        Console.WriteLine("Executing: {0}", com.CommandText);
                        return(com.ExecuteNonQuery());
                    }
                    catch (OdbcException)
                    {
                        return(-1);
                    }
                }
            }
        }