Fix to queryPrefix and LIKE queries
parent
fe77d44745
commit
68809ff958
|
@ -99,7 +99,8 @@ export function storeSyscalls(
|
|||
"store.deletePrefix": async (_ctx, prefix: string) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE "${prefix}%"`,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE ?`,
|
||||
`${prefix}%`,
|
||||
);
|
||||
},
|
||||
"store.deleteQuery": async (_ctx, query: Query) => {
|
||||
|
@ -152,7 +153,8 @@ export function storeSyscalls(
|
|||
return (
|
||||
await asyncQuery<Item>(
|
||||
db,
|
||||
`SELECT key, value FROM ${tableName} WHERE key LIKE "${prefix}%"`,
|
||||
`SELECT key, value FROM ${tableName} WHERE key LIKE ?`,
|
||||
`${prefix}%`,
|
||||
)
|
||||
).map(({ key, value }) => ({
|
||||
key,
|
||||
|
|
|
@ -24,7 +24,6 @@ export async function updateMaterializedQueriesCommand() {
|
|||
currentPage,
|
||||
)
|
||||
) {
|
||||
console.log("Going reload the page");
|
||||
await editor.reloadPage();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -283,6 +283,7 @@ export class HttpServer {
|
|||
const name = ctx.params.name;
|
||||
const plugName = ctx.params.plug;
|
||||
const args = await ctx.request.body().value;
|
||||
console.log("Got args", args, "for", name, "in", plugName);
|
||||
const plug = this.system.loadedPlugs.get(plugName);
|
||||
if (!plug) {
|
||||
ctx.response.status = 404;
|
||||
|
@ -298,6 +299,7 @@ export class HttpServer {
|
|||
ctx.response.headers.set("Content-Type", "application/json");
|
||||
ctx.response.body = JSON.stringify(result);
|
||||
} catch (e: any) {
|
||||
console.log("Error", e);
|
||||
ctx.response.status = 500;
|
||||
ctx.response.body = e.message;
|
||||
return;
|
||||
|
|
|
@ -88,7 +88,8 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
|||
return (
|
||||
await asyncQuery<Item>(
|
||||
db,
|
||||
`SELECT key, page, value FROM ${tableName} WHERE key LIKE "${prefix}%"`,
|
||||
`SELECT key, page, value FROM ${tableName} WHERE key LIKE ?`,
|
||||
`${prefix}%`,
|
||||
)
|
||||
).map(({ key, value, page }) => ({
|
||||
key,
|
||||
|
@ -116,11 +117,12 @@ export function pageIndexSyscalls(db: SQLite): SysCallMapping {
|
|||
"index.deletePrefixForPage": async (ctx, page: string, prefix: string) => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE "${prefix}%" AND page = ?`,
|
||||
`DELETE FROM ${tableName} WHERE key LIKE ? AND page = ?`,
|
||||
`${prefix}%`,
|
||||
page,
|
||||
);
|
||||
},
|
||||
"index.clearPageIndex": async (ctx) => {
|
||||
"index.clearPageIndex": async () => {
|
||||
await asyncExecute(
|
||||
db,
|
||||
`DELETE FROM ${tableName}`,
|
||||
|
|
Loading…
Reference in New Issue