WIP: database services
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
+12
-10
@@ -6,14 +6,12 @@ namespace OCES.Resonance.Core;
|
||||
|
||||
public static class Database
|
||||
{
|
||||
static readonly string DefaultConnectionString = "Data Source=default.rdb;Version=3;";
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据库连接
|
||||
/// </summary>
|
||||
/// <param name="dbName">数据库名称(不含扩展名)</param>
|
||||
/// <returns>数据库连接</returns>
|
||||
public static IDbConnection GetConnection(string dbName = "default")
|
||||
static IDbConnection GetConnection(string dbName = "default")
|
||||
{
|
||||
string connectionString = $"Data Source={dbName}.rdb;Version=3;";
|
||||
return new SQLiteConnection(connectionString);
|
||||
@@ -27,7 +25,8 @@ public static class Database
|
||||
using var connection = GetConnection();
|
||||
connection.Open();
|
||||
|
||||
const string sql = @"
|
||||
const string sql = """
|
||||
|
||||
CREATE TABLE IF NOT EXISTS audio_files (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
unique_id TEXT NOT NULL UNIQUE,
|
||||
@@ -105,13 +104,16 @@ public static class Database
|
||||
disk_number INTEGER,
|
||||
track_number INTEGER,
|
||||
artwork BLOB,
|
||||
waveform BLOB,
|
||||
|
||||
INDEX idx_md5 (md5),
|
||||
INDEX idx_path (path),
|
||||
INDEX idx_unique_id (unique_id)
|
||||
waveform BLOB
|
||||
);
|
||||
";
|
||||
|
||||
CREATE INDEX idx_file_name on audio_files(filename);
|
||||
CREATE INDEX idx_md5 on audio_files(md5);
|
||||
CREATE INDEX idx_path on audio_files(path);
|
||||
CREATE INDEX idx_unique_id on audio_files(unique_id);
|
||||
CREATE INDEX idx_description on audio_files(description);
|
||||
|
||||
""";
|
||||
|
||||
connection.Execute(sql);
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Timecode/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Timecode/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=umid/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -3,6 +3,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATrack_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003F_002E_002E_003FLibrary_003FApplication_0020Support_003FJetBrains_003FRider2026_002E1_003Fresharper_002Dhost_003FSourcesCache_003F872a20b9878a835418db772627eab53c29e04a65284443b02d35345255649a3a_003FTrack_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue"><AssemblyExplorer>
|
||||
<Assembly Path="/Users/oliver/.nuget/packages/fluentassertions/8.9.0/lib/net6.0/FluentAssertions.dll" />
|
||||
<Assembly Path="/Users/oliver/.nuget/packages/dapper/2.1.72/lib/net10.0/Dapper.dll" />
|
||||
</AssemblyExplorer></s:String>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestProjectMapping/=855F941D_002D5DA0_002D479A_002DBB79_002D5C7CE72CD34B/@EntryIndexedValue">24F92458-FB39-44BE-A32F-41275183AF1B</s:String>
|
||||
<s:String x:Key="/Default/Environment/UnitTesting/CreateUnitTestDialog/TestTemplateMapping/=xUnit/@EntryIndexedValue">33ff99d8-b1ad-4ed5-a4fd-376b97c2c841</s:String>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user