Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
/*! \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));
}
Ejemplo n.º 3
0
  /// 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);
  }