Files
speckle-sharp-sdk/src/Speckle.Sdk/SQLite/CacheDbCommands.cs
T
Jedd Morgan a143553a09
.NET Build and Publish / build (push) Has been cancelled
feat(netcore): Add Net10 target to SDK and drop sln (#442)
* .net10 attempt 2

* bump csharpier

* drop sln

* supress stream analyers for test projects

* readme

* fix package locks post merge

* Microsoft.Extensions.DependencyInjection

* Simplify the dependency structure

* don't bump graphql client for netstandard and net8 targets

* Fix test
2026-04-15 17:48:32 +01:00

40 lines
1.3 KiB
C#

namespace Speckle.Sdk.SQLite;
public enum CacheOperation
{
InsertOrIgnore,
InsertOrReplace,
Has,
Get,
Delete,
GetAll,
BulkInsertOrIgnore,
}
public static class CacheDbCommands
{
public static readonly string[] Commands;
#if NET8_0_OR_GREATER
public static readonly int Count = Enum.GetValues<CacheOperation>().Length;
#else
public static readonly int Count = Enum.GetValues(typeof(CacheOperation)).Length;
#endif
#pragma warning disable CA1810
static CacheDbCommands()
#pragma warning restore CA1810
{
Commands = new string[Count];
Commands[(int)CacheOperation.InsertOrIgnore] =
"INSERT OR IGNORE INTO objects(hash, content) VALUES(@hash, @content)";
Commands[(int)CacheOperation.InsertOrReplace] = "REPLACE INTO objects(hash, content) VALUES(@hash, @content)";
Commands[(int)CacheOperation.Has] = "SELECT 1 FROM objects WHERE hash = @hash LIMIT 1";
Commands[(int)CacheOperation.Get] = "SELECT content FROM objects WHERE hash = @hash LIMIT 1";
Commands[(int)CacheOperation.Delete] = "DELETE FROM objects WHERE hash = @hash";
Commands[(int)CacheOperation.GetAll] = "SELECT hash, content FROM objects";
Commands[(int)CacheOperation.BulkInsertOrIgnore] = "INSERT OR IGNORE INTO objects (hash, content) VALUES ";
}
}