aboutsummaryrefslogtreecommitdiffstats
path: root/src/Utilities/SqliteConnectionHelpers.cs
blob: 59fec5a81242ce84a0927e5697a711263c3145d1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
using Dapper;
using Microsoft.Data.Sqlite;

namespace I2R.LightNews.Utilities;

public static class SqliteConnectionHelpers
{
    public static bool TableExists(this SqliteConnection db, string tableName) {
        return db.QueryFirstOrDefault<string>(
            "select name from sqlite_master where type='table' and name=@tableName"
            , new {tableName}
        ).HasValue();
    }
}