| 62 | |
| 63 | |
| 64 | class NUMBER(sqltypes.Numeric, sqltypes.Integer): |
| 65 | __visit_name__ = "NUMBER" |
| 66 | |
| 67 | def __init__(self, precision=None, scale=None, asdecimal=None): |
| 68 | if asdecimal is None: |
| 69 | asdecimal = bool(scale and scale > 0) |
| 70 | |
| 71 | super().__init__(precision=precision, scale=scale, asdecimal=asdecimal) |
| 72 | |
| 73 | def adapt(self, impltype): |
| 74 | ret = super().adapt(impltype) |
| 75 | # leave a hint for the DBAPI handler |
| 76 | ret._is_oracle_number = True |
| 77 | return ret |
| 78 | |
| 79 | @property |
| 80 | def _type_affinity(self): |
| 81 | if bool(self.scale and self.scale > 0): |
| 82 | return sqltypes.Numeric |
| 83 | else: |
| 84 | return sqltypes.Integer |
| 85 | |
| 86 | |
| 87 | class FLOAT(sqltypes.FLOAT): |
no outgoing calls