背景
In database management systems (DBMS), a prepared statement or parameterized statement is a feature used to execute the same or similar database statements repeatedly with high efficiency. Typically used with SQL statements such as queries or updates, the prepared statement takes the form of a template into which certain constant values are substituted during each execution. (https://en.wikipedia.org/wiki/Prepared_statement)
在数据库系统中,带参数的语句(parameterized statement),一方面,能够提供预编译的能力,以达到高效执行语句、提高性能的目的。另一方面,能够预防SQL注入攻击,安全性更好。以上两点是传统的数据库系统使用支持带参数语句的主要原因。
从数据库系统角度看,OpenMLDB 支持Parameterized query statement能进一步完善数据库查询能力。从业务角度上看,它使得OpenMLDB能够在规则引擎场景下,支持规则特征计算。
场景示例:规则引擎特征计算
SELECT
SUM(trans_amount) as F_TRANS_AMOUNT_SUM,
COUNT(user) as F_TRANS_COUNT,
MAX(trans_amount) as F_TRANS_AMOUNT_MAX,
MIN(trans_amount) as F_TRANS_AMOUNT_MIN,
FROM t1 where user = 'ABC123456789' and trans_time between 1590115420000 and 1592707420000;
更多文章请关注《万象专栏》
转载请注明出处:https://www.wanxiangsucai.com/read/cv14070