FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
vcs/_4.python/_db/PythonSQL-master/sqlite-ctrl.py at master · bunshue/vcs · GitHub
bunshue
/
vcs
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
3
Code
Issues
0
Pull requests
4
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
vcs
/
_4.python
/
_db
/
PythonSQL-master
/
sqlite-ctrl.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
55 lines (46 loc) · 1.13 KB
Breadcrumbs
vcs
/
_4.python
/
_db
/
PythonSQL-master
/
sqlite-ctrl.py
Copy path
File metadata and controls
55 lines (46 loc) · 1.13 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
sqlite3
conn
=
sqlite3
.
connect
(
'DevDb.db'
)
cursor
=
conn
.
cursor
()
appDesc
=
"""
Please input action code :
1 - Insert Data
2 - Update Data
3 - Delete Date
--- --- ---
0 - exit
"""
isRun
=
True
while
isRun
:
cursor
.
execute
(
'SELECT * FROM `app_info`;'
)
records
=
cursor
.
fetchall
()
for
r
in
records
:
print
(
r
)
ctrl
=
input
(
appDesc
)
if
ctrl
==
"0"
:
isRun
=
False
elif
ctrl
==
"1"
:
sql
=
"""
INSERT INTO app_info (name, version, author, date, remark)
VALUES ('App', 'v1.0.1', 'DevAuth', '2021-11-20', 'App-v1.0.1');
"""
cursor
.
execute
(
sql
)
conn
.
commit
()
elif
ctrl
==
"2"
:
row_id
=
input
(
"row_id = ? "
)
sql
=
"""
update app_info
set name = 'AppNew' , version='1.0.2' , remark = 'App-v1.0.2'
WHERE id={};
"""
.
format
(
row_id
)
cursor
.
execute
(
sql
)
conn
.
commit
()
elif
ctrl
==
"3"
:
row_id
=
input
(
"row_id = ? "
)
sql
=
"""
delete from app_info
where id={};
"""
.
format
(
row_id
)
cursor
.
execute
(
sql
)
conn
.
commit
()
cursor
.
close
()
conn
.
close
()
Back
|
FazBrowse Home
|
New Git URL