CreateTable() 공개 메소드

Create a table in this database, with the first shard placed in the first available quorum.
public CreateTable ( string name ) : Table
name string The name of the table.
리턴 Table
예제 #1
0
        private void OpenDB()
        {
            try
            {
                db = clients[client_index].GetDatabase(dbname);
            }
            catch (SDBPException)
            {
                db = clients[client_index].CreateDatabase(dbname);
            }

            db = Utils.GetOrCreateEmptyDatabase(clients[client_index], dbname);

            try
            {
                indices = db.GetTable("indices");
            }
            catch (SDBPException)
            {
                indices = db.CreateTable("indices");
            }
            userIDs = indices.GetSequence("userIDs");

            try
            {
                table = db.GetTable(tablename);
            }
            catch (SDBPException)
            {
                table = db.CreateTable(tablename);
            }

            try
            {
                tableByNick = db.GetTable(tablename + "ByNick");
            }
            catch (SDBPException)
            {
                tableByNick = db.CreateTable(tablename + "ByNick");
            }

            try
            {
                tableByBirth = db.GetTable(tablename + "ByBirth");
            }
            catch (SDBPException)
            {
                tableByBirth = db.CreateTable(tablename + "ByBirth");
            }

            try
            {
                tableByLastLogin = db.GetTable(tablename + "ByLastLogin");
            }
            catch (SDBPException)
            {
                tableByLastLogin = db.CreateTable(tablename + "ByLastLogin");
            }
        }
예제 #2
0
파일: Utils.cs 프로젝트: zYg-sys/scaliendb
        public static Table GetOrCreateTableAndDatabase(Client client, string dbName, string tableName)
        {
            Database db = null;

            try
            {
                db = client.GetDatabase(dbName);
            }
            catch (SDBPException e)
            {
                if (e.Status == Status.SDBP_BADSCHEMA)
                {
                    db = client.CreateDatabase(dbName);
                }
            }
            if (db == null)
            {
                return(null);
            }

            Table table = null;

            try
            {
                table = db.GetTable(tableName);
            }
            catch (SDBPException e)
            {
                if (e.Status == Status.SDBP_BADSCHEMA)
                {
                    table = db.CreateTable(tableName);
                }
            }

            if (table == null)
            {
                table = db.CreateTable(tableName);
            }

            return(table);
        }
예제 #3
0
 public static Table TryCreateTable(Database database, string tableName)
 {
     try
     {
         var table = database.CreateTable(tableName);
         return(table);
     }
     catch (SDBPException)
     {
         return(null);
     }
 }
예제 #4
0
 public static Table TryCreateTable(Database database, string tableName)
 {
     try
     {
         var table = database.CreateTable(tableName);
         return table;
     }
     catch (SDBPException)
     {
         return null;
     }
 }
예제 #5
0
파일: Users.cs 프로젝트: scalien/scaliendb
        private void OpenDB()
        {
            try
            {
                db = clients[client_index].GetDatabase(dbname);
            }
            catch (SDBPException)
            {
                db = clients[client_index].CreateDatabase(dbname);
            }

            db = Utils.GetOrCreateEmptyDatabase(clients[client_index], dbname);

            try
            {
                indices = db.GetTable("indices");
            }
            catch (SDBPException)
            {
                indices = db.CreateTable("indices");
            }
            userIDs = indices.GetSequence("userIDs");

            try
            {
                table = db.GetTable(tablename);
            }
            catch (SDBPException)
            {
                table = db.CreateTable(tablename);
            }

            try
            {
                tableByNick = db.GetTable(tablename + "ByNick");
            }
            catch (SDBPException)
            {
                tableByNick = db.CreateTable(tablename + "ByNick");
            }

            try
            {
                tableByBirth = db.GetTable(tablename + "ByBirth");
            }
            catch (SDBPException)
            {
                tableByBirth = db.CreateTable(tablename + "ByBirth");
            }

            try
            {
                tableByLastLogin = db.GetTable(tablename + "ByLastLogin");
            }
            catch (SDBPException)
            {
                tableByLastLogin = db.CreateTable(tablename + "ByLastLogin");
            }
        }