(
compiler,
stmt,
compile_state,
c,
col_key,
parameters,
_col_bind_name,
implicit_returning,
implicit_return_defaults,
postfetch_lastrowid,
values,
autoincrement_col,
insert_null_pk_still_autoincrements,
kw,
)
| 867 | |
| 868 | |
| 869 | def _append_param_parameter( |
| 870 | compiler, |
| 871 | stmt, |
| 872 | compile_state, |
| 873 | c, |
| 874 | col_key, |
| 875 | parameters, |
| 876 | _col_bind_name, |
| 877 | implicit_returning, |
| 878 | implicit_return_defaults, |
| 879 | postfetch_lastrowid, |
| 880 | values, |
| 881 | autoincrement_col, |
| 882 | insert_null_pk_still_autoincrements, |
| 883 | kw, |
| 884 | ): |
| 885 | value = parameters.pop(col_key) |
| 886 | |
| 887 | has_visiting_cte = kw.get("visiting_cte") is not None |
| 888 | col_value = compiler.preparer.format_column( |
| 889 | c, use_table=compile_state.include_table_with_column_exprs |
| 890 | ) |
| 891 | |
| 892 | accumulated_bind_names: Set[str] = set() |
| 893 | |
| 894 | if coercions._is_literal(value): |
| 895 | if ( |
| 896 | insert_null_pk_still_autoincrements |
| 897 | and c.primary_key |
| 898 | and c is autoincrement_col |
| 899 | ): |
| 900 | # support use case for #7998, fetch autoincrement cols |
| 901 | # even if value was given. |
| 902 | |
| 903 | if postfetch_lastrowid: |
| 904 | compiler.postfetch_lastrowid = True |
| 905 | elif implicit_returning: |
| 906 | compiler.implicit_returning.append(c) |
| 907 | |
| 908 | value = _create_bind_param( |
| 909 | compiler, |
| 910 | c, |
| 911 | value, |
| 912 | required=value is REQUIRED, |
| 913 | name=( |
| 914 | _col_bind_name(c) |
| 915 | if not _compile_state_isinsert(compile_state) |
| 916 | or not compile_state._has_multi_parameters |
| 917 | else "%s_m0" % _col_bind_name(c) |
| 918 | ), |
| 919 | accumulate_bind_names=accumulated_bind_names, |
| 920 | force_anonymous=has_visiting_cte, |
| 921 | **kw, |
| 922 | ) |
| 923 | elif value._is_bind_parameter: |
| 924 | if ( |
| 925 | insert_null_pk_still_autoincrements |
| 926 | and value.value is None |
no test coverage detected