One of the benefits of cfqueryparam is type checking before the values ββare sent to your database. For example, you specify cf_sql_integer , CF not only checks that the value is numeric, but also is an integer in a certain range. When you omit cfsqltype, CF will use cf_sql_char . That way, you obviously lose type checking for things like dates and numbers.
Personally, I think you should provide cfsqltype. However, even if you did not, using cfqueryparam means that CF uses binding variables. The lateral advantage of binding variables helps protect your queries from SQL injection. So in this sense, it is still good.
I think this is useful, but as a "check", not a "query SQL query" protection ".
Update: No, it is still applicable. Protection comes from using bind variables. Since CF will still use bind variables, even without any type, I believe that basic sql injection protection is still applied.
However, using cf_sql_char for anything other than a char column can cause your database to implicitly convert to the data type of the target column, sometimes producing unexpected results. So usually I would say that you should specify cfsqltype.
source share