public void CreateTable(string dbName, string tableName, TableDefinition tableDef) { try { TXN_BEGIN(dbName: dbName, tableName: tableName); DataFunctions.CreateTable(activeDStore, dbName, tableName, tableDef); } finally { TXN_END(); } }
private void VerifyLocksTable(DataStore dstore) { logger.Debug("VerifyLocksTable"); // ensure connection database DatabaseDefinition connDbDef; try { // if db exists we're good connDbDef = DataFunctions.ReadDB(dstore, connDbName); } catch { // otherwise create it var newConnDbDef = new DatabaseDefinition(dbName: connDbName) { Description = "Internal DB" }; // create the connection management database DataFunctions.CreateDB(dstore, connDbName, newConnDbDef); } // ensue locks table TableDefinition locksTableDef; try { // if table exists we're good locksTableDef = DataFunctions.ReadTable(dstore, connDbName, connDbLocksTableName); } catch { // otherwise create it // locks have fields for dbname, tablename and record keys but they're not wired // - to allow implicit locking of nonexisting entries // - to remove the need to update wires when new tables and dbs are created var newlocksTableDef = new TableDefinition() { Fields = new List <Field>() { new UUIDField(connDbLockUUIDField), new TextField(connDbLockSourceField), new TextField(connDbLockRequesterField), new UUIDField(connDbLockConnUUIDField), new TextField(connDbLockDBField), new TextField(connDbLockTableField), new TextField(connDbLockRecordKeyField), }, Description = "Locks Table", IsHidden = true, SupportsHistory = false }; // create transaction locks table DataFunctions.CreateTable(dstore, connDbName, connDbLocksTableName, newlocksTableDef); } }