本文整理汇总了C#中SQLite.SQLiteConnection.BeginExclusive方法的典型用法代码示例。如果您正苦于以下问题:C# SQLite.SQLiteConnection.BeginExclusive方法的具体用法?C# SQLite.SQLiteConnection.BeginExclusive怎么用?C# SQLite.SQLiteConnection.BeginExclusive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLite.SQLiteConnection.BeginExclusive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}