Quadcap Embeddable Database

com.quadcap.sql.index.BIndex Interface Reference

Inheritance diagram for com.quadcap.sql.index.BIndex:

com.quadcap.sql.index.Btree List of all members.

Detailed Description

An index is simply a map, with byte arrays as keys.

Author:
Stan Bailes

Definition at line 49 of file BIndex.java.

Public Member Functions

Comparator getComparator ()
 Return this index's comparator.

void free () throws IOException
 Delete this index.

int get (byte[] key, int len, byte[] data) throws IOException
 Get the data bytes for the specified key.

boolean delete (byte[] key) throws IOException
 Delete the specified key.

void insert (byte[] key, int klen, byte[] data, int off, int len) throws IOException
 Add a new key.

void update (byte[] key, int klen, byte[] data, int off, int len) throws IOException
 Update the data value for an existing key.

boolean set (byte[] key, int klen, byte[] data, int off, int len) throws IOException
 Set the key/data pair, replacing any any value it may present in a unique index, inserting a new values, whatever.

BCursor getCursor (boolean skipSetup) throws IOException
 Obtain a cursor for most wondrously manipulating this index.


Member Function Documentation

boolean com.quadcap.sql.index.BIndex.delete byte[]  key  )  throws IOException
 

Delete the specified key.

Return true if the key was deleted.

Implemented in com.quadcap.sql.index.Btree.

void com.quadcap.sql.index.BIndex.free  )  throws IOException
 

Delete this index.

Implemented in com.quadcap.sql.index.Btree.

int com.quadcap.sql.index.BIndex.get byte[]  key,
int  len,
byte[]  data
throws IOException
 

Get the data bytes for the specified key.

If the key is found, return the length of the data portion and place as many bytes as will fit in the data array. If the key isn't found, return -1.

Implemented in com.quadcap.sql.index.Btree.

Comparator com.quadcap.sql.index.BIndex.getComparator  ) 
 

Return this index's comparator.

Implemented in com.quadcap.sql.index.Btree.

BCursor com.quadcap.sql.index.BIndex.getCursor boolean  skipSetup  )  throws IOException
 

Obtain a cursor for most wondrously manipulating this index.

Implemented in com.quadcap.sql.index.Btree.

void com.quadcap.sql.index.BIndex.insert byte[]  key,
int  klen,
byte[]  data,
int  off,
int  len
throws IOException
 

Add a new key.

If the index is a UNIQUE index, then the new key/data pair will only be added if the key does not already exist, otherwise, insert will do nothing and return false The existing value must not exist or an IOException will be thrown. Otherwise, the new key/data pair is added regardless.

Implemented in com.quadcap.sql.index.Btree.

boolean com.quadcap.sql.index.BIndex.set byte[]  key,
int  klen,
byte[]  data,
int  off,
int  len
throws IOException
 

Set the key/data pair, replacing any any value it may present in a unique index, inserting a new values, whatever.

Return true if the key already existed before this operation.

Implemented in com.quadcap.sql.index.Btree.

void com.quadcap.sql.index.BIndex.update byte[]  key,
int  klen,
byte[]  data,
int  off,
int  len
throws IOException
 

Update the data value for an existing key.

This only works for UNIQUE indexes, and only if the specified key already exists.

Exceptions:
IOException may be thrown.

Implemented in com.quadcap.sql.index.Btree.