类:StatementSync


【Class: StatementSync

这个类表示一个单独的 准备好的声明。这个类不能通过其构造函数实例化。相反,实例是通过 database.prepare() 方法创建的。该类提供的所有 API 都是同步执行的。

【This class represents a single prepared statement. This class cannot be instantiated via its constructor. Instead, instances are created via the database.prepare() method. All APIs exposed by this class execute synchronously.】

预处理语句是用于创建它的 SQL 的高效二进制表示。预处理语句是可参数化的,可以使用不同的绑定值多次调用。参数还可以提供对 SQL 注入 攻击的保护。因此,在处理用户输入时,比起手工编写的 SQL 字符串,预处理语句更为推荐。

【A prepared statement is an efficient binary representation of the SQL used to create it. Prepared statements are parameterizable, and can be invoked multiple times with different bound values. Parameters also offer protection against SQL injection attacks. For these reasons, prepared statements are preferred over hand-crafted SQL strings when handling user input.】