Scalien.Database.CreateTable C# (CSharp) Method

CreateTable() public method

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.
return Table
        public virtual Table CreateTable(string name)
        {
            List<Quorum> quorums = client.GetQuorums();
            if (quorums.Count == 0)
                throw new SDBPException(Status.SDBP_BADSCHEMA, "No quorums found");
            Quorum quorum = quorums[0];
            return CreateTable(name, quorum);
        }

Same methods

Database::CreateTable ( string name, Quorum quorum ) : Table

Usage Example

Beispiel #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");
            }
        }
All Usage Examples Of Scalien.Database::CreateTable