// Generates a prebuilt insert statement for a given predicate, and stores
// it in the cache so we don't have to rebuild it every time.
// TODO: Is it possible for these to be stored prepared statements somehow?
// TODO: There might be an issue here with types with multifield width?
Generates a prebuilt insert statement for a given predicate, and stores
it in the cache so we don't have to rebuild it every time.
TODO: Is it possible for these to be stored prepared statements somehow.
Generates a prebuilt insert statement for a given predicate and stores it in the cache so we don ' t have to rebuild it every time . TODO : Is it possible for these to be stored prepared statements somehow .
fn gen_insert_stmt(&self, pred: &Predicate) {
        let args: Vec<String> = pred.fields
            .iter()
            .enumerate()
            .map(|(k, _)| format!("${}", k + 1))
            .collect();
        let stmt = format!(
            "insert into facts.{} values (DEFAULT, {}) ON \
                            CONFLICT DO NOTHING RETURNING id",
            pred.name,
            args.join(", ")
        );
        self.insert_by_name.borrow_mut().insert(
            pred.name.clone(),
            stmt,
        );
    }
fn gen_insert_stmt ( & self , pred : & Predicate ) { let args : Vec < String > = pred . fields . iter ( ) . enumerate ( ) . map ( | ( k , _ ) | format ! ( " " k 1 ) ) . collect ( ) ; let stmt = format ! ( " \
 " pred name args join ( " " ) ) ; self . insert_by_name . borrow_mut ( ) . insert ( pred . name . clone ( ) , stmt , ) ; }
Generates a prebuilt insert statement for a given predicate, and stores
it in the cache so we don't have to rebuild it every time.
Generates a prebuilt insert statement for a given predicate and stores it in the cache so we don ' t have to rebuild it every time .
&self
pred
&Predicate