Logo Search packages:      
Sourcecode: qdbm version File versions  Download package

void Villa::put ( const char *  kbuf,
int  ksiz,
const char *  vbuf,
int  vsiz,
int  dmode = Villa::DOVER 
) throw (Villa_error) [virtual]

Store a record.

Parameters:
kbuf the pointer to the region of a key.
ksiz the size of the region of the key. If it is negative, the size is assigned with `stdstrlen(kbuf)'.
vbuf the pointer to the region of a value.
vsiz the size of the region of the value. If it is negative, the size is assigned with `stdstrlen(vbuf)'.
dmode behavior when the key overlaps, by the following values: `VillaDOVER', which means the specified value overwrites the existing one, `VillaDKEEP', which means the existing value is kept, `VillaDDUP', which means duplication of keys is allowed.
Exceptions:
Villa_error if an error occurs or replace is cancelled.
Note:
A duplicated record is stored at the tail of the records of the same key. The cursor becomes unavailable due to updating database.

Definition at line 221 of file xvilla.cc.

References qdbm::mutex, and villa.

                    {
  if(!villa) throw Villa_error();
  if(pthread_mutex_lock(&mutex) != 0) throw Villa_error();
  if(!vlput(villa, kbuf, ksiz, vbuf, vsiz, dmode)){
    pthread_mutex_unlock(&mutex);
    throw Villa_error(dpecode);
  }
  pthread_mutex_unlock(&mutex);
}


Generated by  Doxygen 1.6.0   Back to index