File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -63,40 +63,21 @@ def process():
6363 QueryData (conn )
6464 dbconn .close ()
6565
66- #def execute(sql):
67- # '''执行sql'''
68- # conn=dbconn.cursor()
69- # conn.execute(sql)
70-
71- #def executemany(sql, tmp):
72- # '''插入多条数据'''
73- # conn=dbconn.cursor()
74- # conn.executemany(sql,tmp)
75-
7666def query (sql ,conn ):
77- '''查询sql'''
78- #conn=dbconn.cursor()
7967 conn .execute (sql )
8068 rows = conn .fetchall ()
8169 return rows
8270
8371def DropTable (conn ):
84- #conn=dbconn.cursor()
8572 conn .execute ("DROP TABLE IF EXISTS `user_key`" )
8673
8774def CreateTable (conn ):
88- #conn=dbconn.cursor()
8975 sql_create = ''' CREATE TABLE `user_key` (`key` varchar(50) NOT NULL)'''
9076 conn .execute (sql_create )
9177
9278def InsertDatas (conn ):
93- #conn=dbconn.cursor()
94- #insert_sql = "insert into user_key values(%s)"
9579 insert_sql = "INSERT INTO user_key VALUES (%(value)s)"
9680 key_list = key_num (KEY_ALL )
97- #print len(key_list)
98- #conn.executemany(insert_sql,str(key_listi))
99- #conn.executemany("INSERT INTO user_key VALUES (%(value)s)",[dict(value=v) for v in key_list])
10081 conn .executemany (insert_sql ,[dict (value = v ) for v in key_list ])
10182
10283def DeleteData ():
You can’t perform that action at this time.
0 commit comments