-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbe.py
82 lines (47 loc) · 1.41 KB
/
be.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
75
76
77
78
79
80
81
82
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 10 18:52:01 2019
@author: RedOct
"""
import sqlite3
# def connect():
# con=sqlite3.connect("alprData.db")
# cur=con.cursor()
# cur.execute("create table if not exists userTable(naziv text,plates text)")
# con.commit()
# con.close()
def addrec(naziv,plates):
con=sqlite3.connect("alprData.db")
cur=con.cursor()
cur.execute("insert into userTable values(?,?)",(naziv,plates))
print("upisno je:",naziv,plates)
con.commit()
con.close()
def view():
con=sqlite3.connect("alprData.db")
cur=con.cursor()
cur.execute("SELECT * FROM userTable")
rows=cur.fetchall()
con.close()
return rows
def dele(naziv):
con=sqlite3.connect("alprData.db")
cur=con.cursor()
cur.execute("delete from userTable where naziv=?",(naziv,))
con.commit()
con.close()
def findit(naziv="",plates=""):
print('FIND IT', naziv, plates)
con=sqlite3.connect("alprData.db")
cur=con.cursor()
cur.execute("select * from userTable where naziv=? or plates=?",(naziv,plates,))
rows=cur.fetchall()
con.close()
print(rows)
return rows
'''def updt(mid,naziv="",plates=""):
con=sqlite3.connect("alprData.db")
cur=con.cursor()
cur.execute("update userTable set naziv=?,plates=? where id=?",(naziv,plates,mid))
con.commit()'''
connect()