Refactor db_connection -> Database
This commit is contained in:
parent
4d60fd4adb
commit
bedad8df22
|
@ -1,6 +1,7 @@
|
||||||
import sqlite3
|
import sqlite3
|
||||||
|
|
||||||
class db_connection(object):
|
|
||||||
|
class Database(object):
|
||||||
|
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.conn = sqlite3.connect(path)
|
self.conn = sqlite3.connect(path)
|
||||||
|
@ -29,7 +30,7 @@ class db_connection(object):
|
||||||
def table_exists(self, name):
|
def table_exists(self, name):
|
||||||
result = self.conn.execute("""SELECT * FROM sqlite_master
|
result = self.conn.execute("""SELECT * FROM sqlite_master
|
||||||
WHERE type='table' AND name=?""", (name,))
|
WHERE type='table' AND name=?""", (name,))
|
||||||
if result.fetchone() == None:
|
if result.fetchone() is None:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue
Block a user