pub fn from_lines<I, S>(lines: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: AsRef<str>,
    {
        let mut queries = vec![];
        let mut current_line = String::new();

        lines.into_iter().for_each(|line| {
            let line = line.as_ref().trim();
            if line.starts_with("--") {
                return;
            }
            if line.is_empty() {
                return;
            }

            // declare queries when we see a semicolon at the end of the line
            if !current_line.is_empty() {
                current_line.push(' ');
            }
            current_line.push_str(line);

            if line.ends_with(';') {
                // resets current_line to String::new()
                let t = std::mem::take(&mut current_line);
                queries.push(t);
            }
        });

        if !current_line.is_empty() {
            queries.push(current_line);
        }

        Self { queries }
    }
/// find all queries (more or less a fancy split on `;`
find all queries (more or less a fancy split on `;`
find all queries ( more or less a fancy split on ` ; `
pub fn from_lines<I, S>(lines: I) -> Self
    where
        I: IntoIterator<Item = S>,
        S: AsRef<str>,
    {
        let mut queries = vec![];
        let mut current_line = String::new();
        lines.into_iter().for_each(|line| {
            let line = line.as_ref().trim();
            if line.starts_with("--") {
                return;
            }
            if line.is_empty() {
                return;
            }
            // declare queries when we see a semicolon at the end of the line
            if !current_line.is_empty() {
                current_line.push(' ');
            }
            current_line.push_str(line);
            if line.ends_with(';') {
                // resets current_line to String::new()
                let t = std::mem::take(&mut current_line);
                queries.push(t);
            }
        });
        if !current_line.is_empty() {
            queries.push(current_line);
        }
        Self { queries }
    }
pub fn from_lines < I , S > ( lines : I ) -> Self where I : IntoIterator < Item = S > , S : AsRef < str > , { let mut queries = vec ! [ ] ; let mut current_line = String :: new ( ) ; lines . into_iter ( ) . for_each ( | line | { let line = line . as_ref ( ) . trim ( ) ; if line . starts_with ( " " ) { return ; } if line . is_empty ( ) { return ; } // declare queries when we see a semicolon at the end of the line if ! current_line . is_empty ( ) { current_line . push ( ' ' ) ; } current_line . push_str ( line ) ; if line . ends_with ( ';' ) { // resets current_line to String::new() let t = std :: mem :: take ( & mut current_line ) ; queries . push ( t ) ; } } ) ; if ! current_line . is_empty ( ) { queries . push ( current_line ) ; } Self { queries } }
find all queries (more or less a fancy split on `;`
find all queries ( more or less a fancy split on ` ; `
lines
I
lines
I