示例#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)
示例#2
0
class IntrospectMSSQLIntegerDomain(IntrospectMSSQLDomain):

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

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

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

    def __call__(self):
        return IntegerDomain(size=8 * self.length)
示例#4
0
文件: introspect.py 项目: sirex/htsql
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()
示例#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__()
示例#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)
示例#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()
示例#8
0
文件: introspect.py 项目: sirex/htsql
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)
示例#9
0
class IntrospectPGSQLOIDDomain(IntrospectPGSQLDomain):

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

    def __call__(self):
        return IntegerDomain()
示例#10
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLCharDomain(IntrospectMySQLDomain):

    call('char')

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

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

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

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

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

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

    def __call__(self):
        return TimeDomain()
示例#14
0
文件: introspect.py 项目: sirex/htsql
class IntrospectPGSQLINetDomain(IntrospectPGSQLDomain):

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

    def __call__(self):
        return INetDomain()
示例#15
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLDateTimeDomain(IntrospectMySQLDomain):

    call('datetime', 'timestamp')

    def __call__(self):
        return DateTimeDomain()
示例#16
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLTimeDomain(IntrospectMySQLDomain):

    call('time')

    def __call__(self):
        return TimeDomain()
示例#17
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLDateDomain(IntrospectMySQLDomain):

    call('date')

    def __call__(self):
        return DateDomain()
示例#18
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLFloatDomain(IntrospectMySQLDomain):

    call('float', 'double')

    def __call__(self):
        return FloatDomain()
示例#19
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLDecimalDomain(IntrospectMySQLDomain):

    call('decimal')

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    def __call__(self):
        return DateTimeDomain()
示例#30
0
文件: introspect.py 项目: sirex/htsql
class IntrospectMySQLVarCharDomain(IntrospectMySQLDomain):

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

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