コード例 #1
0
        public void CreateDatabaseUnicode()
        {
            DestroyDatabase();
            String connectionString = StackHashSqlConfiguration.DefaultMaster.ToConnectionString();

            SqlCommands commands = new SqlCommands(m_ProviderFactory, connectionString, connectionString, 1);


            commands.CreateDatabase(m_ErrorIndexPath, "\u125c" + SqlUtils.UnitTestDatabase + "\u125c", false);

            Assert.AreEqual(true, commands.DatabaseExists(SqlUtils.UnitTestDatabase));

            commands.DeleteDatabase(SqlUtils.UnitTestDatabase);
        }
コード例 #2
0
        public void DestroyDatabase()
        {
            String connectionString = StackHashSqlConfiguration.DefaultMaster.ToConnectionString();

            SqlCommands commands = new SqlCommands(m_ProviderFactory, connectionString, connectionString, 1);

            String databaseName = s_UnitTestDatabase;

            if (!commands.DatabaseExists(databaseName))
            {
                bool stackHashDbaseExists = commands.CreateDatabase(m_ErrorIndexPath, databaseName, false);
                Assert.AreEqual(true, stackHashDbaseExists);
            }

            commands.DeleteDatabase(databaseName);

            Assert.AreEqual(false, commands.DatabaseExists(databaseName));
        }
コード例 #3
0
        public void OpenCloseConnectionDatabaseExists()
        {
            String connectionString = StackHashSqlConfiguration.DefaultMaster.ToConnectionString();

            SqlCommands commands = new SqlCommands(m_ProviderFactory, connectionString, connectionString, 1);

            bool stackHashDbaseExists;

            if (!commands.DatabaseExists(SqlUtils.UnitTestDatabase))
            {
                stackHashDbaseExists = commands.CreateDatabase(m_ErrorIndexPath, SqlUtils.UnitTestDatabase, false);
                Assert.AreEqual(true, stackHashDbaseExists);
            }

            stackHashDbaseExists = commands.DatabaseExists(SqlUtils.UnitTestDatabase);
            Assert.AreEqual(true, stackHashDbaseExists);

            commands.DeleteDatabase(SqlUtils.UnitTestDatabase);
        }
コード例 #4
0
        public void ChangeLogicalNamesDefaultLocation()
        {
            DestroyDatabase();
            String connectionString = StackHashSqlConfiguration.DefaultMaster.ToConnectionString();

            SqlCommands commands = new SqlCommands(m_ProviderFactory, connectionString, connectionString, 1);

            commands.CreateDatabase(m_ErrorIndexPath, SqlUtils.UnitTestDatabase, true); // Create in default location.

            Assert.AreEqual(true, commands.DatabaseExists(SqlUtils.UnitTestDatabase));

            Collection <String> logicalFileNames = commands.GetLogicalFileNames(SqlUtils.UnitTestDatabase);

            Assert.AreNotEqual(null, logicalFileNames);
            Assert.AreEqual(2, logicalFileNames.Count);

            String expectedDatLogicalFile = SqlUtils.UnitTestDatabase;
            String expectedLogLogicalFile = SqlUtils.UnitTestDatabase + "_log";

            Assert.AreEqual(0, String.Compare(expectedDatLogicalFile, logicalFileNames[0], StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual(0, String.Compare(expectedLogLogicalFile, logicalFileNames[1], StringComparison.OrdinalIgnoreCase));

            // Now change the logical filenames.
            String newDatabaseName = "ChangeTest";

            Assert.AreEqual(true, commands.ChangeDatabaseLogicalNames(SqlUtils.UnitTestDatabase, newDatabaseName, false));

            logicalFileNames = commands.GetLogicalFileNames(SqlUtils.UnitTestDatabase);

            Assert.AreNotEqual(null, logicalFileNames);
            Assert.AreEqual(2, logicalFileNames.Count);

            expectedDatLogicalFile = newDatabaseName;
            expectedLogLogicalFile = newDatabaseName + "_log";

            Assert.AreEqual(0, String.Compare(expectedDatLogicalFile, logicalFileNames[0], StringComparison.OrdinalIgnoreCase));
            Assert.AreEqual(0, String.Compare(expectedLogLogicalFile, logicalFileNames[1], StringComparison.OrdinalIgnoreCase));



            commands.DeleteDatabase(SqlUtils.UnitTestDatabase);
        }