Debian Codegraph @

src/protocol/statement/execute.rs

raw symbols SCIP
1 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::iorust-analyzer cargo sqlx-mysql 0.8.3 io/::ProtocolEncoderust-analyzer cargo sqlx-core 0.8.3 io/encode/ProtocolEncode#;
2 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::textrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/::ColumnFlagsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnFlags#;
3 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::protocolrust-analyzer cargo sqlx-mysql 0.8.3 protocol/::Capabilitiesrust-analyzer cargo sqlx-mysql 0.8.3 protocol/capabilities/Capabilities#;
4 use craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::MySqlArgumentsrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#;
5
6 // https://dev.mysql.com/doc/dev/mysql-server/8.0.12/page_protocol_com_stmt_execute.html
7
8 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
9 pub struct Executerust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#<'q> {
10 pub statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#statement.: u32,
11 pub argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments.: &'q MySqlArgumentsrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#,
12 }
13
14 impl<'q> ProtocolEncoderust-analyzer cargo sqlx-core 0.8.3 io/encode/ProtocolEncode#<'_, Capabilitiesrust-analyzer cargo sqlx-mysql 0.8.3 protocol/capabilities/Capabilities#> for Executerust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#<'q> {
15 fn encode_withrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/impl#[`Execute<'q>`][`ProtocolEncode<'_, Capabilities>`]encode_with().(&self, buf: &mut Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>, _: Capabilitiesrust-analyzer cargo sqlx-mysql 0.8.3 protocol/capabilities/Capabilities#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), craterust-analyzer cargo sqlx-mysql 0.8.3 crate/::Errorrust-analyzer cargo sqlx-core 0.8.3 error/Error#> {
16 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(0x17); // COM_STMT_EXECUTE
17 buf.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(&self.statementrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#statement..to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().());
18 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(0); // NO_CURSOR
19 buf.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(&1_u32.to_le_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]to_le_bytes().()); // iterations (always 1): int<4>
20
21 if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().self.argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments..typesrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#types..is_emptyrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]is_empty().() {
22 buf.extend_from_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]extend_from_slice().(&self.argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments..null_bitmaprust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#null_bitmap.);
23 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(1); // send type to server
24
25 for ty in &self.argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments..typesrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#types. {
26 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(ty.r#typerust-analyzer cargo sqlx-mysql 0.8.3 type_info/MySqlTypeInfo#`r#type`. as u8);
27
28 buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(if ty.flagsrust-analyzer cargo sqlx-mysql 0.8.3 type_info/MySqlTypeInfo#flags..containsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/impl#[ColumnFlags]contains().(ColumnFlagsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/ColumnFlags#::UNSIGNEDrust-analyzer cargo sqlx-mysql 0.8.3 protocol/text/column/impl#[ColumnFlags]UNSIGNED.) {
29 0x80
30 } else {
31 0
32 });
33 }
34
35 buf.extendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Extend<&'a T>`]extend().(&*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][Deref]deref().self.argumentsrust-analyzer cargo sqlx-mysql 0.8.3 protocol/statement/execute/Execute#arguments..valuesrust-analyzer cargo sqlx-mysql 0.8.3 arguments/MySqlArguments#values.);
36 }
37
38 Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(())
39 }
40 }