private SecureDatabase BuildSampleDB() { SecureDatabase db = new SecureDatabase(); // Add a sample table if (db.TableExists(sampleTableName)) { db.DropTable(sampleTableName); } Table t = db.AddTable(sampleTableName, 100000); t.AddColumn(new ColumnDetails("ID", "int", null, null, true)); t.AddColumn(new ColumnDetails("Title", "string", "")); t.AddColumn(new ColumnDetails("Priority", "byte", 0)); t.AddColumn(new ColumnDetails("SecretOwner", "string", null)); t.AddColumn(new ColumnDetails("SecretPriority", "byte", null)); // Add sample data (for joins) DataBlock b = new DataBlock(new string[] { "ID", "Title", "Priority", "SecretOwner", "SecretPriority" }, 5, new Array[] { new int[] { 1, 2, 3, 4, 5 }, new string[] { "One", "Two", "Three", "Four", "Five" }, new byte[] { 1, 1, 3, 3, 0 }, new string[] { "Bob", "Alice", "Alice", "Bob", "Bob" }, new byte[] { 3, 3, 2, 2, 0 } }); t.AddOrUpdate(b); return(db); }
private static void SetSettings(string tableName, string settingsJsonPath) { Console.WriteLine("Applying settings from '{0}' to '{1}'...", settingsJsonPath, tableName); // Read settings file CombinedSettings settings = LoadSettings(settingsJsonPath); // Create table, if required SecureDatabase db = new SecureDatabase(); if (!db.TableExists(tableName)) { db.AddTable(tableName, settings.ItemCountLimit); } // Apply the settings SetSettings(db[tableName], settings); }