from django_prometheus.db.common import DatabaseWrapperMixin
from django.db.backends.mysql import base


class DatabaseFeatures(base.DatabaseFeatures):
    """Our database has the exact same features as the base one."""
    pass


class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
    CURSOR_CLASS = base.CursorWrapper

from django_prometheus.db.common import (
    DatabaseWrapperMixin, ExportingCursorWrapper)
from django.db.backends.mysql import base


class DatabaseFeatures(base.DatabaseFeatures):
    """Our database has the exact same features as the base one."""
    pass


class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
    CURSOR_CLASS = base.CursorWrapper

    def create_cursor(self):
        cursor = self.connection.cursor()
        CursorWrapper = ExportingCursorWrapper(
            self.CURSOR_CLASS, self.alias, self.vendor)
        return CursorWrapper(cursor)

Use the proper API to Python-MySQL.
Use the proper API to Python-MySQL.

The common mixin used for other databases uses an API established
across databases, but Python-MySQL differs. This was broken during the
refactoring in 432f1874ffde0ad120aa79e568086a1731d22aeb.

Fixes #24

- from django_prometheus.db.common import DatabaseWrapperMixin
+ from django_prometheus.db.common import (
+     DatabaseWrapperMixin, ExportingCursorWrapper)
  from django.db.backends.mysql import base
  
  
  class DatabaseFeatures(base.DatabaseFeatures):
      """Our database has the exact same features as the base one."""
      pass
  
  
  class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
      CURSOR_CLASS = base.CursorWrapper
  
+     def create_cursor(self):
+         cursor = self.connection.cursor()
+         CursorWrapper = ExportingCursorWrapper(
+             self.CURSOR_CLASS, self.alias, self.vendor)
+         return CursorWrapper(cursor)
+ 
Use the proper API to Python-MySQL.
## Code Before:
from django_prometheus.db.common import DatabaseWrapperMixin
from django.db.backends.mysql import base


class DatabaseFeatures(base.DatabaseFeatures):
    """Our database has the exact same features as the base one."""
    pass


class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
    CURSOR_CLASS = base.CursorWrapper

## Instruction:
Use the proper API to Python-MySQL.
## Code After:
from django_prometheus.db.common import (
    DatabaseWrapperMixin, ExportingCursorWrapper)
from django.db.backends.mysql import base


class DatabaseFeatures(base.DatabaseFeatures):
    """Our database has the exact same features as the base one."""
    pass


class DatabaseWrapper(DatabaseWrapperMixin, base.DatabaseWrapper):
    CURSOR_CLASS = base.CursorWrapper

    def create_cursor(self):
        cursor = self.connection.cursor()
        CursorWrapper = ExportingCursorWrapper(
            self.CURSOR_CLASS, self.alias, self.vendor)
        return CursorWrapper(cursor)
