1
#!/usr/bin/env python3.1
6
#======================= connection to DB ===========================
8
conn = sqlite3.connect("./awnsers.sqlite") #makes the connection with the db file.
11
##create table from query from file: create table if not exists
13
f = open("./createDB.sql")
18
#===================== end DB connection ==========================
21
#===================== Futction section ===========================
9
26
menuOptions="""1. show DB
14
32
print("select an option")
16
34
menuOptionsInput = input(">>>>")
19
if(menuOptionsInput == 1):
37
if(menuOptionsInput == 1 or menuOptionsInput.lower() == "s" ):
22
elif(menuOptionsInput == 2):
25
elif(menuOptionsInput == 3):
28
elif(menuOptionsInput == 4):
40
elif(menuOptionsInput == 2 or menuOptionsInput.lower() =="e" ):
43
elif(menuOptionsInput == 3 or menuOptionsInput.lower() == "a" ):
46
elif(menuOptionsInput == 4 or menuOptionsInput.lower() == "q" ):
50
print("You need to select an option! in the list")
35
## make connectiot to DB:
37
""" This functon connects to the DB and you gain access to its
39
IE: db.execute("insert into knights values('nii', 'sir') ")
40
the DB file is located in ./awnsers.sqlite"""
41
conn = sqlite3.connect("./awnsers.sqlite") #makes the connection with the db file.
44
##check if table exists:
45
checkDB = db.execute(""" select 1 from sqlite_master where type='table' and name='awnsers' ;""", )
47
f = open("./createDB.sql")
53
#print("db allready exists! conituing.")
59
dbConn() ##connect to DB
59
print("DEBUG : Running dbShow()")
60
#TODO: make it print counts of occurunsus of different true (integer 1) values
60
62
getQuery =""" select * from awnsers; """
61
63
db.execute(getQuery)
67
69
if(getQuery == None):
75
print("DEBUG: running dbEdit()")
81
print("DEBUG: running dbAdd()")
82
#TODO: make a function with all the questions and such.
86
#==================== end function setion ==================
89
#==================== main call section ====================