Version 2.1 #41
@ -367,6 +367,25 @@ module Map =
|
|||||||
LastSeenOn = tryInstant "last_seen_on" rdr
|
LastSeenOn = tryInstant "last_seen_on" rdr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Map from a document to a domain type, specifying the field name for the document
|
||||||
|
let fromData<'T> ser rdr fieldName : 'T =
|
||||||
|
Utils.deserialize<'T> ser (getString fieldName rdr)
|
||||||
|
|
||||||
|
/// Map from a document to a domain type
|
||||||
|
let fromDoc<'T> ser rdr : 'T =
|
||||||
|
fromData<'T> ser rdr "data"
|
||||||
|
|
||||||
|
/// Queries to assist with document manipulation
|
||||||
|
module Query =
|
||||||
|
|
||||||
|
/// Fragment to add an ID condition to a WHERE clause
|
||||||
|
let whereById =
|
||||||
|
"data ->> 'Id' = @id"
|
||||||
|
|
||||||
|
/// Fragment to add a web log ID condition to a WHERE clause
|
||||||
|
let whereWebLogId =
|
||||||
|
"data ->> 'WebLogId' = @webLogId"
|
||||||
|
|
||||||
/// Add a web log ID parameter
|
/// Add a web log ID parameter
|
||||||
let addWebLogId (cmd: SqliteCommand) (webLogId: WebLogId) =
|
let addWebLogId (cmd: SqliteCommand) (webLogId: WebLogId) =
|
||||||
cmd.Parameters.AddWithValue("@webLogId", string webLogId) |> ignore
|
cmd.Parameters.AddWithValue("@webLogId", string webLogId) |> ignore
|
||||||
|
@ -4,9 +4,10 @@ open System.Threading.Tasks
|
|||||||
open Microsoft.Data.Sqlite
|
open Microsoft.Data.Sqlite
|
||||||
open MyWebLog
|
open MyWebLog
|
||||||
open MyWebLog.Data
|
open MyWebLog.Data
|
||||||
|
open Newtonsoft.Json
|
||||||
|
|
||||||
/// SQLite myWebLog category data implementation
|
/// SQLite myWebLog category data implementation
|
||||||
type SQLiteCategoryData(conn: SqliteConnection) =
|
type SQLiteCategoryData(conn: SqliteConnection, ser: JsonSerializer) =
|
||||||
|
|
||||||
/// Add parameters for category INSERT or UPDATE statements
|
/// Add parameters for category INSERT or UPDATE statements
|
||||||
let addCategoryParameters (cmd: SqliteCommand) (cat: Category) =
|
let addCategoryParameters (cmd: SqliteCommand) (cat: Category) =
|
||||||
@ -35,7 +36,7 @@ type SQLiteCategoryData(conn: SqliteConnection) =
|
|||||||
/// Count all categories for the given web log
|
/// Count all categories for the given web log
|
||||||
let countAll webLogId = backgroundTask {
|
let countAll webLogId = backgroundTask {
|
||||||
use cmd = conn.CreateCommand()
|
use cmd = conn.CreateCommand()
|
||||||
cmd.CommandText <- "SELECT COUNT(id) FROM category WHERE web_log_id = @webLogId"
|
cmd.CommandText <- $"SELECT COUNT(*) FROM {Table.Category} WHERE {whereWebLogId}"
|
||||||
addWebLogId cmd webLogId
|
addWebLogId cmd webLogId
|
||||||
return! count cmd
|
return! count cmd
|
||||||
}
|
}
|
||||||
@ -44,23 +45,25 @@ type SQLiteCategoryData(conn: SqliteConnection) =
|
|||||||
let countTopLevel webLogId = backgroundTask {
|
let countTopLevel webLogId = backgroundTask {
|
||||||
use cmd = conn.CreateCommand ()
|
use cmd = conn.CreateCommand ()
|
||||||
cmd.CommandText <-
|
cmd.CommandText <-
|
||||||
"SELECT COUNT(id) FROM category WHERE web_log_id = @webLogId AND parent_id IS NULL"
|
$"SELECT COUNT(*) FROM {Table.Category}
|
||||||
|
WHERE {whereWebLogId} AND data ->> '{nameof Category.Empty.ParentId}' IS NULL"
|
||||||
addWebLogId cmd webLogId
|
addWebLogId cmd webLogId
|
||||||
return! count cmd
|
return! count cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: need to get SQLite in clause format for JSON documents
|
||||||
/// Retrieve all categories for the given web log in a DotLiquid-friendly format
|
/// Retrieve all categories for the given web log in a DotLiquid-friendly format
|
||||||
let findAllForView webLogId = backgroundTask {
|
let findAllForView webLogId = backgroundTask {
|
||||||
use cmd = conn.CreateCommand()
|
use cmd = conn.CreateCommand()
|
||||||
cmd.CommandText <- "SELECT * FROM category WHERE web_log_id = @webLogId"
|
cmd.CommandText <- $"SELECT data FROM {Table.Category} WHERE {whereWebLogId}"
|
||||||
addWebLogId cmd webLogId
|
addWebLogId cmd webLogId
|
||||||
use! rdr = cmd.ExecuteReaderAsync()
|
use! rdr = cmd.ExecuteReaderAsync()
|
||||||
let cats =
|
let cats =
|
||||||
seq {
|
seq {
|
||||||
while rdr.Read() do
|
while rdr.Read() do
|
||||||
Map.toCategory rdr
|
Map.fromDoc<Category> ser rdr
|
||||||
}
|
}
|
||||||
|> Seq.sortBy (fun cat -> cat.Name.ToLowerInvariant ())
|
|> Seq.sortBy _.Name.ToLowerInvariant()
|
||||||
|> List.ofSeq
|
|> List.ofSeq
|
||||||
do! rdr.CloseAsync()
|
do! rdr.CloseAsync()
|
||||||
let ordered = Utils.orderByHierarchy cats None None []
|
let ordered = Utils.orderByHierarchy cats None None []
|
||||||
@ -71,7 +74,7 @@ type SQLiteCategoryData(conn: SqliteConnection) =
|
|||||||
let catSql, catParams =
|
let catSql, catParams =
|
||||||
ordered
|
ordered
|
||||||
|> Seq.filter (fun cat -> cat.ParentNames |> Array.contains it.Name)
|
|> Seq.filter (fun cat -> cat.ParentNames |> Array.contains it.Name)
|
||||||
|> Seq.map (fun cat -> cat.Id)
|
|> Seq.map _.Id
|
||||||
|> Seq.append (Seq.singleton it.Id)
|
|> Seq.append (Seq.singleton it.Id)
|
||||||
|> List.ofSeq
|
|> List.ofSeq
|
||||||
|> inClause "AND pc.category_id" "catId" id
|
|> inClause "AND pc.category_id" "catId" id
|
||||||
@ -103,12 +106,12 @@ type SQLiteCategoryData(conn: SqliteConnection) =
|
|||||||
/// Find a category by its ID for the given web log
|
/// Find a category by its ID for the given web log
|
||||||
let findById (catId: CategoryId) webLogId = backgroundTask {
|
let findById (catId: CategoryId) webLogId = backgroundTask {
|
||||||
use cmd = conn.CreateCommand()
|
use cmd = conn.CreateCommand()
|
||||||
cmd.CommandText <- "SELECT * FROM category WHERE id = @id"
|
cmd.CommandText <- $"SELECT * FROM {Table.Category} WHERE {Query.whereById}"
|
||||||
cmd.Parameters.AddWithValue("@id", string catId) |> ignore
|
cmd.Parameters.AddWithValue("@id", string catId) |> ignore
|
||||||
use! rdr = cmd.ExecuteReaderAsync()
|
use! rdr = cmd.ExecuteReaderAsync()
|
||||||
return verifyWebLog<Category> webLogId (_.WebLogId) Map.toCategory rdr
|
return verifyWebLog<Category> webLogId (_.WebLogId) (Map.fromDoc ser) rdr
|
||||||
}
|
}
|
||||||
|
// TODO: stopped here
|
||||||
/// Find all categories for the given web log
|
/// Find all categories for the given web log
|
||||||
let findByWebLog (webLogId: WebLogId) = backgroundTask {
|
let findByWebLog (webLogId: WebLogId) = backgroundTask {
|
||||||
use cmd = conn.CreateCommand ()
|
use cmd = conn.CreateCommand ()
|
||||||
|
@ -18,47 +18,46 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
cmd.CommandText <- "SELECT name FROM sqlite_master WHERE type = 'table'"
|
cmd.CommandText <- "SELECT name FROM sqlite_master WHERE type = 'table'"
|
||||||
let! rdr = cmd.ExecuteReaderAsync()
|
let! rdr = cmd.ExecuteReaderAsync()
|
||||||
let mutable tableList = []
|
let mutable tableList = []
|
||||||
while rdr.Read() do
|
while! rdr.ReadAsync() do
|
||||||
tableList <- Map.getString "name" rdr :: tableList
|
tableList <- Map.getString "name" rdr :: tableList
|
||||||
do! rdr.CloseAsync()
|
do! rdr.CloseAsync()
|
||||||
return tableList
|
return tableList
|
||||||
}
|
}
|
||||||
|
|
||||||
let needsTable table =
|
let needsTable table =
|
||||||
not (List.contains table tables)
|
not (List.contains table tables)
|
||||||
|
|
||||||
|
let jsonTable table =
|
||||||
|
$"CREATE TABLE {table} (data TEXT NOT NULL);
|
||||||
|
CREATE UNIQUE INDEX idx_{table}_key ON {table} (data ->> 'Id')"
|
||||||
|
|
||||||
seq {
|
seq {
|
||||||
// Theme tables
|
// Theme tables
|
||||||
if needsTable Table.Theme then
|
if needsTable Table.Theme then jsonTable Table.Theme
|
||||||
$"CREATE TABLE {Table.Theme} (data TEXT NOT NULL);
|
if needsTable Table.ThemeAsset then
|
||||||
CREATE UNIQUE INDEX idx_{Table.Theme}_key ON {Table.Theme} (data ->> 'Id')";
|
$"CREATE TABLE {Table.ThemeAsset} (
|
||||||
if needsTable "theme_asset" then
|
theme_id TEXT NOT NULL,
|
||||||
"CREATE TABLE theme_asset (
|
|
||||||
theme_id TEXT NOT NULL REFERENCES theme (id),
|
|
||||||
path TEXT NOT NULL,
|
path TEXT NOT NULL,
|
||||||
updated_on TEXT NOT NULL,
|
updated_on TEXT NOT NULL,
|
||||||
data BLOB NOT NULL,
|
data BLOB NOT NULL,
|
||||||
PRIMARY KEY (theme_id, path))"
|
PRIMARY KEY (theme_id, path))"
|
||||||
|
|
||||||
// Web log table
|
// Web log table
|
||||||
if needsTable Table.WebLog then
|
if needsTable Table.WebLog then jsonTable Table.WebLog
|
||||||
$"CREATE TABLE {Table.WebLog} (data TEXT NOT NULL);
|
|
||||||
CREATE UNIQUE INDEX idx_{Table.WebLog}_key ON {Table.WebLog} (data ->> 'Id')"
|
|
||||||
|
|
||||||
// Category table
|
// Category table
|
||||||
if needsTable Table.Category then
|
if needsTable Table.Category then
|
||||||
$"CREATE TABLE {Table.Category} (data TEXT NOT NULL);
|
$"{jsonTable Table.Category};
|
||||||
CREATE UNIQUE INDEX idx_{Table.Category}_key ON {Table.Category} (data -> 'Id');
|
|
||||||
CREATE INDEX idx_{Table.Category}_web_log ON {Table.Category} (data ->> 'WebLogId')"
|
CREATE INDEX idx_{Table.Category}_web_log ON {Table.Category} (data ->> 'WebLogId')"
|
||||||
|
|
||||||
// Web log user table
|
// Web log user table
|
||||||
if needsTable Table.WebLogUser then
|
if needsTable Table.WebLogUser then
|
||||||
$"CREATE TABLE web_log_user (data TEXT NOT NULL);
|
$"{jsonTable Table.WebLogUser};
|
||||||
CREATE UNIQUE INDEX idx_{Table.WebLogUser}_key ON {Table.WebLogUser} (data ->> 'Id');
|
|
||||||
CREATE INDEX idx_{Table.WebLogUser}_email ON {Table.WebLogUser} (data ->> 'WebLogId', data ->> 'Email')"
|
CREATE INDEX idx_{Table.WebLogUser}_email ON {Table.WebLogUser} (data ->> 'WebLogId', data ->> 'Email')"
|
||||||
|
|
||||||
// Page tables
|
// Page tables
|
||||||
if needsTable Table.Page then
|
if needsTable Table.Page then
|
||||||
$"CREATE TABLE {Table.Page} (data TEXT NOT NULL);
|
$"{jsonTable Table.Page};
|
||||||
CREATE UNIQUE INDEX idx_{Table.Page}_key ON {Table.Page} (data ->> 'Id');
|
|
||||||
CREATE INDEX idx_{Table.Page}_author ON {Table.Page} (data ->> 'AuthorId');
|
CREATE INDEX idx_{Table.Page}_author ON {Table.Page} (data ->> 'AuthorId');
|
||||||
CREATE INDEX idx_{Table.Page}_permalink ON {Table.Page} (data ->> 'WebLogId', data ->> 'Permalink')"
|
CREATE INDEX idx_{Table.Page}_permalink ON {Table.Page} (data ->> 'WebLogId', data ->> 'Permalink')"
|
||||||
if needsTable Table.PageRevision then
|
if needsTable Table.PageRevision then
|
||||||
@ -70,8 +69,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
|
|
||||||
// Post tables
|
// Post tables
|
||||||
if needsTable Table.Post then
|
if needsTable Table.Post then
|
||||||
$"CREATE TABLE {Table.Post} (data TEXT NOT NULL);
|
$"{jsonTable Table.Post};
|
||||||
CREATE UNIQUE INDEX idx_{Table.Post}_key ON {Table.Post} (data ->> 'Id');
|
|
||||||
CREATE INDEX idx_{Table.Post}_author ON {Table.Post} (data ->> 'AuthorId');
|
CREATE INDEX idx_{Table.Post}_author ON {Table.Post} (data ->> 'AuthorId');
|
||||||
CREATE INDEX idx_{Table.Post}_status ON {Table.Post} (data ->> 'WebLogId', data ->> 'Status', data ->> 'UpdatedOn');
|
CREATE INDEX idx_{Table.Post}_status ON {Table.Post} (data ->> 'WebLogId', data ->> 'Status', data ->> 'UpdatedOn');
|
||||||
CREATE INDEX idx_{Table.Post}_permalink ON {Table.Post} (data ->> 'WebLogId', data ->> 'Permalink')"
|
CREATE INDEX idx_{Table.Post}_permalink ON {Table.Post} (data ->> 'WebLogId', data ->> 'Permalink')"
|
||||||
@ -83,22 +81,12 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
revision_text TEXT NOT NULL,
|
revision_text TEXT NOT NULL,
|
||||||
PRIMARY KEY (post_id, as_of))"
|
PRIMARY KEY (post_id, as_of))"
|
||||||
if needsTable Table.PostComment then
|
if needsTable Table.PostComment then
|
||||||
$"CREATE TABLE {Table.PostComment} (
|
$"{jsonTable Table.PostComment};
|
||||||
id TEXT PRIMARY KEY,
|
CREATE INDEX idx_{Table.PostComment}_post ON {Table.PostComment} (data ->> 'PostId')"
|
||||||
post_id TEXT NOT NULL,
|
|
||||||
in_reply_to_id TEXT,
|
|
||||||
name TEXT NOT NULL,
|
|
||||||
email TEXT NOT NULL,
|
|
||||||
url TEXT,
|
|
||||||
status TEXT NOT NULL,
|
|
||||||
posted_on TEXT NOT NULL,
|
|
||||||
comment_text TEXT NOT NULL);
|
|
||||||
CREATE INDEX idx_{Table.PostComment}_post ON {Table.PostComment} (post_id)"
|
|
||||||
|
|
||||||
// Tag map table
|
// Tag map table
|
||||||
if needsTable Table.TagMap then
|
if needsTable Table.TagMap then
|
||||||
$"CREATE TABLE {Table.TagMap} (data TEXT NOT NULL);
|
$"{jsonTable Table.TagMap};
|
||||||
CREATE UNIQUE INDEX idx_{Table.TagMap}_key ON {Table.TagMap} (data ->> 'Id');
|
|
||||||
CREATE INDEX idx_{Table.TagMap}_tag ON {Table.TagMap} (data ->> 'WebLogId', data ->> 'UrlValue')";
|
CREATE INDEX idx_{Table.TagMap}_tag ON {Table.TagMap} (data ->> 'WebLogId', data ->> 'UrlValue')";
|
||||||
|
|
||||||
// Uploaded file table
|
// Uploaded file table
|
||||||
@ -195,8 +183,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
FundingUrl = Map.tryString "funding_url" podcastRdr
|
FundingUrl = Map.tryString "funding_url" podcastRdr
|
||||||
FundingText = Map.tryString "funding_text" podcastRdr
|
FundingText = Map.tryString "funding_text" podcastRdr
|
||||||
Medium = Map.tryString "medium" podcastRdr
|
Medium = Map.tryString "medium" podcastRdr
|
||||||
|> Option.map PodcastMedium.Parse
|
|> Option.map PodcastMedium.Parse }
|
||||||
}
|
|
||||||
} |> List.ofSeq
|
} |> List.ofSeq
|
||||||
podcastRdr.Close()
|
podcastRdr.Close()
|
||||||
podcasts
|
podcasts
|
||||||
@ -233,8 +220,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
SeasonDescription = Map.tryString "season_description" epRdr
|
SeasonDescription = Map.tryString "season_description" epRdr
|
||||||
EpisodeNumber = Map.tryString "episode_number" epRdr
|
EpisodeNumber = Map.tryString "episode_number" epRdr
|
||||||
|> Option.map System.Double.Parse
|
|> Option.map System.Double.Parse
|
||||||
EpisodeDescription = Map.tryString "episode_description" epRdr
|
EpisodeDescription = Map.tryString "episode_description" epRdr }
|
||||||
}
|
|
||||||
} |> List.ofSeq
|
} |> List.ofSeq
|
||||||
epRdr.Close()
|
epRdr.Close()
|
||||||
episodes
|
episodes
|
||||||
@ -263,8 +249,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
cmd.CommandText <- "UPDATE page SET updated_on = @updatedOn, published_on = @publishedOn WHERE id = @id"
|
cmd.CommandText <- "UPDATE page SET updated_on = @updatedOn, published_on = @publishedOn WHERE id = @id"
|
||||||
[ cmd.Parameters.Add("@id", SqliteType.Text)
|
[ cmd.Parameters.Add("@id", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@publishedOn", SqliteType.Text)
|
cmd.Parameters.Add("@publishedOn", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (pageId, updatedOn, publishedOn) ->
|
|> List.iter (fun (pageId, updatedOn, publishedOn) ->
|
||||||
cmd.Parameters["@id" ].Value <- pageId
|
cmd.Parameters["@id" ].Value <- pageId
|
||||||
@ -289,8 +274,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
[ cmd.Parameters.Add("@pageId", SqliteType.Text)
|
[ cmd.Parameters.Add("@pageId", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@oldAsOf", SqliteType.Text)
|
cmd.Parameters.Add("@oldAsOf", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@asOf", SqliteType.Text)
|
cmd.Parameters.Add("@asOf", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@text", SqliteType.Text)
|
cmd.Parameters.Add("@text", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (pageId, oldAsOf, asOf, text) ->
|
|> List.iter (fun (pageId, oldAsOf, asOf, text) ->
|
||||||
cmd.Parameters["@pageId" ].Value <- pageId
|
cmd.Parameters["@pageId" ].Value <- pageId
|
||||||
@ -314,8 +298,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
cmd.CommandText <- "UPDATE post SET updated_on = @updatedOn, published_on = @publishedOn WHERE id = @id"
|
cmd.CommandText <- "UPDATE post SET updated_on = @updatedOn, published_on = @publishedOn WHERE id = @id"
|
||||||
[ cmd.Parameters.Add("@id", SqliteType.Text)
|
[ cmd.Parameters.Add("@id", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@publishedOn", SqliteType.Text)
|
cmd.Parameters.Add("@publishedOn", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (postId, updatedOn, publishedOn) ->
|
|> List.iter (fun (postId, updatedOn, publishedOn) ->
|
||||||
cmd.Parameters["@id" ].Value <- postId
|
cmd.Parameters["@id" ].Value <- postId
|
||||||
@ -340,8 +323,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
[ cmd.Parameters.Add("@postId", SqliteType.Text)
|
[ cmd.Parameters.Add("@postId", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@oldAsOf", SqliteType.Text)
|
cmd.Parameters.Add("@oldAsOf", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@asOf", SqliteType.Text)
|
cmd.Parameters.Add("@asOf", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@text", SqliteType.Text)
|
cmd.Parameters.Add("@text", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (postId, oldAsOf, asOf, text) ->
|
|> List.iter (fun (postId, oldAsOf, asOf, text) ->
|
||||||
cmd.Parameters["@postId" ].Value <- postId
|
cmd.Parameters["@postId" ].Value <- postId
|
||||||
@ -364,8 +346,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
cmd.CommandText <- "UPDATE theme_asset SET updated_on = @updatedOn WHERE theme_id = @themeId AND path = @path"
|
cmd.CommandText <- "UPDATE theme_asset SET updated_on = @updatedOn WHERE theme_id = @themeId AND path = @path"
|
||||||
[ cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
[ cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@themeId", SqliteType.Text)
|
cmd.Parameters.Add("@themeId", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@path", SqliteType.Text)
|
cmd.Parameters.Add("@path", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (themeId, path, updatedOn) ->
|
|> List.iter (fun (themeId, path, updatedOn) ->
|
||||||
cmd.Parameters["@themeId" ].Value <- themeId
|
cmd.Parameters["@themeId" ].Value <- themeId
|
||||||
@ -385,8 +366,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
upRdr.Close ()
|
upRdr.Close ()
|
||||||
cmd.CommandText <- "UPDATE upload SET updated_on = @updatedOn WHERE id = @id"
|
cmd.CommandText <- "UPDATE upload SET updated_on = @updatedOn WHERE id = @id"
|
||||||
[ cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
[ cmd.Parameters.Add("@updatedOn", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@id", SqliteType.Text)
|
cmd.Parameters.Add("@id", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (upId, updatedOn) ->
|
|> List.iter (fun (upId, updatedOn) ->
|
||||||
cmd.Parameters["@id" ].Value <- upId
|
cmd.Parameters["@id" ].Value <- upId
|
||||||
@ -408,8 +388,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
cmd.CommandText <- "UPDATE web_log_user SET created_on = @createdOn, last_seen_on = @lastSeenOn WHERE id = @id"
|
cmd.CommandText <- "UPDATE web_log_user SET created_on = @createdOn, last_seen_on = @lastSeenOn WHERE id = @id"
|
||||||
[ cmd.Parameters.Add("@id", SqliteType.Text)
|
[ cmd.Parameters.Add("@id", SqliteType.Text)
|
||||||
cmd.Parameters.Add("@createdOn", SqliteType.Text)
|
cmd.Parameters.Add("@createdOn", SqliteType.Text)
|
||||||
cmd.Parameters.Add ("@lastSeenOn", SqliteType.Text)
|
cmd.Parameters.Add("@lastSeenOn", SqliteType.Text) ] |> ignore
|
||||||
] |> ignore
|
|
||||||
toUpdate
|
toUpdate
|
||||||
|> List.iter (fun (userId, createdOn, lastSeenOn) ->
|
|> List.iter (fun (userId, createdOn, lastSeenOn) ->
|
||||||
cmd.Parameters["@id" ].Value <- userId
|
cmd.Parameters["@id" ].Value <- userId
|
||||||
@ -487,7 +466,7 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
|
|
||||||
interface IData with
|
interface IData with
|
||||||
|
|
||||||
member _.Category = SQLiteCategoryData conn
|
member _.Category = SQLiteCategoryData (conn, ser)
|
||||||
member _.Page = SQLitePageData (conn, ser)
|
member _.Page = SQLitePageData (conn, ser)
|
||||||
member _.Post = SQLitePostData (conn, ser)
|
member _.Post = SQLitePostData (conn, ser)
|
||||||
member _.TagMap = SQLiteTagMapData conn
|
member _.TagMap = SQLiteTagMapData conn
|
||||||
|
Loading…
Reference in New Issue
Block a user