pub struct BuiltQuery {
pub sql: String,
pub params: Vec<Value>,
}Expand description
参数化查询构造结果
包含带 ? 占位符的 SQL 字符串与按序绑定的参数列表。
§安全性(P0 修复:SQL 注入防护)
通过参数化绑定,将用户输入与 SQL 结构分离,从根源上杜绝 SQL 注入。
调用方应使用 build_with_params() 而非字符串拼接的 where_clause(),
尤其是当 WHERE 条件值来自不可信输入时。
Fields§
§sql: String含 ? 占位符的 SQL 语句
params: Vec<Value>按出现顺序绑定的参数列表
Implementations§
Source§impl BuiltQuery
impl BuiltQuery
Sourcepub fn into_parts(self) -> (String, Vec<Value>)
pub fn into_parts(self) -> (String, Vec<Value>)
取出 SQL 与参数两部分
Trait Implementations§
Source§impl Clone for BuiltQuery
impl Clone for BuiltQuery
Source§fn clone(&self) -> BuiltQuery
fn clone(&self) -> BuiltQuery
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BuiltQuery
impl Debug for BuiltQuery
Source§impl Default for BuiltQuery
impl Default for BuiltQuery
Source§fn default() -> BuiltQuery
fn default() -> BuiltQuery
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for BuiltQuery
impl RefUnwindSafe for BuiltQuery
impl Send for BuiltQuery
impl Sync for BuiltQuery
impl Unpin for BuiltQuery
impl UnsafeUnpin for BuiltQuery
impl UnwindSafe for BuiltQuery
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more