use quaint::prelude::ConnectionInfo;
pub(super) struct Context<'a> {
connection_info: &'a ConnectionInfo,
pub(crate) trace_id: Option<&'a str>,
pub(crate) max_insert_rows: Option<usize>,
pub(crate) max_bind_values: Option<usize>,
}
impl<'a> Context<'a> {
pub(crate) fn new(connection_info: &'a ConnectionInfo, trace_id: Option<&'a str>) -> Self {
let sql_family = connection_info.sql_family();
let max_insert_rows = sql_family.max_insert_rows();
let max_bind_values = sql_family.max_bind_values();
Context {
connection_info,
trace_id,
max_insert_rows,
max_bind_values: Some(max_bind_values),
}
}
pub(crate) fn schema_name(&self) -> &str {
self.connection_info.schema_name()
}
}