コード例 #1
0
ファイル: Common.cs プロジェクト: horizon3d/SequoiaDB
        // create collection, if the collection exists then return
        public static DBCollection CreateColleciton(CollectionSpace cs, string cName)
        {
            DBCollection dbc = null;
            try
            {
                dbc = cs.CreateCollection(cName);
            }
            catch (BaseException e)
            {
                // verify whether the collection space exists
                if ("SDB_DMS_CS_NOTEXIST" == e.ErrorType)
                {
                    cs = CreateCollecitonSpace(cs.SequoiaDB, cs.Name);
                    dbc = CreateColleciton(cs, cName);
                }
                // verify whether the collection space exists
                else if ("SDB_DMS_EXIST" == e.ErrorType)
                    dbc = GetColleciton(cs, cName);
                else
                {
                    Console.WriteLine("Failed to create collection {0},ErrorType = {1}", cName, e.ErrorType);
                    Environment.Exit(0);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Environment.Exit(0);
            }

            return dbc;
        }
コード例 #2
0
 public void MyTestInitialize()
 {
     sdb = new Sequoiadb(config.conf.Coord.Address);
     sdb.Connect(config.conf.UserName, config.conf.Password);
     if (sdb.IsCollectionSpaceExist(csName))
         sdb.DropCollectionSpace(csName);
     cs = sdb.CreateCollectionSpace(csName);
     coll = cs.CreateCollection(cName);
 }
コード例 #3
0
 public void MyTestInitialize()
 {
     try
     {
         sdb = new Sequoiadb(config.conf.Coord.Address);
         sdb.Connect(config.conf.UserName, config.conf.Password);
         if (sdb.IsCollectionSpaceExist(csName))
             sdb.DropCollectionSpace(csName);
         cs = sdb.CreateCollectionSpace(csName);
         cl = cs.CreateCollection(cName);
     }
     catch (BaseException e)
     {
         Console.WriteLine("Failed to Initialize in DBLobTest, ErrorType = {0}", e.ErrorType);
         Environment.Exit(0);
     }
 }