MCPcopy Index your code
hub / github.com/RustPython/RustPython / bind_parameters_sequence

Method bind_parameters_sequence

crates/stdlib/src/_sqlite3.rs:3164–3187  ·  view source on GitHub ↗
(
            self,
            seq: PySequence<'_>,
            vm: &VirtualMachine,
        )

Source from the content-addressed store, hash-verified

3162 }
3163
3164 fn bind_parameters_sequence(
3165 self,
3166 seq: PySequence<'_>,
3167 vm: &VirtualMachine,
3168 ) -> PyResult<()> {
3169 let num_needed = self.bind_parameter_count();
3170 let num_supplied = seq.length(vm)?;
3171
3172 if num_supplied != num_needed as usize {
3173 return Err(new_programming_error(
3174 vm,
3175 format!(
3176 "Incorrect number of bindings supplied. The current statement uses {}, and {} were supplied.",
3177 num_needed, num_supplied
3178 ),
3179 ));
3180 }
3181
3182 for i in 1..=num_needed {
3183 let val = seq.get_item(i as isize - 1, vm)?;
3184 self.bind_parameter(i, &val, vm)?;
3185 }
3186 Ok(())
3187 }
3188
3189 fn column_count(self) -> c_int {
3190 unsafe { sqlite3_column_count(self.st) }

Callers 1

bind_parametersMethod · 0.80

Calls 5

bind_parameter_countMethod · 0.80
bind_parameterMethod · 0.80
ErrClass · 0.50
lengthMethod · 0.45
get_itemMethod · 0.45

Tested by

no test coverage detected