当前位置: 首页>>代码示例>>C#>>正文


C# SQLite.SQLiteConnection.InsertSafe方法代码示例

本文整理汇总了C#中SQLite.SQLiteConnection.InsertSafe方法的典型用法代码示例。如果您正苦于以下问题:C# SQLite.SQLiteConnection.InsertSafe方法的具体用法?C# SQLite.SQLiteConnection.InsertSafe怎么用?C# SQLite.SQLiteConnection.InsertSafe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQLite.SQLiteConnection的用法示例。


在下文中一共展示了SQLite.SQLiteConnection.InsertSafe方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Open

        public override bool Open(Area owner)
        {
            Owner = owner;
            if (!DataFolder.Exists)
            {
                DataFolder.Create();
            }
            ObjectDatabase = new SQLite.SQLiteConnection(DataFile.FullName, SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.FullMutex | SQLite.SQLiteOpenFlags.ReadWrite);
            BlobDatabase = new SQLite.SQLiteConnection(BlobFile.FullName, SQLite.SQLiteOpenFlags.FullMutex | SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite);
            InitializeDBTypes();

            var version = ObjectDatabase.Table<StandardObjectStoreMetadata>().FirstOrDefault();
            if (version == null)
            {
                ObjectDatabase.BeginExclusive();
                Printer.PrintMessage("Upgrading object store database...");
                var records = owner.GetAllRecords();
                foreach (var x in records)
                {
                    ImportRecordFromFlatStore(x);
                }
                var meta = new StandardObjectStoreMetadata();
                meta.Version = 2;
                ObjectDatabase.InsertSafe(meta);
                ObjectDatabase.Commit();
            }
            else if (version.Version < 3)
            {
                Printer.PrintMessage("Upgrading object store database...");
                foreach (var x in BlobDatabase.Table<Blobject>())
                {
                    Blobsize bs = new Blobsize() { BlobID = x.Id, Length = x.Data.Length };
                    BlobDatabase.Insert(bs);
                }
                ObjectDatabase.BeginExclusive();
                ObjectDatabase.DropTable<StandardObjectStoreMetadata>();
                ObjectDatabase.CreateTable<StandardObjectStoreMetadata>();
                var meta = new StandardObjectStoreMetadata();
                meta.Version = 3;
                ObjectDatabase.InsertSafe(meta);
                ObjectDatabase.Commit();
            }
            return true;
        }
开发者ID:eatplayhate,项目名称:versionr,代码行数:44,代码来源:StandardObjectStore.cs

示例2: Create

        public override void Create(Area owner)
        {
            Owner = owner;
            DataFolder.Create();
            ObjectDatabase = new SQLite.SQLiteConnection(DataFile.FullName, SQLite.SQLiteOpenFlags.FullMutex | SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite);
            BlobDatabase = new SQLite.SQLiteConnection(BlobFile.FullName, SQLite.SQLiteOpenFlags.FullMutex | SQLite.SQLiteOpenFlags.Create | SQLite.SQLiteOpenFlags.ReadWrite);
            InitializeDBTypes();

            var meta = new StandardObjectStoreMetadata();
            meta.Version = 3;
            ObjectDatabase.InsertSafe(meta);
        }
开发者ID:eatplayhate,项目名称:versionr,代码行数:12,代码来源:StandardObjectStore.cs


注:本文中的SQLite.SQLiteConnection.InsertSafe方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。