Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the difference between # and $in mybatis?

Shulou Source: shulou.com Published: 2022-06-01 09:14:30 11月10日 Update

# means that precompilation is used to prevent sql injection. And $is not.

Use # to default the passed parameter to a string. While $will not, whatever is passed in is what is passed in.

$is generally used to pass in database objects, such as table names.

If you pass in a Date type, use #.

Ps: also encountered in the use of mybatis, statements within this symbol will not be treated as strings, but directly as sql statements, such as to execute a stored procedure.

Tags: Characters strings statements parameters objects that is data databases symbols types but procedures processing storage compilation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple OPPO Reno MariaDB MySQL