GetDatabaseNames() public méthode

Returns the names of all Databases in this Environment
This method wraps the native ups_env_get_database_names function.
This function returns the names of all Databases and the number of Databases in an Environment.
public GetDatabaseNames ( ) : short[]
Résultat short[]
Exemple #1
0
        private void GetDatabaseNames()
        {
            Database db;

            short[] names;
            short[] s1 = { 13 };
            short[] s2 = { 13, 14 };
            short[] s3 = { 13, 14, 15 };
            Upscaledb.Environment env = new Upscaledb.Environment();

            env.Create("ntest.db");
            db    = env.CreateDatabase(13);
            names = env.GetDatabaseNames();
            Assert.AreEqual(s1.Length, names.Length);
            for (int i = 0; i < s1.Length; i++)
            {
                Assert.AreEqual(s1[i], names[i]);
            }

            db    = env.CreateDatabase(14);
            names = env.GetDatabaseNames();
            Assert.AreEqual(s2.Length, names.Length);
            for (int i = 0; i < s2.Length; i++)
            {
                Assert.AreEqual(s2[i], names[i]);
            }

            db    = env.CreateDatabase(15);
            names = env.GetDatabaseNames();
            Assert.AreEqual(s3.Length, names.Length);
            for (int i = 0; i < s3.Length; i++)
            {
                Assert.AreEqual(s3[i], names[i]);
            }

            env.Close();
        }
        private void GetDatabaseNames()
        {
            Database db;
            short[] names;
            short[] s1 ={ 13 };
            short[] s2 ={ 13, 14 };
            short[] s3 ={ 13, 14, 15 };
            Upscaledb.Environment env = new Upscaledb.Environment();

            env.Create("ntest.db");
            db = env.CreateDatabase(13);
            names = env.GetDatabaseNames();
            Assert.AreEqual(s1.Length, names.Length);
            for (int i = 0; i < s1.Length; i++)
                Assert.AreEqual(s1[i], names[i]);

            db = env.CreateDatabase(14);
            names = env.GetDatabaseNames();
            Assert.AreEqual(s2.Length, names.Length);
            for (int i = 0; i < s2.Length; i++)
                Assert.AreEqual(s2[i], names[i]);

            db = env.CreateDatabase(15);
            names = env.GetDatabaseNames();
            Assert.AreEqual(s3.Length, names.Length);
            for (int i = 0; i < s3.Length; i++)
                Assert.AreEqual(s3[i], names[i]);

            env.Close();
        }