Fix to queryPrefix and LIKE queries
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user