fix(sqlserver): let a single query be a length 1 batch
Need to be fixed: `emqx_plugin_libs_rule:proc_tmpl/2` won't add single quotes for string
This commit is contained in:
parent
a379d909bf
commit
27fdf644aa
|
@ -502,15 +502,18 @@ parse_sql_template([], SingleInsertTks, BatchInsertTks) ->
|
||||||
|
|
||||||
%% single insert
|
%% single insert
|
||||||
apply_template(
|
apply_template(
|
||||||
{?ACTION_SEND_MESSAGE = Key, Msg} = Query,
|
{?ACTION_SEND_MESSAGE = _Key, _Msg} = Query,
|
||||||
#{?SINGLE_INSERT_TEMP := SingleInsertTks} = _Templates
|
#{?SINGLE_INSERT_TEMP := _SingleInsertTks} = Templates
|
||||||
) ->
|
) ->
|
||||||
case maps:get(Key, SingleInsertTks, undefined) of
|
%% TODO: fix emqx_plugin_libs_rule:proc_tmpl/2
|
||||||
undefined ->
|
%% it won't add single quotes for string
|
||||||
Query;
|
apply_template([Query], Templates);
|
||||||
Template ->
|
%% case maps:get(Key, SingleInsertTks, undefined) of
|
||||||
{Key, emqx_plugin_libs_rule:proc_tmpl(Template, Msg)}
|
%% undefined ->
|
||||||
end;
|
%% Query;
|
||||||
|
%% Template ->
|
||||||
|
%% {Key, emqx_plugin_libs_rule:proc_tmpl(Template, Msg)}
|
||||||
|
%% end;
|
||||||
%% batch inserts
|
%% batch inserts
|
||||||
apply_template(
|
apply_template(
|
||||||
[{?ACTION_SEND_MESSAGE = Key, _Msg} | _T] = BatchReqs,
|
[{?ACTION_SEND_MESSAGE = Key, _Msg} | _T] = BatchReqs,
|
||||||
|
|
Loading…
Reference in New Issue