pub fn execute_batch(&self, sql: &str) -> Result<()> {
        let mut sql = sql;
        while !sql.is_empty() {
            let stmt = self.prepare(sql)?;
            if !stmt.stmt.is_null() && stmt.step()? && cfg!(feature = "extra_check") {
                // Some PRAGMA may return rows
                return Err(Error::ExecuteReturnedResults);
            }
            let tail = stmt.stmt.tail();
            if tail == 0 || tail >= sql.len() {
                break;
            }
            sql = &sql[tail..];
        }
        Ok(())
    }
/// Convenience method to run multiple SQL statements (that cannot take any
/// parameters).
///
/// ## Example
///
/// ```rust,no_run
/// # use rusqlite::{Connection, Result};
/// fn create_tables(conn: &Connection) -> Result<()> {
///     conn.execute_batch(
///         "BEGIN;
///          CREATE TABLE foo(x INTEGER);
///          CREATE TABLE bar(y TEXT);
///          COMMIT;",
///     )
/// }
/// ```
///
/// # Failure
///
/// Will return `Err` if `sql` cannot be converted to a C-compatible string
/// or if the underlying SQLite call fails.
Convenience method to run multiple SQL statements (that cannot take any
parameters).
Convenience method to run multiple SQL statements ( that cannot take any parameters ) .
pub fn execute_batch(&self, sql: &str) -> Result<()> {
        let mut sql = sql;
        while !sql.is_empty() {
            let stmt = self.prepare(sql)?;
            if !stmt.stmt.is_null() && stmt.step()? && cfg!(feature = "extra_check") {
                // Some PRAGMA may return rows
                return Err(Error::ExecuteReturnedResults);
            }
            let tail = stmt.stmt.tail();
            if tail == 0 || tail >= sql.len() {
                break;
            }
            sql = &sql[tail..];
        }
        Ok(())
    }
pub fn execute_batch ( & self , sql : & str ) -> Result < ( ) > { let mut sql = sql ; while ! sql . is_empty ( ) { let stmt = self . prepare ( sql ) ? ; if ! stmt . stmt . is_null ( ) && stmt . step ( ) ? && cfg ! ( feature " " ) { // Some PRAGMA may return rows return Err ( Error :: ExecuteReturnedResults ) ; } let tail = stmt . stmt . tail ( ) ; if tail == 0 || tail >= sql . len ( ) { break ; } sql = & sql [ tail .. ] ; } Ok ( ( ) ) }
Convenience method to run multiple SQL statements (that cannot take any
parameters).
Convenience method to run multiple SQL statements ( that cannot take any parameters ) .
&self
sql
&str
example
None
use rusqlite::{connection, result};
None
failure
Will return `Err` if `sql` cannot be converted to a C-compatible string
or if the underlying SQLite call fails.
Will return ` Err ` if ` sql ` cannot be converted to a C - compatible string or if the underlying SQLite call fails .