| 1169 | return f"{self.__class__.__name__}({self.value!r})" |
| 1170 | |
| 1171 | def as_sql(self, compiler, connection): |
| 1172 | connection.ops.check_expression_support(self) |
| 1173 | val = self.value |
| 1174 | output_field = self._output_field_or_none |
| 1175 | if output_field is not None: |
| 1176 | if self.for_save: |
| 1177 | val = output_field.get_db_prep_save(val, connection=connection) |
| 1178 | else: |
| 1179 | val = output_field.get_db_prep_value(val, connection=connection) |
| 1180 | try: |
| 1181 | get_placeholder_sql = output_field.get_placeholder_sql |
| 1182 | except AttributeError: |
| 1183 | pass |
| 1184 | else: |
| 1185 | return get_placeholder_sql(val, compiler, connection) |
| 1186 | if val is None: |
| 1187 | # oracledb does not always convert None to the appropriate |
| 1188 | # NULL type (like in case expressions using numbers), so we |
| 1189 | # use a literal SQL NULL |
| 1190 | return "NULL", () |
| 1191 | return "%s", (val,) |
| 1192 | |
| 1193 | def as_sqlite(self, compiler, connection, **extra_context): |
| 1194 | sql, params = self.as_sql(compiler, connection, **extra_context) |