uqa_sql/
sql_batch_error.rs1use crate::SQLError;
8
9#[derive(Debug, thiserror::Error)]
12#[error("{error}")]
13pub struct SQLBatchError {
14 #[source]
15 pub error: SQLError,
16 pub statement_index: Option<usize>,
17}
18
19impl SQLBatchError {
20 pub const fn statement(error: SQLError, statement_index: usize) -> Self {
21 Self {
22 error,
23 statement_index: Some(statement_index),
24 }
25 }
26
27 pub const fn transaction(error: SQLError) -> Self {
28 Self {
29 error,
30 statement_index: None,
31 }
32 }
33
34 pub fn into_error(self) -> SQLError {
35 self.error
36 }
37}