Updates
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
|
||||
from django.db.backends.mysql import base
|
||||
|
||||
from django_prometheus.db.common import DatabaseWrapperMixin, ExportingCursorWrapper
|
||||
|
||||
|
||||
class DatabaseFeatures(base.DatabaseFeatures):
|
||||
"""Our database has the exact same features as the base one."""
|
||||
|
||||
|
||||
class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
|
||||
CURSOR_CLASS = base.CursorWrapper
|
||||
|
||||
def create_cursor(self, name=None):
|
||||
cursor = self.connection.cursor()
|
||||
CursorWrapper = ExportingCursorWrapper(self.CURSOR_CLASS, self.alias, self.vendor)
|
||||
return CursorWrapper(cursor)
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
from django.contrib.gis.db.backends.postgis import base
|
||||
from django.db.backends.postgresql.base import Cursor
|
||||
|
||||
from django_prometheus.db.common import DatabaseWrapperMixin, ExportingCursorWrapper
|
||||
|
||||
|
||||
class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
|
||||
def get_new_connection(self, *args, **kwargs):
|
||||
conn = super().get_new_connection(*args, **kwargs)
|
||||
conn.cursor_factory = ExportingCursorWrapper(
|
||||
conn.cursor_factory or Cursor(),
|
||||
"postgis",
|
||||
self.vendor,
|
||||
)
|
||||
|
||||
return conn
|
||||
|
||||
def create_cursor(self, name=None):
|
||||
# cursor_factory is a kwarg to connect() so restore create_cursor()'s
|
||||
# default behavior
|
||||
return base.DatabaseWrapper.create_cursor(self, name=name)
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
from django.db.backends.postgresql import base
|
||||
from django.db.backends.postgresql.base import Cursor
|
||||
|
||||
from django_prometheus.db.common import DatabaseWrapperMixin, ExportingCursorWrapper
|
||||
|
||||
|
||||
class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
|
||||
def get_new_connection(self, *args, **kwargs):
|
||||
conn = super().get_new_connection(*args, **kwargs)
|
||||
conn.cursor_factory = ExportingCursorWrapper(
|
||||
conn.cursor_factory or Cursor(),
|
||||
self.alias,
|
||||
self.vendor,
|
||||
)
|
||||
|
||||
return conn
|
||||
|
||||
def create_cursor(self, name=None):
|
||||
# cursor_factory is a kwarg to connect() so restore create_cursor()'s
|
||||
# default behavior
|
||||
return base.DatabaseWrapper.create_cursor(self, name=name)
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,12 @@
|
||||
from django.contrib.gis.db.backends.spatialite import base, features
|
||||
from django.db.backends.sqlite3 import base as sqlite_base
|
||||
|
||||
from django_prometheus.db.common import DatabaseWrapperMixin
|
||||
|
||||
|
||||
class DatabaseFeatures(features.DatabaseFeatures):
|
||||
"""Our database has the exact same features as the base one."""
|
||||
|
||||
|
||||
class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
|
||||
CURSOR_CLASS = sqlite_base.SQLiteCursorWrapper
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
from django.db.backends.sqlite3 import base
|
||||
|
||||
from django_prometheus.db.common import DatabaseWrapperMixin
|
||||
|
||||
|
||||
class DatabaseFeatures(base.DatabaseFeatures):
|
||||
"""Our database has the exact same features as the base one."""
|
||||
|
||||
|
||||
class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
|
||||
CURSOR_CLASS = base.SQLiteCursorWrapper
|
||||
Reference in New Issue
Block a user