-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.py
74 lines (59 loc) · 1.73 KB
/
script.py
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
import sqleet
import os
import sqlite3
if __name__ == "__main__":
db_name = "./Contents/YOURDATABSENAME.db"
# key = b"Key"
# # Try to open db with the wrong key, this fails
# try:
# con = sqleet.connect(db_name, key="123456")
# except sqleet.AuthenticationError:
# print("Failed to open database")
# ===================
CONN = sqlite3.connect('./Contents/YOURSRCDB.db')
cursor = CONN.cursor()
execute_sentence = "select * from tablex"
temp = cursor.execute(execute_sentence).fetchall()
cursor.close()
CONN.close()
# print(temp)
# Remove the encryption on the created database
# con = sqleet.connect(db_name, key=key)
# con.change_key(None)
# con.close()
# # Create a new encrypted db
con = sqleet.connect(db_name, key="YOURKEY")
# # con.execute("create table test(col char);")
# # cursor = conn.cursor()
con.execute('''
create table tablex(
createTime integer,
Des integer,
ImgStatus integer,
MesLocalID integer,
Message text,
MesSvrID integer,
Status integer,
TableVar integer,
Type integer
)
''')
# con.commit()
# con.close()
# con = sqleet.connect(db_name, key="123456")
# data = [
# (2, 'lily', 19),
# (3, 'mike', 20)
# ]
sql = 'insert into tablex values (?, ?, ?, ?, ? ,?, ?, ?, ?)'
con.executemany(sql, temp)
con.commit()
# cursor.close()
con.close()
# ==============
# con = sqleet.connect(db_name, key="XXgqdl41h5900490")
# t = con.execute("select createTime from chathistory")
# # print(t)
# for i in t:
# print(i)
# con.close()