preventing sql injections #329
-
I've read the documentation, but I still don't understand if your library provides protection against sql injections. If there is such a possibility, which method should I use? In which cases protection against sql injections is not implemented |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
@I-m-good-man: SQL injection happens when you are building a query string that includes the parameters inlined. If you want to do that, nobody can prevent it, however, it you are using the There are multiple ways to specify parameter locations inside the query, you can see examples using |
Beta Was this translation helpful? Give feedback.
@I-m-good-man: SQL injection happens when you are building a query string that includes the parameters inlined. If you want to do that, nobody can prevent it, however, it you are using the
query
method with theparameters
, these values will not be inlined, instead sent as a separate part of the query. It prevents injection attacks, and also optimizes the query execution, as it spares the server a bit of time with a more efficient protocol.There are multiple ways to specify parameter locations inside the query, you can see examples using
@name
or$2
, but also?
could be used (each with differentSql
initializer). Theparameters
object should be aMap
for named parameters orList
for index…