Ejemplo n.º 1
0
        // 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;
        }
Ejemplo n.º 2
0
 internal DBCollection(CollectionSpace cs, string name)
 {
     this.name = name;
     this.collSpace = cs;
     this.collectionFullName = cs.Name + "." + name;
     this.connection = cs.SequoiaDB.Connection;
     this.isBigEndian = cs.isBigEndian;
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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);
     }
 }