Beispiel #1
0
        // return value for system tables
        public RelationValue GetCatalogTableValue(CatalogTables table)
        {
            var tablemaker = CatalogTableMaker.Create(_catalogtableheadings[table]);

            _catalogtablemaker[table](tablemaker, PersistentVars.GetEntries());
            return(RelationValue.Create(tablemaker.Table));
        }
Beispiel #2
0
        // Store new entry to catalog, perhaps removing old value first
        // Currently only for Sql -- Local does total dump
        internal void StoreEntry(CatalogEntry entry, CatalogEntry oldentry = null)
        {
            var ctm = CatalogTableMaker.Create(_catalogtableheading);

            if (SqlFlag)
            {
                var table = DataTableSql.Create(CatalogTableName, _catalogtableheading);
                if (oldentry != null)
                {
                    var ctmx = CatalogTableMaker.Create(_catalogtableheading);
                    ctmx.Table.AddRow(ctmx.MakeEntry(oldentry));
                    table.UpdateJoin(ctmx.Table, JoinOps.MINUS);
                }
                ctm.Table.AddRow(ctm.MakeEntry(entry));
                table.UpdateJoin(ctm.Table, JoinOps.UNION);
            }
        }
Beispiel #3
0
        //--- persistence Mk II

        // Store the persistent catalog and modified tables, local only
        // note: for Sql, only used to create new empty catalog
        public void StoreToTable()
        {
            Logger.WriteLine(2, "Save catalog for '{0}'", DatabaseName);
            var ctm   = CatalogTableMaker.Create(_catalogtableheading);
            var table = ctm.AddEntries(PersistentVars.GetEntries()).Table;

            if (SqlFlag)
            {
                DataTableSql.Create(CatalogTableName, table);
            }
            else
            {
                Persist.Create(DatabasePath, true).Store(CatalogTableName, RelationValue.Create(table));
                var savers = PersistentVars.GetEntries().Where(e => e.IsUnsaved);
                Logger.WriteLine(2, $"Persist {savers.Count()} entries");
                foreach (var entry in savers)
                {
                    Persist.Create(DatabasePath, true).Store(entry.Name, entry.Value);
                }
            }
        }