Commit 40bf81f6 authored by joliu's avatar joliu

添加新的数据库构建代码

parent 624f7017
...@@ -178,12 +178,13 @@ def createDB(): ...@@ -178,12 +178,13 @@ def createDB():
def createOutputDB(): def createOutputDB():
conn = sqlite3.connect("task.db") conn = sqlite3.connect("task.db")
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute("""CREATE TABLE `resulovetable` ( cursor.execute("""CREATE TABLE if not exist `resulovetable` (
`id` integer primary key autoincrement, `id` integer primary key autoincrement,
`taskmatrix` text NOT NULL, `taskmatrix` text NOT NULL,
`inputtype` text NOT NULL, `inputtype` text NOT NULL,
`status` tinyint DEFAULT 0, `status` tinyint DEFAULT 0,
`devicelist` text NOT NULL) `devicelist` text NOT NULL,
`ctime` tinyint DEFAULT 2)
""") """)
conn.commit() conn.commit()
cursor.close() cursor.close()
...@@ -194,10 +195,10 @@ def createOutputDB(): ...@@ -194,10 +195,10 @@ def createOutputDB():
def createDataCach(): def createDataCach():
conn = sqlite3.connect("task.db") conn = sqlite3.connect("task.db")
cursor = conn.cursor() cursor = conn.cursor()
cursor.execute("""CREATE TABLE `datacach` ( cursor.execute("""CREATE TABLE if not exist `datacach` (
`id` integer primary key autoincrement, `id` integer primary key autoincrement,
`deviceid` varchar(30) NOT NULL, `deviceid` varchar(30) NOT NULL,
`data` varchar(15) default '-', `data` integer default -1,
`updatetime` varchar(30) NOT NULL, `updatetime` varchar(30) NOT NULL,
`groupid` integer NOT NULL) `groupid` integer NOT NULL)
""") """)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment