<commit_before>from .._compat import basestring
from ..adapters.mssql import MSSQL, MSSQLN, MSSQL3, MSSQL4, MSSQL3N, MSSQL4N, \
    Vertica, Sybase
from ..helpers.methods import varquote_aux
from ..objects import Expression
from .base import SQLDialect
from . import dialects, sqltype_for


@dialects.register_for(MSSQL)
class MSSQLDialect(SQLDialect):
    true = 1
    false = 0
    true_exp = '1=1'
    false_exp = '1=0'
    dt_sep = "T"

    @sqltype_for('boolean')
    def type_boolean(self):
        return 'BIT'

    @sqltype_for('blob')
    def type_blob(self):
        return 'IMAGE'

    @sqltype_for('integer')
    def type_integer(self):
        return 'INT'

    @sqltype_for('bigint')
    def type_bigint(self):
        return 'BIGINT'

    @sqltype_for('double')
    def type_double(self):
        return 'FLOAT'

    @sqltype_for('date')
    def type_date(self):
        return 'DATE'

    @sqltype_for('time')
    def type_time(self):
        return 'CHAR(8)'

    @sqltype_for('datetime')
    def type_datetime(self):
        return 'DATETIME'

    @sqltype_for('id')
    def type_id(self):
        return 'INT IDENTITY PRIMARY KEY'

    @sqltype_for('reference')
    def type_reference(self):
        return 'INT%(null)s%(unique)s, CONSTRAINT %(constraint_name)s ' + \
            'FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON ' + \
            'DELETE %(on_delete_action)s'

    @sqltype_for('big-id')
    def type_big_id(self):
        return 'BIGINT IDENTITY PRIMARY KEY'

    @sqltype_for('big-reference')
    def type_big_reference(self):
        return 'BIGINT%(null)s%(unique)s, CONSTRAINT %(constraint_name)s' + \
            ' FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ' + \
            'ON DELETE %(on_delete_action)s'

    @sqltype_for('reference FK')
    def type_reference_fk(self):
        return ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY ' + \
            '(%(field_name)s) REFERENCES %(foreign_key)s ON DELETE ' + \
            '%(on_delete_action)s'

    @sqltype_for('reference TFK')
    def type_reference_tfk(self):
        return ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY ' + \
            '(%(field_name)s) REFERENCES %(foreign_table)s ' + \
            '(%(foreign_key)s) ON DELETE %(on_delete_action)s',

    @sqltype_for('geometry')
    def type_geometry(self):
        return 'geometry'

    @sqltype_for('geography')
    def type_geography(self):
        return 'geography'

    def varquote(self, val):
        return varquote_aux(val, '[%s]')

    def update(self, table, values, where=None):
        tablename = self.writing_alias(table)<commit_msg>Fix type error in MSSQL TFK reference template<commit_after>from .._compat import basestring
from ..adapters.mssql import MSSQL, MSSQLN, MSSQL3, MSSQL4, MSSQL3N, MSSQL4N, \
    Vertica, Sybase
from ..helpers.methods import varquote_aux
from ..objects import Expression
from .base import SQLDialect
from . import dialects, sqltype_for


@dialects.register_for(MSSQL)
class MSSQLDialect(SQLDialect):
    true = 1
    false = 0
    true_exp = '1=1'
    false_exp = '1=0'
    dt_sep = "T"

    @sqltype_for('boolean')
    def type_boolean(self):
        return 'BIT'

    @sqltype_for('blob')
    def type_blob(self):
        return 'IMAGE'

    @sqltype_for('integer')
    def type_integer(self):
        return 'INT'

    @sqltype_for('bigint')
    def type_bigint(self):
        return 'BIGINT'

    @sqltype_for('double')
    def type_double(self):
        return 'FLOAT'

    @sqltype_for('date')
    def type_date(self):
        return 'DATE'

    @sqltype_for('time')
    def type_time(self):
        return 'CHAR(8)'

    @sqltype_for('datetime')
    def type_datetime(self):
        return 'DATETIME'

    @sqltype_for('id')
    def type_id(self):
        return 'INT IDENTITY PRIMARY KEY'

    @sqltype_for('reference')
    def type_reference(self):
        return 'INT%(null)s%(unique)s, CONSTRAINT %(constraint_name)s ' + \
            'FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ON ' + \
            'DELETE %(on_delete_action)s'

    @sqltype_for('big-id')
    def type_big_id(self):
        return 'BIGINT IDENTITY PRIMARY KEY'

    @sqltype_for('big-reference')
    def type_big_reference(self):
        return 'BIGINT%(null)s%(unique)s, CONSTRAINT %(constraint_name)s' + \
            ' FOREIGN KEY (%(field_name)s) REFERENCES %(foreign_key)s ' + \
            'ON DELETE %(on_delete_action)s'

    @sqltype_for('reference FK')
    def type_reference_fk(self):
        return ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY ' + \
            '(%(field_name)s) REFERENCES %(foreign_key)s ON DELETE ' + \
            '%(on_delete_action)s'

    @sqltype_for('reference TFK')
    def type_reference_tfk(self):
        return ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY ' + \
            '(%(field_name)s) REFERENCES %(foreign_table)s ' + \
            '(%(foreign_key)s) ON DELETE %(on_delete_action)s'

    @sqltype_for('geometry')
    def type_geometry(self):
        return 'geometry'

    @sqltype_for('geography')
    def type_geography(self):
        return 'geography'

    def varquote(self, val):
        return varquote_aux(val, '[%s]')

    def update(self, table, values, where=None):
        tablename = self.writing_alias(table)
{'fraction_non_alphanumeric': 0.12787193973634653, 'fraction_numerical': 0.004143126177024482, 'mean_word_length': 2.9872372372372373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6683312', 'n_tokens_mistral': 1945, 'n_tokens_neox': 1834, 'n_words': 374}