(
compiler,
stmt,
compile_state,
parameters,
_getattr_col_key,
_column_as_key,
_col_bind_name,
check_columns,
values,
toplevel,
kw,
)
| 641 | |
| 642 | |
| 643 | def _scan_cols( |
| 644 | compiler, |
| 645 | stmt, |
| 646 | compile_state, |
| 647 | parameters, |
| 648 | _getattr_col_key, |
| 649 | _column_as_key, |
| 650 | _col_bind_name, |
| 651 | check_columns, |
| 652 | values, |
| 653 | toplevel, |
| 654 | kw, |
| 655 | ): |
| 656 | ( |
| 657 | need_pks, |
| 658 | implicit_returning, |
| 659 | implicit_return_defaults, |
| 660 | postfetch_lastrowid, |
| 661 | use_insertmanyvalues, |
| 662 | use_sentinel_columns, |
| 663 | ) = _get_returning_modifiers(compiler, stmt, compile_state, toplevel) |
| 664 | |
| 665 | assert compile_state.isupdate or compile_state.isinsert |
| 666 | |
| 667 | if compile_state._parameter_ordering: |
| 668 | parameter_ordering = [ |
| 669 | _column_as_key(key) for key in compile_state._parameter_ordering |
| 670 | ] |
| 671 | ordered_keys = set(parameter_ordering) |
| 672 | cols = [ |
| 673 | stmt.table.c[key] |
| 674 | for key in parameter_ordering |
| 675 | if isinstance(key, str) and key in stmt.table.c |
| 676 | ] + [c for c in stmt.table.c if c.key not in ordered_keys] |
| 677 | |
| 678 | else: |
| 679 | cols = stmt.table.columns |
| 680 | |
| 681 | isinsert = _compile_state_isinsert(compile_state) |
| 682 | if isinsert and not compile_state._has_multi_parameters: |
| 683 | # new rules for #7998. fetch lastrowid or implicit returning |
| 684 | # for autoincrement column even if parameter is NULL, for DBs that |
| 685 | # override NULL param for primary key (sqlite, mysql/mariadb) |
| 686 | autoincrement_col = stmt.table._autoincrement_column |
| 687 | insert_null_pk_still_autoincrements = ( |
| 688 | compiler.dialect.insert_null_pk_still_autoincrements |
| 689 | ) |
| 690 | else: |
| 691 | autoincrement_col = insert_null_pk_still_autoincrements = None |
| 692 | |
| 693 | if stmt._supplemental_returning: |
| 694 | supplemental_returning = set(stmt._supplemental_returning) |
| 695 | else: |
| 696 | supplemental_returning = set() |
| 697 | |
| 698 | compiler_implicit_returning = compiler.implicit_returning |
| 699 | |
| 700 | # TODO - see TODO(return_defaults_columns) below |
no test coverage detected