pub fn insert_fact(&self, fact: &Fact) -> Result<Option<FactId>> {
        let stmt_str = try!(
            self.insert_by_name
                .borrow()
                .get(&fact.pred_name)
                .ok_or_else(|| {
                    ErrorKind::Internal("Insert Statement Missing".to_string())
                })
        ).clone();
        let conn = self.conn()?;
        let stmt = conn.prepare_cached(&stmt_str)?;


        let out = try!(
            stmt.query(&fact.args
                .iter()
                .flat_map(|x| x.to_sql().into_iter())
                .collect::<Vec<_>>())
        );

        Ok(out.iter().next().map(|x| x.get(0)))
    }
/// Adds a new fact to the database, returning false if the fact was already
/// present in the database, and true if it was inserted.
Adds a new fact to the database, returning false if the fact was already
present in the database, and true if it was inserted.
Adds a new fact to the database returning false if the fact was already present in the database and true if it was inserted .
pub fn insert_fact(&self, fact: &Fact) -> Result<Option<FactId>> {
        let stmt_str = try!(
            self.insert_by_name
                .borrow()
                .get(&fact.pred_name)
                .ok_or_else(|| {
                    ErrorKind::Internal("Insert Statement Missing".to_string())
                })
        ).clone();
        let conn = self.conn()?;
        let stmt = conn.prepare_cached(&stmt_str)?;
        let out = try!(
            stmt.query(&fact.args
                .iter()
                .flat_map(|x| x.to_sql().into_iter())
                .collect::<Vec<_>>())
        );
        Ok(out.iter().next().map(|x| x.get(0)))
    }
pub fn insert_fact ( & self , fact : & Fact ) -> Result < Option < FactId > > { let stmt_str = try ! ( self insert_by_name borrow ( ) get ( fact pred_name ) ok_or_else ( { ErrorKind Internal ( " " to_string ( ) ) } ) ) . clone ( ) ; let conn = self . conn ( ) ? ; let stmt = conn . prepare_cached ( & stmt_str ) ? ; let out = try ! ( stmt query ( fact args iter ( ) flat_map ( x x to_sql ( ) into_iter ( ) ) collect Vec ( ) ) ) ; Ok ( out . iter ( ) . next ( ) . map ( | x | x . get ( 0 ) ) ) }
Adds a new fact to the database, returning false if the fact was already
present in the database, and true if it was inserted.
Adds a new fact to the database returning false if the fact was already present in the database and true if it was inserted .
&self
fact
&Fact
&self
fact
&Fact