Skip to content

Commit e2c93b1

Browse files
committed
rename properties in Database class, add get_driver() method
1 parent e1038e6 commit e2c93b1

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

simple_query_builder/database.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,26 @@ def __call__(cls, *args, **kwargs):
1717

1818

1919
class DataBase(metaclass=MetaSingleton):
20-
driver = "sqlite"
21-
db_name = ":memory:"
22-
conn = None
23-
cursor = None
20+
_driver = "sqlite"
21+
_db_name = ":memory:"
22+
_conn = None
23+
_cursor = None
2424

2525
def connect(self, db_name: str = "", uri: bool = False):
2626
if db_name:
27-
self.db_name = db_name
27+
self._db_name = db_name
2828

29-
if self.conn is None:
30-
if self.driver == "sqlite":
31-
self.conn = sqlite3.connect(self.db_name, uri=uri)
32-
self.cursor = self.conn.cursor()
29+
if self._conn is None:
30+
if self._driver == "sqlite":
31+
self._conn = sqlite3.connect(self._db_name, uri=uri)
32+
self._cursor = self._conn.cursor()
3333
else:
3434
print("Wrong DB driver. At present time it's supported 'sqlite' only")
3535

36-
return self.conn
36+
return self._conn
3737

3838
def c(self):
39-
return self.cursor
39+
return self._cursor
40+
41+
def get_driver(self):
42+
return self._driver

0 commit comments

Comments
 (0)