fix mysql endpoint
This commit is contained in:
parent
ef7d4bf627
commit
a1c114ee4f
@ -127,9 +127,9 @@ handle_info({next_data, _Id, _Tuple}, State = #state{status = ?DISCONNECTED}) ->
|
||||
{noreply, State};
|
||||
%% 发送数据到mqtt服务器
|
||||
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
|
||||
ok ->
|
||||
NBuffer = endpoint_buffer:ack(Id, Buffer),
|
||||
|
||||
@ -5,7 +5,6 @@
|
||||
|
||||
-module(iot_sup).
|
||||
-behaviour(supervisor).
|
||||
-include_lib("endpoint/include/endpoint.hrl").
|
||||
|
||||
-export([start_link/0]).
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user