(self, compiler, connection)
| 335 | ) |
| 336 | |
| 337 | def process_rhs(self, compiler, connection): |
| 338 | if not self.rhs_is_direct_value(): |
| 339 | return super(TupleLookupMixin, self).process_rhs(compiler, connection) |
| 340 | |
| 341 | rhs = self.rhs |
| 342 | if not rhs: |
| 343 | raise EmptyResultSet |
| 344 | |
| 345 | # e.g.: (a, b, c) in [(x1, y1, z1), (x2, y2, z2)] as SQL: |
| 346 | # WHERE (a, b, c) IN ((x1, y1, z1), (x2, y2, z2)) |
| 347 | result = [] |
| 348 | lhs = self.lhs |
| 349 | |
| 350 | for vals in rhs: |
| 351 | # Remove any tuple containing None from the list as NULL is never |
| 352 | # equal to anything. |
| 353 | if any(val is None for val in vals): |
| 354 | continue |
| 355 | result.append( |
| 356 | Tuple( |
| 357 | *[ |
| 358 | ( |
| 359 | val |
| 360 | if hasattr(val, "as_sql") |
| 361 | else Value(val, output_field=col.output_field) |
| 362 | ) |
| 363 | for col, val in zip(lhs, vals) |
| 364 | ] |
| 365 | ) |
| 366 | ) |
| 367 | |
| 368 | if not result: |
| 369 | raise EmptyResultSet |
| 370 | |
| 371 | return compiler.compile(Tuple(*result)) |
| 372 | |
| 373 | def get_fallback_sql(self, compiler, connection): |
| 374 | rhs = self.rhs |
no test coverage detected