Database, Refactor toolbars

This commit is contained in:
BasioMeusPuga
2017-11-06 03:34:53 +05:30
parent 42631f5eae
commit de8036b87d
4 changed files with 131 additions and 23 deletions

21
database.py Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env python3
import sqlite3
import os
class DatabaseFunctions:
def __init__(self, location_prefix):
os.makedirs(location_prefix, exist_ok=True)
self.database_path = os.path.join(
location_prefix, 'Lector.db')
self.database = sqlite3.connect(self.database_path)
if not os.path.exists(self.database_path):
self.create_database()
def create_database(self):
self.database.execute(
"CREATE TABLE books \
(id INTEGER PRIMARY KEY, Name TEXT, Path TEXT, ISBN TEXT, CoverImage BLOB)")
self.database.commit()