- str_c = sql_paste(""),
- # https://dev.mysql.com/doc/refman/8.0/en/regexp.html
- # NB: case insensitive by default; could use REGEXP_LIKE for MySQL,
- # but available in MariaDB. A few more details at:
- # https://www.oreilly.com/library/view/mysql-cookbook/0596001452/ch04s11.html
- str_detect = sql_infix("REGEXP"),
- str_locate = function(string, pattern) {
- sql_expr(REGEXP_INSTR(!!string, !!pattern))
- },
- str_replace_all = function(string, pattern, replacement){
- sql_expr(regexp_replace(!!string, !!pattern, !!replacement))
- }
- ),
- sql_translator(.parent = base_agg,
- n = function() sql("COUNT(*)"),
- sd = sql_aggregate("STDDEV_SAMP", "sd"),
- var = sql_aggregate("VAR_SAMP", "var"),
- str_flatten = function(x, collapse) {
- sql_expr(group_concat(!!x %separator% !!collapse))
- }
- ),