lib

Core libraries for Radroots
git clone https://radroots.dev/git/lib.git
Log | Files | Refs | README | LICENSE

executor_embedded.rs (873B)


      1 use alloc::string::String;
      2 
      3 use crate::{ExecOutcome, SqlExecutor, error::SqlError};
      4 
      5 #[derive(Clone, Debug)]
      6 pub struct EmbeddedSqlExecutor;
      7 
      8 impl EmbeddedSqlExecutor {
      9     pub fn new() -> Self {
     10         Self
     11     }
     12 }
     13 
     14 impl Default for EmbeddedSqlExecutor {
     15     fn default() -> Self {
     16         Self::new()
     17     }
     18 }
     19 
     20 impl SqlExecutor for EmbeddedSqlExecutor {
     21     fn exec(&self, _sql: &str, _params_json: &str) -> Result<ExecOutcome, SqlError> {
     22         Ok(ExecOutcome {
     23             changes: 0,
     24             last_insert_id: 0,
     25         })
     26     }
     27 
     28     fn query_raw(&self, _sql: &str, _params_json: &str) -> Result<String, SqlError> {
     29         Ok(String::from("[]"))
     30     }
     31 
     32     fn begin(&self) -> Result<(), SqlError> {
     33         Ok(())
     34     }
     35 
     36     fn commit(&self) -> Result<(), SqlError> {
     37         Ok(())
     38     }
     39 
     40     fn rollback(&self) -> Result<(), SqlError> {
     41         Ok(())
     42     }
     43 }