<commit_before># Highly based on Django's builtin Oracle backend.
#
# In fact, we only change the data_types_reverse dictionary. Unfortunately we
# can't just subclass their DatabaseIntrospection class because their module
# imports cx_Oracle. (We could do nasty monkey-patching trickery, but...)

from django.db.backends import BaseDatabaseIntrospection
from com.ziclix.python.sql import zxJDBC
import re

foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")

class DatabaseIntrospection(BaseDatabaseIntrospection):
    # Maps type objects to Django Field types.
    data_types_reverse = {
        zxJDBC.CLOB: 'TextField',
        zxJDBC.VARCHAR: 'CharField',
        zxJDBC.FLOAT: 'FloatField',
        zxJDBC.DATETIME: 'DateTimeField',
        zxJDBC.STRING: 'CharField',
        zxJDBC.TIMESTAMP: 'DateTimeField',
        zxJDBC.NUMERIC: 'SmallIntegerField',
        zxJDBC.INTEGER: 'IntegerField',
        zxJDBC.DECIMAL: 'Decimal',
        zxJDBC.NUMBER: 'Decimal'
    }

    def get_table_list(self, cursor):
        "Returns a list of table names in the current database."
        cursor.execute("SELECT TABLE_NAME FROM USER_TABLES")
        return [row[0].upper() for row in cursor.fetchall()]

    def get_table_description(self, cursor, table_name):
        "Returns a description of the table, with the DB-API cursor.description interface."
        cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name))
        return cursor.description

    def table_name_converter(self, name):
        "Table name comparison is case insensitive under Oracle"
        return name.upper()
        
    def _name_to_index(self, cursor, table_name):
        """
        Returns a dictionary of {field_name: field_index} for the given table.
        Indexes are 0-based.
        """
        return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name))])<commit_msg>s/Decimal/DecimalField in Oracle's introspection.py. Fixes issue 30. Thanks to <NAME> for the patch.<commit_after># Highly based on Django's builtin Oracle backend.
#
# In fact, we only change the data_types_reverse dictionary. Unfortunately we
# can't just subclass their DatabaseIntrospection class because their module
# imports cx_Oracle. (We could do nasty monkey-patching trickery, but...)

from django.db.backends import BaseDatabaseIntrospection
from com.ziclix.python.sql import zxJDBC
import re

foreign_key_re = re.compile(r"\sCONSTRAINT `[^`]*` FOREIGN KEY \(`([^`]*)`\) REFERENCES `([^`]*)` \(`([^`]*)`\)")

class DatabaseIntrospection(BaseDatabaseIntrospection):
    # Maps type objects to Django Field types.
    data_types_reverse = {
        zxJDBC.CLOB: 'TextField',
        zxJDBC.VARCHAR: 'CharField',
        zxJDBC.FLOAT: 'FloatField',
        zxJDBC.DATETIME: 'DateTimeField',
        zxJDBC.STRING: 'CharField',
        zxJDBC.TIMESTAMP: 'DateTimeField',
        zxJDBC.NUMERIC: 'SmallIntegerField',
        zxJDBC.INTEGER: 'IntegerField',
        zxJDBC.DECIMAL: 'DecimalField',
        zxJDBC.NUMBER: 'DecimalField'
    }

    def get_table_list(self, cursor):
        "Returns a list of table names in the current database."
        cursor.execute("SELECT TABLE_NAME FROM USER_TABLES")
        return [row[0].upper() for row in cursor.fetchall()]

    def get_table_description(self, cursor, table_name):
        "Returns a description of the table, with the DB-API cursor.description interface."
        cursor.execute("SELECT * FROM %s WHERE ROWNUM < 2" % self.connection.ops.quote_name(table_name))
        return cursor.description

    def table_name_converter(self, name):
        "Table name comparison is case insensitive under Oracle"
        return name.upper()
        
    def _name_to_index(self, cursor, table_name):
        """
        Returns a dictionary of {field_name: field_index} for the given table.
        Indexes are 0-based.
        """
        return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name))])
{'fraction_non_alphanumeric': 0.11083924639099584, 'fraction_numerical': 0.002446782481037436, 'mean_word_length': 3.3815648445873525, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3214805', 'n_tokens_mistral': 1301, 'n_tokens_neox': 1241, 'n_words': 345}