Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openXG-WIC-Opencpc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
alex037yang
openXG-WIC-Opencpc
Commits
07d40328
Commit
07d40328
authored
Apr 15, 2018
by
joliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增两个数据库表单
parent
56bffe85
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
2 deletions
+33
-2
hfv/listenSer.py
hfv/listenSer.py
+33
-2
No files found.
hfv/listenSer.py
View file @
07d40328
...
@@ -174,6 +174,37 @@ def createDB():
...
@@ -174,6 +174,37 @@ def createDB():
cursor
.
close
()
cursor
.
close
()
conn
.
close
()
conn
.
close
()
# 创建输出数据库
def
createOutputDB
():
conn
=
sqlite3
.
connect
(
"task.db"
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
"""CREATE TABLE `resulovetable` (
`id` integer primary key autoincrement,
`taskmatrix` text NOT NULL,
`inputtype` text NOT NULL,
`status` tinyint DEFAULT 0,
`devicelist` text NOT NULL)
"""
)
conn
.
commit
()
cursor
.
close
()
conn
.
close
()
# 创建数据缓存数据库
def
createDataCach
():
conn
=
sqlite3
.
connect
(
"task.db"
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
"""CREATE TABLE `datacach` (
`id` integer primary key autoincrement,
`deviceid` varchar(30) NOT NULL,
`data` varchar(15) default '-',
`updatetime` varchar(30) NOT NULL,
`groupid` integer NOT NULL)
"""
)
conn
.
commit
()
cursor
.
close
()
conn
.
close
()
# 设置时间周期
# 设置时间周期
def
updatePeriod
(
cTime
):
def
updatePeriod
(
cTime
):
...
@@ -257,8 +288,9 @@ def showDB():
...
@@ -257,8 +288,9 @@ def showDB():
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
createOutputDB
()
createDB
()
createDB
()
createDataCach
()
# 设置host和port
# 设置host和port
HOST
,
PORT
=
"0.0.0.0"
,
3000
HOST
,
PORT
=
"0.0.0.0"
,
3000
logger
=
logging
.
getLogger
(
"TCPServer"
)
logger
=
logging
.
getLogger
(
"TCPServer"
)
...
@@ -287,4 +319,3 @@ if __name__ == "__main__":
...
@@ -287,4 +319,3 @@ if __name__ == "__main__":
# 使用control + C 退出程序
# 使用control + C 退出程序
server
.
serve_forever
()
server
.
serve_forever
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment