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)
class IntrospectMSSQLIntegerDomain(IntrospectMSSQLDomain): call(('sys', 'tinyint'), ('sys', 'smallint'), ('sys', 'int'), ('sys', 'bigint')) def __call__(self): return IntegerDomain(size=self.length * 8)
class IntrospectPGSQLIntegerDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'int2'), ('pg_catalog', 'int4'), ('pg_catalog', 'int8')) def __call__(self): return IntegerDomain(size=8 * self.length)
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()
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__()
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)
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()
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)
class IntrospectPGSQLOIDDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'oid')) def __call__(self): return IntegerDomain()
class IntrospectMySQLCharDomain(IntrospectMySQLDomain): call('char') def __call__(self): return TextDomain(length=self.length, is_varying=False)
class IntrospectMSSQLFloatDomain(IntrospectMSSQLDomain): call(('sys', 'real'), ('sys', 'float')) def __call__(self): return FloatDomain(size=self.length * 8)
class IntrospectMSSQLVarCharDomain(IntrospectMSSQLDomain): call(('sys', 'varchar'), ('sys', 'nvarchar')) def __call__(self): return TextDomain(length=self.length, is_varying=False)
class IntrospectPGSQLTimeDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'time'), ('pg_catalog', 'timetz')) def __call__(self): return TimeDomain()
class IntrospectPGSQLINetDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'inet')) def __call__(self): return INetDomain()
class IntrospectMySQLDateTimeDomain(IntrospectMySQLDomain): call('datetime', 'timestamp') def __call__(self): return DateTimeDomain()
class IntrospectMySQLTimeDomain(IntrospectMySQLDomain): call('time') def __call__(self): return TimeDomain()
class IntrospectMySQLDateDomain(IntrospectMySQLDomain): call('date') def __call__(self): return DateDomain()
class IntrospectMySQLFloatDomain(IntrospectMySQLDomain): call('float', 'double') def __call__(self): return FloatDomain()
class IntrospectMySQLDecimalDomain(IntrospectMySQLDomain): call('decimal') def __call__(self): return DecimalDomain(precision=self.precision, scale=self.scale)
class IntrospectPGSQLTextDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'text')) def __call__(self): return TextDomain()
class IntrospectPGSQLDateDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'date')) def __call__(self): return DateDomain()
class SummonSPSS(SummonFormat): call('spss') format = SPSSFormat
class IntrospectPGSQLDateTimeDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'timestamp'), ('pg_catalog', 'timestamptz')) def __call__(self): return DateTimeDomain()
class AcceptSPSS(Accept): call(SPSS_MIME_TYPE) format = SPSSFormat
class IntrospectMSSQLBitDomain(IntrospectMSSQLDomain): call(('sys', 'bit')) def __call__(self): return BooleanDomain()
class IntrospectPGSQLBooleanDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'bool')) def __call__(self): return BooleanDomain()
class IntrospectMSSQLDecimalDomain(IntrospectMSSQLDomain): call(('sys', 'decimal'), ('sys', 'numeric')) def __call__(self): return DecimalDomain(precision=self.precision, scale=self.scale)
class IntrospectPGSQLFloatDomain(IntrospectPGSQLDomain): call(('pg_catalog', 'float4'), ('pg_catalog', 'float8')) def __call__(self): return FloatDomain(size=8*self.length)
class IntrospectMSSQLDateTimeDomain(IntrospectMSSQLDomain): call(('sys', 'datetime'), ('sys', 'smalldatetime')) def __call__(self): return DateTimeDomain()
class IntrospectMySQLVarCharDomain(IntrospectMySQLDomain): call('varchar', 'tinytext', 'text', 'mediumtext', 'longtext') def __call__(self): return TextDomain(length=self.length, is_varying=True)