(
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,
)
| 930 | |
| 931 | |
| 932 | def _append_param_parameter( |
| 933 | compiler, |
| 934 | stmt, |
| 935 | compile_state, |
| 936 | c, |
| 937 | col_key, |
| 938 | parameters, |
| 939 | _col_bind_name, |
| 940 | implicit_returning, |
| 941 | implicit_return_defaults, |
| 942 | postfetch_lastrowid, |
| 943 | values, |
| 944 | autoincrement_col, |
| 945 | insert_null_pk_still_autoincrements, |
| 946 | kw, |
| 947 | ): |
| 948 | value = parameters.pop(col_key) |
| 949 | |
| 950 | has_visiting_cte = kw.get("visiting_cte") is not None |
| 951 | col_value = compiler.preparer.format_column( |
| 952 | c, use_table=compile_state.include_table_with_column_exprs |
| 953 | ) |
| 954 | |
| 955 | accumulated_bind_names: Set[str] = set() |
| 956 | |
| 957 | if coercions._is_literal(value): |
| 958 | if ( |
| 959 | insert_null_pk_still_autoincrements |
| 960 | and c.primary_key |
| 961 | and c is autoincrement_col |
| 962 | ): |
| 963 | # support use case for #7998, fetch autoincrement cols |
| 964 | # even if value was given. |
| 965 | |
| 966 | if postfetch_lastrowid: |
| 967 | compiler.postfetch_lastrowid = True |
| 968 | elif implicit_returning: |
| 969 | compiler.implicit_returning.append(c) |
| 970 | |
| 971 | value = _create_bind_param( |
| 972 | compiler, |
| 973 | c, |
| 974 | value, |
| 975 | required=value is REQUIRED, |
| 976 | name=( |
| 977 | _col_bind_name(c) |
| 978 | if not _compile_state_isinsert(compile_state) |
| 979 | or not compile_state._has_multi_parameters |
| 980 | else "%s_m0" % _col_bind_name(c) |
| 981 | ), |
| 982 | accumulate_bind_names=accumulated_bind_names, |
| 983 | force_anonymous=has_visiting_cte, |
| 984 | **kw, |
| 985 | ) |
| 986 | elif value._is_bind_parameter: |
| 987 | if ( |
| 988 | insert_null_pk_still_autoincrements |
| 989 | and value.value is None |
no test coverage detected