Perhaps the solution suggested by Mark Lawrence would work: https://sqlite.org/forum/forumpost/fae910011b