Nick
Nick
Explore posts from servers
CCoder.com
Created by Nick on 5/26/2024 in #help
VSCode Web extensions disappear after restart
Hey! So I crafted a template and installed the module vscode-web because of the copilot support and profile sync, only I am facing some issues! After I update my workspace or restart the workspace, the extensions that I installed previously are gone, I then attempted to make the /root directory presistant but that really didn't go well. Does anyone know how to solve this?
28 replies
CDCloudflare Developers
Created by Nick on 8/2/2023 in #general-help
How do I allow other people to access my pages and workers?
12 replies
KKysely
Created by Nick on 6/25/2023 in #help
Escaped paramaters in raw sql
For a few queries I made postgreSQL functions, this is the current way of how I call this function:
export async function getRandomAnswerByQuestionId({ questionId, answerLimit }: { questionId: string, answerLimit: number }) {
return sql`SELECT * FROM get_random_answers(${sql.val(questionId)}, ${sql.val(answerLimit)})`.execute(databaseClient);
}
export async function getRandomAnswerByQuestionId({ questionId, answerLimit }: { questionId: string, answerLimit: number }) {
return sql`SELECT * FROM get_random_answers(${sql.val(questionId)}, ${sql.val(answerLimit)})`.execute(databaseClient);
}
only thing I could find on the docs for .val is:
sql.val(value) is a shortcut for: sql<ValueType>${value}
while the others have warnings like:
WARNING! Using this with unchecked inputs WILL lead to SQL injection vulnerabilities. The input is not checked or escaped by Kysely in any way.
My question is, is my method of querying the function correct or are there better ways to query those? And are inputs escaped by using .val?
5 replies
KKysely
Created by Nick on 6/15/2023 in #help
How to sort by random?
Imagine this query:
export default function findUsers() {
return db
.selectFrom('person')
.selectAll()
.where('age', '>', 5)
.orderBy('age', 'desc');
}
export default function findUsers() {
return db
.selectFrom('person')
.selectAll()
.where('age', '>', 5)
.orderBy('age', 'desc');
}
Instead of sorting by age, how would I sory by random?
4 replies