Skip to content

Commit

Permalink
Refactor SQLiteConnection to use a separate method for creating the c…
Browse files Browse the repository at this point in the history
…onnection
  • Loading branch information
josephmancuso committed Oct 27, 2024
1 parent 6c4ff02 commit d14c826
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/masoniteorm/connections/SQLiteConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,16 @@ def make_connection(self):
if self.has_global_connection():
return self.get_global_connection()

self._connection = self.create_connection()
self._connection = sqlite3.connect(self.database, isolation_level=None)
self._connection.create_function("REGEXP", 2, regexp)

self._connection.row_factory = sqlite3.Row

self.enable_disable_foreign_keys()

self.open = 1

return self

def create_connection(self):
import sqlite3
connection = sqlite3.connect(self.database, isolation_level=None)
connection.create_function("REGEXP", 2, regexp)
connection.row_factory = sqlite3.Row
return connection

@classmethod
def get_default_query_grammar(cls):
Expand Down

0 comments on commit d14c826

Please sign in to comment.