a
554325746@qq.com
2019-12-25 603cb36a5123e46656b06a5deb8d7ac7ff81307f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
%%%-------------------------------------------------------------------
%%% @author pansen
%%% @copyright (C) 2018, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 01. 八月 2018 16:01
%%%-------------------------------------------------------------------
-module(syncDB).
-author("pansen").
-compile(export_all).
%%-include("DbTool.hrl").
-include("nodeTool.hrl").
 
test() ->
  io:format("start test 12333 ~n"),
  mnesia:start(),
  lager:start(),
  ok.
test1() ->
  syncDB_sqlite3:test1(),
  syncDB_sqlite3:createDatabase(person, tt123666, '1', '1', '2018-01-01 01:02:00', '2018-12-31 01:02:00').
test2() ->
  syncDB_sqlite3:test1(),
  UUid = syncTool:getUUIDString(),
  sys_o_tables_esql:add_sys_table(UUid, " ", UUid,
    " ", person, '0096ee77-1f50-48e2-a08a-42536a754970@192.168.1.124', "2018-01-01 01:02:00", "2018-12-31 01:02:00"),
  sys_o_tables_esql:add_sys_table(syncTool:getUUIDString(), " ", syncTool:getUUIDString(), " ", person, '0096ee77-1f50-48e2-a08a-42536a754970@192.168.1.124', "2018-01-01 01:02:00", "2018-12-31 01:02:00").
 
bitStrToStr2([]) -> [];
bitStrToStr2([Value | T]) ->
  Val = binary:bin_to_list(Value),
  [Val | bitStrToStr2(T)].
test3() ->
%%  syncDB_sqlite3:test1(),
  %% Test that when the row-names are added..
  ok.
 
 
 
setCNode(CNode) ->
  Ret = mochiglobal:put('cNodeName', CNode),
  case Ret of
    ok ->
      Res = [{atomic, ok}];
    _ ->
      Res = [{aborted, notok}]
  end,
  Res.
 
sendMessage() ->
  syncDB_sqlite3:sendMessage().
 
testCreateCluster() ->
    syncDB:startNode('xuxiuxilaptop@192.168.1.159', ' ', 'xuxiuxilaptop', '1', 'jq').
    
testJoinCluster() ->
    syncDB:startNode('xuxiuxilaptop1@192.168.1.159', 'xuxiuxilaptop@192.168.1.159', 'xuxiuxilaptop1', '1', 'jq').
  
%%
%%  启动节点并自动连接到集群
%%  新节点自动进行初始化
%%
startNode(NodeName, FatherNodeName, DeviceId, ClusterId, ClusterName) ->
%%  configToBeam:config_to_beam(),
  syncDB_sqlite3:startNode(NodeName, FatherNodeName, DeviceId, ClusterId, ClusterName).
 
modifyCluName(CluId, CluName) ->
  syncDB_sqlite3:modifyCluName(CluId, CluName).
 
removeNode() ->
  syncDB_sqlite3:removeNode().
 
findAllNode() ->
  syncDB_sqlite3:findAllNode().
 
 
%%  创建底库
%% 创建底库 表类型,表名,同步状态,黑白名单
createDatabase(TableType, TableName, SyncType, BwType, StartTime, EndTime) ->
  syncDB_sqlite3:createDatabase(TableType, TableName, SyncType, BwType, StartTime, EndTime).
 
%%  c底库
%% 创建底库 表类型,表名,同步状态,黑白名单
updateDatabase(Uuid, TableType, TableName, SyncType, BwType, StartTime, EndTime) ->
  syncDB_sqlite3:updateDatabase(Uuid, TableType, TableName, SyncType, BwType, StartTime, EndTime).
 
 
%% shanchu底库
%% shanchu底库 表类型,表名
deleteDatabase(TableType, TableName) ->
  syncDB_sqlite3:deleteDatabase(TableType, TableName).
 
findAllDatabase() ->
  syncDB_sqlite3:findAllDatabase().
 
findAllTypeInfo() ->
  todo.
 
 
%%  插入人
%%  TableName, ID, PersonName, Age, Sex, IdCard, PhoneNum
%%  TableName, Feature
addPersonData(TableName, PersonName, Age, Sex, IdCard, PhoneNum, Img, UUID, Feature) ->
  syncDB_sqlite3:addPersonData(TableName, PersonName, Age, Sex, IdCard, PhoneNum, Img, UUID, Feature).
 
addPersonDatas(TableUuid, PersonLists) ->
  syncDB_sqlite3:addPersonDatas(TableUuid, PersonLists).
 
%%  删除人
%%  TableName, UUID
deletePersonData(TableName, UUID) ->
  syncDB_sqlite3:delPersonData(TableName, UUID).
 
 
%%  插入车
addCarData() ->
  ok.
 
%%  加载人脸数据库
loadFaceFeaData(TableName) ->
  syncDB_sqlite3:loadFaceFeaData(TableName).
 
%%  加载人脸数据库2 no feature
loadFaceFeaData2(TableName) ->
  syncDB_sqlite3:loadFaceFeaData2(TableName).
 
singlePersonIsExists(PersonId) ->
  syncDB_sqlite3:singlePersonIsExists(PersonId).
 
singlePersonUpdate(NewPerId, OldId, Idcard, PerPicUrl, PerFea) ->
  syncDB_sqlite3:singlePersonUpdate(NewPerId, OldId, Idcard, PerPicUrl, PerFea).