by Neverbolt · 9y ago · 0 comments
> friends: dbQuery("select * from firends where user_id = "+userId).data,
> comments: dbQuery("select * from comments where user_id = "+userId).data,
> likes: dbQuery("select * from likes where user_id = "+userId).data
I'm no js developer, but there has to be a way of using prepared statements, even if just for sample code.
It's not 2001 anymore, security is important!
This can be done, for example, by testing it before the SQL call. In that case, it's safer than most pointer-dereferences done in C++.
>friends: dbQuery("select * from firends where user_id = "+userId).data
The point is that regardless of where it came from parameterized queries are a staple of programming now, and having an example without it would be like having an example of a login system be
if (username in db && password in db) { login() }