public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "sync14.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists SyncJobs (Id GUID PRIMARY KEY, TargetId TEXT NOT NULL, Name TEXT NOT NULL, Profile TEXT, Quality TEXT, Bitrate INT, Status TEXT NOT NULL, Progress FLOAT, UserId TEXT NOT NULL, ItemIds TEXT NOT NULL, Category TEXT, ParentId TEXT, UnwatchedOnly BIT, ItemLimit INT, SyncNewContent BIT, DateCreated DateTime, DateLastModified DateTime, ItemCount int)", "create index if not exists idx_SyncJobs on SyncJobs(Id)", "create index if not exists idx_SyncJobs1 on SyncJobs(TargetId)", "create table if not exists SyncJobItems (Id GUID PRIMARY KEY, ItemId TEXT, ItemName TEXT, MediaSourceId TEXT, JobId TEXT, TemporaryPath TEXT, OutputPath TEXT, Status TEXT, TargetId TEXT, DateCreated DateTime, Progress FLOAT, AdditionalFiles TEXT, MediaSource TEXT, IsMarkedForRemoval BIT, JobItemIndex INT, ItemDateModifiedTicks BIGINT)", "create index if not exists idx_SyncJobItems1 on SyncJobItems(Id)", "create index if not exists idx_SyncJobItems2 on SyncJobItems(TargetId)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); _connection.AddColumn(Logger, "SyncJobs", "Profile", "TEXT"); _connection.AddColumn(Logger, "SyncJobs", "Bitrate", "INT"); _connection.AddColumn(Logger, "SyncJobItems", "ItemDateModifiedTicks", "BIGINT"); PrepareStatements(); }
public IDataReader ReadFromStoredProcedure(string storedProcedureName, object parameterValues) { var type = parameterValues.GetType(); var connection = dbConnector.Connect(); using (var command = connection.CreateCommand()) { command.CommandText = storedProcedureName; command.CommandType = CommandType.StoredProcedure; command.CommandTimeout = 60 * 5; foreach (var propertyInfo in type.GetProperties()) { command.AddParameter(propertyInfo.Name, propertyInfo.GetValue(parameterValues)); } var result = command.ExecuteReader(); return(result); } }
protected virtual async Task <IDbConnection> CreateConnection(bool isReadOnly = false) { var connection = await DbConnector.Connect(DbFilePath, false, true).ConfigureAwait(false); connection.RunQueries(new[] { "pragma temp_store = memory" }, Logger); return(connection); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "displaypreferences.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists userdisplaypreferences (id GUID, userId GUID, client text, data BLOB)", "create unique index if not exists userdisplaypreferencesindex on userdisplaypreferences (id, userId, client)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "users.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists users (guid GUID primary key, data BLOB)", "create index if not exists idx_users on users(guid)", "create table if not exists schema_version (table_name primary key, version)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); }
public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "activitylog.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists ActivityLogEntries (Id GUID PRIMARY KEY, Name TEXT, Overview TEXT, ShortOverview TEXT, Type TEXT, ItemId TEXT, UserId TEXT, DateCreated DATETIME, LogSeverity TEXT)", "create index if not exists idx_ActivityLogEntries on ActivityLogEntries(Id)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); PrepareStatements(); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "shares.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists Shares (Id GUID, ItemId TEXT, UserId TEXT, ExpirationDate DateTime, PRIMARY KEY (Id))", "create index if not exists idx_Shares on Shares(Id)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); PrepareStatements(); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "fileorganization.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists FileOrganizerResults (ResultId GUID PRIMARY KEY, OriginalPath TEXT, TargetPath TEXT, FileLength INT, OrganizationDate datetime, Status TEXT, OrganizationType TEXT, StatusMessage TEXT, ExtractedName TEXT, ExtractedYear int null, ExtractedSeasonNumber int null, ExtractedEpisodeNumber int null, ExtractedEndingEpisodeNumber, DuplicatePaths TEXT int null)", "create index if not exists idx_FileOrganizerResults on FileOrganizerResults(ResultId)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); PrepareStatements(); }
public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "notifications.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists Notifications (Id GUID NOT NULL, UserId GUID NOT NULL, Date DATETIME NOT NULL, Name TEXT NOT NULL, Description TEXT, Url TEXT, Level TEXT NOT NULL, IsRead BOOLEAN NOT NULL, Category TEXT NOT NULL, RelatedId TEXT, PRIMARY KEY (Id, UserId))", "create index if not exists idx_Notifications1 on Notifications(Id)", "create index if not exists idx_Notifications2 on Notifications(UserId)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); PrepareStatements(); }
public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "authentication.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists AccessTokens (Id GUID PRIMARY KEY, AccessToken TEXT NOT NULL, DeviceId TEXT, AppName TEXT, AppVersion TEXT, DeviceName TEXT, UserId TEXT, IsActive BIT, DateCreated DATETIME NOT NULL, DateRevoked DATETIME)", "create index if not exists idx_AccessTokens on AccessTokens(Id)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); _connection.AddColumn(Logger, "AccessTokens", "AppVersion", "TEXT"); PrepareStatements(); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "refreshinfo.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists MetadataStatus (ItemId GUID PRIMARY KEY, DateLastMetadataRefresh datetime, DateLastImagesRefresh datetime, ItemDateModified DateTimeNull)", "create index if not exists idx_MetadataStatus on MetadataStatus(ItemId)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); AddItemDateModifiedCommand(); PrepareStatements(); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_appPaths.DataPath, "userdata_v2.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); string[] queries = { "create table if not exists userdata (key nvarchar, userId GUID, rating float null, played bit, playCount int, isFavorite bit, playbackPositionTicks bigint, lastPlayedDate datetime null)", "create index if not exists idx_userdata on userdata(key)", "create unique index if not exists userdataindex on userdata (key, userId)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); _connection.AddColumn(Logger, "userdata", "AudioStreamIndex", "int"); _connection.AddColumn(Logger, "userdata", "SubtitleStreamIndex", "int"); }
/// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> public async Task Initialize(IDbConnector dbConnector) { var dbFile = Path.Combine(_config.ApplicationPaths.DataPath, "library.db"); _connection = await dbConnector.Connect(dbFile).ConfigureAwait(false); var createMediaStreamsTableCommand = "create table if not exists mediastreams (ItemId GUID, StreamIndex INT, StreamType TEXT, Codec TEXT, Language TEXT, ChannelLayout TEXT, Profile TEXT, AspectRatio TEXT, Path TEXT, IsInterlaced BIT, BitRate INT NULL, Channels INT NULL, SampleRate INT NULL, IsDefault BIT, IsForced BIT, IsExternal BIT, Height INT NULL, Width INT NULL, AverageFrameRate FLOAT NULL, RealFrameRate FLOAT NULL, Level FLOAT NULL, PixelFormat TEXT, BitDepth INT NULL, IsAnamorphic BIT NULL, RefFrames INT NULL, CodecTag TEXT NULL, Comment TEXT NULL, NalLengthSize TEXT NULL, IsAvc BIT NULL, Title TEXT NULL, PRIMARY KEY (ItemId, StreamIndex))"; string[] queries = { "create table if not exists TypedBaseItems (guid GUID primary key, type TEXT, data BLOB, ParentId GUID, Path TEXT)", "create index if not exists idx_TypedBaseItems on TypedBaseItems(guid)", "create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)", "create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)", "create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))", "create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)", "create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)", "create table if not exists UserDataKeys (ItemId GUID, UserDataKey TEXT, PRIMARY KEY (ItemId, UserDataKey))", "create index if not exists idx_UserDataKeys1 on UserDataKeys(ItemId)", "create table if not exists People (ItemId GUID, Name TEXT NOT NULL, Role TEXT, PersonType TEXT, SortOrder int, ListOrder int)", "create index if not exists idxPeopleItemId on People(ItemId)", "create index if not exists idxPeopleName on People(Name)", "create table if not exists "+ChaptersTableName+" (ItemId GUID, ChapterIndex INT, StartPositionTicks BIGINT, Name TEXT, ImagePath TEXT, PRIMARY KEY (ItemId, ChapterIndex))", "create index if not exists idx_"+ChaptersTableName+"1 on "+ChaptersTableName+"(ItemId)", createMediaStreamsTableCommand, "create index if not exists idx_mediastreams1 on mediastreams(ItemId)", //pragmas "pragma temp_store = memory", "pragma shrink_memory" }; _connection.RunQueries(queries, Logger); _connection.AddColumn(Logger, "AncestorIds", "AncestorIdText", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "Path", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "StartDate", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "EndDate", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "ChannelId", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsMovie", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "IsSports", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "IsKids", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "CommunityRating", "Float"); _connection.AddColumn(Logger, "TypedBaseItems", "CustomRating", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IndexNumber", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "IsLocked", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "Name", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "OfficialRating", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "MediaType", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "Overview", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "ParentIndexNumber", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "PremiereDate", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "ProductionYear", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "ParentId", "GUID"); _connection.AddColumn(Logger, "TypedBaseItems", "Genres", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "ParentalRatingValue", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "SchemaVersion", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "SortName", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "RunTimeTicks", "BIGINT"); _connection.AddColumn(Logger, "TypedBaseItems", "OfficialRatingDescription", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "HomePageUrl", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "VoteCount", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "DisplayMediaType", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "DateCreated", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "DateModified", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "ForcedSortName", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsOffline", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "LocationType", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsSeries", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "IsLive", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "IsNews", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "IsPremiere", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "EpisodeTitle", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsRepeat", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataLanguage", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "PreferredMetadataCountryCode", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsHD", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "ExternalEtag", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "DateLastRefreshed", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "DateLastSaved", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "IsInMixedFolder", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "LockedFields", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "Studios", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "Audio", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "ExternalServiceId", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "Tags", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsFolder", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "InheritedParentalRatingValue", "INT"); _connection.AddColumn(Logger, "TypedBaseItems", "UnratedType", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "TopParentId", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "IsItemByName", "BIT"); _connection.AddColumn(Logger, "TypedBaseItems", "SourceType", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "TrailerTypes", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "CriticRating", "Float"); _connection.AddColumn(Logger, "TypedBaseItems", "CriticRatingSummary", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "DateModifiedDuringLastRefresh", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "InheritedTags", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "CleanName", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "PresentationUniqueKey", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "SlugName", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "OriginalTitle", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "PrimaryVersionId", "Text"); _connection.AddColumn(Logger, "TypedBaseItems", "DateLastMediaAdded", "DATETIME"); _connection.AddColumn(Logger, "TypedBaseItems", "Album", "Text"); _connection.AddColumn(Logger, "UserDataKeys", "Priority", "INT"); string[] postQueries = { "create index if not exists idx_PresentationUniqueKey on TypedBaseItems(PresentationUniqueKey)", "create index if not exists idx_Type on TypedBaseItems(Type)" }; _connection.RunQueries(postQueries, Logger); PrepareStatements(); new MediaStreamColumns(_connection, Logger).AddColumns(); var mediaStreamsDbFile = Path.Combine(_config.ApplicationPaths.DataPath, "mediainfo.db"); if (File.Exists(mediaStreamsDbFile)) { MigrateMediaStreams(mediaStreamsDbFile); } DataExtensions.Attach(_connection, Path.Combine(_config.ApplicationPaths.DataPath, "userdata_v2.db"), "UserDataDb"); }
public void Connect() { _db.Connect(); }
public OrientDbBenchmark() { _db = new OrientDbConnector(); _db.Connect(); }
public CouchbaaseBenchmark() { _db = new CouchbaseConnector(); _db.Connect(); }
public RedisBenchmark() { _db = new RedisConnector <T>(); _db.Connect(); }
public CouchDbBenchmark() { _db = new CouchDbConnector(); _db.Connect(); }
public RavenDbBenchmark() { _db = new RavenDbConnector(); _db.Connect(); }
public DymanoDbBenchmark() { _db = new DynamoDbConnector(); _db.Connect(); _db.InitScheme <T>(); }