/
germanubis
/
sqlx
ΠΠ±Π·ΠΎΡ
ΠΠΎΠΊΡΠΌΠ΅Π½ΡΠ°ΡΠΈΡ
ΠΠΎΠΉΡΠΈ
/
germanubis
/
sqlx
ΠΠΎΠ΄
ΠΠ°ΠΏΡΠΎΡΡ
0
ΠΠ°Π΄Π°ΡΠΈ
ΠΠΈΠΊΠΈ
ΠΠ°ΠΊΠ΅ΡΡ
0
Π Π΅Π»ΠΈΠ·Ρ
0
ΠΠ½Π°Π»ΠΈΡΠΈΠΊΠ°
ΠΠ΅Π·ΠΎΠΏΠ°ΡΠ½ΠΎΡΡΡ
v0.7.1
sqlx-postgres/src/message/execute.rs
39 ΡΡΡΠΎΠΊ
929 B
Austin Bonander
Break drivers out into separate crates, clean up some technical debt (#2039)
22 ΡΠ΅Π² 2023, 00:25
22 ΡΠ΅Π² 2023, 00:25
b5312c3
ΠΠΎΠ΄
ΠΠ²ΡΠΎΡΡΡΠ²ΠΎ
Π ΡΡΠΌ ΠΊΠΎΠ΄?
use crate::io::Encode; use crate::io::PgBufMutExt; use crate::types::Oid; pub struct Execute { /// The id of the portal to execute (`None` selects the unnamed portal). pub portal: Option<Oid>, /// Maximum number of rows to return, if portal contains a query /// that returns rows (ignored otherwise). Zero denotes βno limitβ. pub limit: u32, } impl Encode<'_> for Execute { fn encode_with(&self, buf: &mut Vec<u8>, _: ()) { buf.reserve(20); buf.push(b'E'); buf.put_length_prefixed(|buf| { buf.put_portal_name(self.portal); buf.extend(&self.limit.to_be_bytes()); }); } } #[test] fn test_encode_execute() { const EXPECTED: &[u8] = b"E\0\0\0\x11sqlx_p_5\0\0\0\0\x02"; let mut buf = Vec::new(); let m = Execute { portal: Some(Oid(5)), limit: 2, }; m.encode(&mut buf); assert_eq!(buf, EXPECTED); }