fix mysql endpoint

This commit is contained in:
anlicheng 2025-08-15 18:52:57 +08:00
parent ef7d4bf627
commit a1c114ee4f
2 changed files with 2 additions and 3 deletions

View File

@ -127,9 +127,9 @@ handle_info({next_data, _Id, _Tuple}, State = #state{status = ?DISCONNECTED}) ->
{noreply, State}; {noreply, State};
%% mqtt服务器 %% mqtt服务器
handle_info({next_data, Id, ServiceId, Format, Metric}, State = #state{status = ?CONNECTED, pool_pid = PoolPid, buffer = Buffer, handle_info({next_data, Id, ServiceId, Format, Metric}, State = #state{status = ?CONNECTED, pool_pid = PoolPid, buffer = Buffer,
endpoint = #endpoint{title = Title, config = #mysql_endpoint{table_name = Table}}}) -> endpoint = #endpoint{title = Title, config = #mysql_endpoint{table_name = Table, fields_map = FieldsMap}}}) ->
{ok, InsertSql, Values} = insert_sql(Table, ServiceId, Format, Metric), {ok, InsertSql, Values} = insert_sql(Table, ServiceId, Format, FieldsMap, Metric),
case poolboy:transaction(PoolPid, fun(ConnPid) -> mysql:query(ConnPid, InsertSql, Values) end) of case poolboy:transaction(PoolPid, fun(ConnPid) -> mysql:query(ConnPid, InsertSql, Values) end) of
ok -> ok ->
NBuffer = endpoint_buffer:ack(Id, Buffer), NBuffer = endpoint_buffer:ack(Id, Buffer),

View File

@ -5,7 +5,6 @@
-module(iot_sup). -module(iot_sup).
-behaviour(supervisor). -behaviour(supervisor).
-include_lib("endpoint/include/endpoint.hrl").
-export([start_link/0]). -export([start_link/0]).