fn execute_schema(&mut self, table_name: &str) -> anyhow::Result<()> {
        let mut stmt = self
            .conn
            .prepare("SELECT sql FROM sqlite_schema WHERE type = 'table' AND name = ?")?;
        let mut query = stmt.query([table_name])?;
        let row = if let Some(row) = query.next()? {
            row
        } else {
            anyhow::bail!("table {} does not exist", table_name);
        };

        let value_ref = row.get_ref(0)?;
        let sql = if let ValueRef::Text(text) = value_ref {
            std::str::from_utf8(text)?
        } else {
            anyhow::bail!("sqlite_schema table does not contain `text` for some reason?");
        };

        let highlighter = &self.rl.helper().unwrap().highlighter;
        let formatted = sqlformat::format(sql, &Default::default(), Default::default());

        let mut output = self.output_target.start();
        let highlighted = if output.supports_color() {
            highlighter.highlight(&formatted)?
        } else {
            formatted
        };
        writeln!(&mut output, "{}", highlighted)?;

        Ok(())
    }
/// Execute a .schema command.
Execute a .schema command.
Execute a . schema command .
fn execute_schema(&mut self, table_name: &str) -> anyhow::Result<()> {
        let mut stmt = self
            .conn
            .prepare("SELECT sql FROM sqlite_schema WHERE type = 'table' AND name = ?")?;
        let mut query = stmt.query([table_name])?;
        let row = if let Some(row) = query.next()? {
            row
        } else {
            anyhow::bail!("table {} does not exist", table_name);
        };
        let value_ref = row.get_ref(0)?;
        let sql = if let ValueRef::Text(text) = value_ref {
            std::str::from_utf8(text)?
        } else {
            anyhow::bail!("sqlite_schema table does not contain `text` for some reason?");
        };
        let highlighter = &self.rl.helper().unwrap().highlighter;
        let formatted = sqlformat::format(sql, &Default::default(), Default::default());
        let mut output = self.output_target.start();
        let highlighted = if output.supports_color() {
            highlighter.highlight(&formatted)?
        } else {
            formatted
        };
        writeln!(&mut output, "{}", highlighted)?;
        Ok(())
    }
fn execute_schema ( & mut self , table_name : & str ) -> anyhow :: Result < ( ) > { let mut stmt = self . conn . prepare ( " " ) ? ; let mut query = stmt . query ( [ table_name ] ) ? ; let row = if let Some ( row ) = query . next ( ) ? { row } else { anyhow :: bail ! ( " " table_name ) ; } ; let value_ref = row . get_ref ( 0 ) ? ; let sql = if let ValueRef :: Text ( text ) = value_ref { std :: str :: from_utf8 ( text ) ? } else { anyhow :: bail ! ( " " ) ; } ; let highlighter = & self . rl . helper ( ) . unwrap ( ) . highlighter ; let formatted = sqlformat :: format ( sql , & Default :: default ( ) , Default :: default ( ) ) ; let mut output = self . output_target . start ( ) ; let highlighted = if output . supports_color ( ) { highlighter . highlight ( & formatted ) ? } else { formatted } ; writeln ! ( mut output " " highlighted ) ? ; Ok ( ( ) ) }
Execute a .schema command.
Execute a . schema command .
&mut self
table_name
&str
&mut self
table_name
&str