Database is a convenience class for encapsulating database related operations.

ScalienDB uses databases and tables to manage key value namespaces.

Пример #1
0
 internal Table(Client client, Database database, ulong tableID, string name)
 {
     this.client = client;
     this.database = database;
     this.tableID = tableID;
     this.name = name;
 }
Пример #2
0
 public static Table TryCreateTable(Database database, string tableName)
 {
     try
     {
         var table = database.CreateTable(tableName);
         return table;
     }
     catch (SDBPException)
     {
         return null;
     }
 }
Пример #3
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");
            }
        }