node *insert(T key) { node *x = root, *y = nil; while(x != nil) { y = x; if(key != x->key) x = x->ch[key > x->key]; else return x; } sz++; node *z = new node(key); z->par = y; if(y == nil) root = z; else y->ch[z->key >= y->key] = z; z->ch[0] = z->ch[1] = nil; insert_update(z); nil->par = nil->ch[0] = nil->ch[1] = nil; return z; }
/*! \brief * Insert a row into table, update on duplicate key */ int db_cluster_insert_update(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v, const int _n) { LM_DBG("executing db cluster insert-update command\n"); DBCL_WRITE(insert_update(dbh, _k, _v, _n)); }
/// Insert or update an entry into the map. bool insert_update(const K& k, const V& v) { value_t value(k, v); return insert_update(value); }