-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.py
51 lines (46 loc) · 941 Bytes
/
db.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
import sqlite3
def connect_db(path):
g.db = sqlite3.connect(path)
g.db.row_factory = sqlite3.Row()
def create_char_database(c):
c.executescript(
"""
CREATE TABLE char (
name TEXT PRIMARY KEY,
relative TEXT,
town TEXT,
area TEXT,
reward REAL);
CREATE TABLE bonnus (
id INTEGER PRIMARY KEY,
char TEXT,
bonus_type TEXT,
bonus REAL);
CREATE TABLE phrases(
id INTEGER PRIMARY KEY,
char TEXT,
type TEXT,
phrase TEXT);
CREATE TABLE bobots(
id INTEGER PRIMARY KEY,
name TEXT,
char TEXT);
CREATE TABLE parts(
id INTEGER PRIMARY KEY,
bobot INTEGER,
part TEXT,
level INTEGER);
"""
)
def populate_char_database(c):
char_list = [
('Lilly', 'Ms. Honey','SquirrelTown', 'School', 'Agility', 0.03,"And isn't he pretty, too?", "Mine is still the cutest.",10, 'Rodent','Push')
]
c.executescript(
"""
INSERT INTO char
"""
)
db = sqlite3.connect(path)
c = db.cursor()
create_char_database(c)