Beispiel #1
0
class IntrospectPGSQLVarCharDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'varchar'))

    def __call__(self):
        length = self.modifier-4 if self.modifier != -1 else None
        return TextDomain(length=length, is_varying=True)
Beispiel #2
0
class IntrospectMSSQLIntegerDomain(IntrospectMSSQLDomain):

    call(('sys', 'tinyint'), ('sys', 'smallint'), ('sys', 'int'),
         ('sys', 'bigint'))

    def __call__(self):
        return IntegerDomain(size=self.length * 8)
Beispiel #3
0
class IntrospectPGSQLIntegerDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'int2'), ('pg_catalog', 'int4'),
         ('pg_catalog', 'int8'))

    def __call__(self):
        return IntegerDomain(size=8 * self.length)
Beispiel #4
0
class IntrospectMySQLIntegerDomain(IntrospectMySQLDomain):

    call('tinyint', 'smallint', 'mediumint', 'int', 'bigint')

    def __call__(self):
        if self.data_type == 'tinyint' and self.column_type == 'tinyint(1)':
            return BooleanDomain()
        return IntegerDomain()
Beispiel #5
0
class IntrospectMySQLEnumDomain(IntrospectMySQLDomain):

    call('enum')

    def __call__(self):
        column_type = self.column_type
        if column_type.startswith('enum(') and column_type.endswith(')'):
            labels = [item[1:-1] for item in column_type[5:-1].split(',')]
            return EnumDomain(labels=labels)
        return super(IntrospectMySQLEnumDomain, self).__call__()
Beispiel #6
0
class IntrospectPGSQLDecimalDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'numeric'))

    def __call__(self):
        precision = None
        scale = None
        if self.modifier != -1:
            precision = ((self.modifier-4) >> 0x10) & 0xFFFF
            scale = (self.modifier-4) & 0xFFFF
        return DecimalDomain(precision=precision, scale=scale)
Beispiel #7
0
class IntrospectSQLiteDateTimeDomain(IntrospectSQLiteDomain):

    call('date', 'time')

    def __call__(self):
        key = self.name.lower()
        if 'datetime' in key or 'timestamp' in key:
            return DateTimeDomain()
        if 'date' in key:
            return DateDomain()
        if 'time' in key:
            return TimeDomain()
Beispiel #8
0
class IntrospectOracleNumberDomain(IntrospectOracleDomain):

    call('NUMBER')

    boolean_pattern = r"""
        ^ [\w"]+ \s+ IN \s+ \( (?: 0 \s* , \s* 1 | 1 \s* , \s* 0 ) \) $
    """
    boolean_regexp = re.compile(boolean_pattern, re.X | re.I)

    def __call__(self):
        if (self.precision, self.scale) == (1, 0):
            if (self.check is not None
                    and self.boolean_regexp.match(self.check)):
                return BooleanDomain()
        if (self.precision, self.scale) == (38, 0):
            return IntegerDomain()
        return DecimalDomain(precision=self.precision, scale=self.scale)
Beispiel #9
0
class IntrospectPGSQLOIDDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'oid'))

    def __call__(self):
        return IntegerDomain()
Beispiel #10
0
class IntrospectMySQLCharDomain(IntrospectMySQLDomain):

    call('char')

    def __call__(self):
        return TextDomain(length=self.length, is_varying=False)
Beispiel #11
0
class IntrospectMSSQLFloatDomain(IntrospectMSSQLDomain):

    call(('sys', 'real'), ('sys', 'float'))

    def __call__(self):
        return FloatDomain(size=self.length * 8)
Beispiel #12
0
class IntrospectMSSQLVarCharDomain(IntrospectMSSQLDomain):

    call(('sys', 'varchar'), ('sys', 'nvarchar'))

    def __call__(self):
        return TextDomain(length=self.length, is_varying=False)
Beispiel #13
0
class IntrospectPGSQLTimeDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'time'), ('pg_catalog', 'timetz'))

    def __call__(self):
        return TimeDomain()
Beispiel #14
0
class IntrospectPGSQLINetDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'inet'))

    def __call__(self):
        return INetDomain()
Beispiel #15
0
class IntrospectMySQLDateTimeDomain(IntrospectMySQLDomain):

    call('datetime', 'timestamp')

    def __call__(self):
        return DateTimeDomain()
Beispiel #16
0
class IntrospectMySQLTimeDomain(IntrospectMySQLDomain):

    call('time')

    def __call__(self):
        return TimeDomain()
Beispiel #17
0
class IntrospectMySQLDateDomain(IntrospectMySQLDomain):

    call('date')

    def __call__(self):
        return DateDomain()
Beispiel #18
0
class IntrospectMySQLFloatDomain(IntrospectMySQLDomain):

    call('float', 'double')

    def __call__(self):
        return FloatDomain()
Beispiel #19
0
class IntrospectMySQLDecimalDomain(IntrospectMySQLDomain):

    call('decimal')

    def __call__(self):
        return DecimalDomain(precision=self.precision, scale=self.scale)
Beispiel #20
0
class IntrospectPGSQLTextDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'text'))

    def __call__(self):
        return TextDomain()
Beispiel #21
0
class IntrospectPGSQLDateDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'date'))

    def __call__(self):
        return DateDomain()
class SummonSPSS(SummonFormat):
    call('spss')
    format = SPSSFormat
Beispiel #23
0
class IntrospectPGSQLDateTimeDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'timestamp'), ('pg_catalog', 'timestamptz'))

    def __call__(self):
        return DateTimeDomain()
class AcceptSPSS(Accept):
    call(SPSS_MIME_TYPE)
    format = SPSSFormat
Beispiel #25
0
class IntrospectMSSQLBitDomain(IntrospectMSSQLDomain):

    call(('sys', 'bit'))

    def __call__(self):
        return BooleanDomain()
Beispiel #26
0
class IntrospectPGSQLBooleanDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'bool'))

    def __call__(self):
        return BooleanDomain()
Beispiel #27
0
class IntrospectMSSQLDecimalDomain(IntrospectMSSQLDomain):

    call(('sys', 'decimal'), ('sys', 'numeric'))

    def __call__(self):
        return DecimalDomain(precision=self.precision, scale=self.scale)
Beispiel #28
0
class IntrospectPGSQLFloatDomain(IntrospectPGSQLDomain):

    call(('pg_catalog', 'float4'), ('pg_catalog', 'float8'))

    def __call__(self):
        return FloatDomain(size=8*self.length)
Beispiel #29
0
class IntrospectMSSQLDateTimeDomain(IntrospectMSSQLDomain):

    call(('sys', 'datetime'), ('sys', 'smalldatetime'))

    def __call__(self):
        return DateTimeDomain()
Beispiel #30
0
class IntrospectMySQLVarCharDomain(IntrospectMySQLDomain):

    call('varchar', 'tinytext', 'text', 'mediumtext', 'longtext')

    def __call__(self):
        return TextDomain(length=self.length, is_varying=True)