C# 클래스 Upscaledb.Database

A Database class
상속: IDisposable
파일 보기 프로젝트 열기: cruppstahl/upscaledb 1 사용 예제들

공개 메소드들

메소드 설명
AddCursor ( Cursor c ) : void

Adds a Cursor to the Cursor list

Close ( ) : void

Closes the Database

This method wraps the native ups_db_close function.
Before closing the Database, the cache is flushed to Disk.

Database ( ) : System

Default Constructor

Dispose ( ) : void

Closes the Database

Erase ( Transaction txn, byte key ) : void

Erases a Database Item

This method wraps the native ups_db_erase function.
This function erases a Database item. If the item with the specified key does not exist in the Database, error code UpsConst.UPS_KEY_NOT_FOUND is thrown.
Note that this method can not erase a single duplicate key. If the key has multiple duplicates, all duplicates of this key will be erased. Use Cursor.Erase to erase a specific duplicate key.

Erase ( byte key ) : void

Erases a Database Item

Find ( Transaction txn, byte key ) : byte[]

Searches an item in the Database, returns the record

Find ( Transaction txn, byte &key, int flags ) : byte[]

Searches an item in the Database, returns the record

This method wraps the native ups_db_find function.

This function searches the Database for a key. If the key is found, the method will return the record of this item.
Database.Find can not search for duplicate keys. If the key has multiple duplicates, only the first duplicate is returned.

Find ( byte key ) : byte[]

Searches an item in the Database, returns the record

GetCount ( ) : System.Int64

Returns the number of keys in this Database

GetCount ( Transaction txn, int flags ) : System.Int64

Returns the number of keys in this Database

This method wraps the native ups_db_count function.
You can specify UPS_SKIP_DUPLICATES if you do now want to include any duplicates in the count.

GetCount ( int flags ) : System.Int64

Returns the number of keys in this Database

GetLastError ( ) : int

Returns the last error code

This method wraps the native ups_db_get_error function.

GetVersion ( ) : Version

Returns the upscaledb.dll version

Insert ( Transaction txn, byte key, byte record ) : void

Inserts a Database item

This is an overloaded function for Database.Insert(txn, key, record, 0).

Insert ( Transaction txn, byte key, byte record, int flags ) : void

Inserts a Database Item

This method wraps the native ups_db_insert function.
This function inserts a key/record pair as a new Database item.
If the key already exists in the Database, error code UpsConst.UPS_DUPLICATE_KEY is thrown.
If you wish to overwrite an existing entry specify the flag UpsConst.UPS_OVERWRITE
If you wish to insert a duplicate key specify the flag UpsConst.UPS_DUPLICATE. (Note that the Database has to be created with the flag UpsConst.UPS_ENABLE_DUPLICATE_KEYS in order to use duplicate keys.) The duplicate key is inserted after all other duplicate keys (see UpsConst.UPS_DUPLICATE_INSERT_LAST).

Insert ( byte key, byte record ) : void

Inserts a Database item

This is an overloaded function for Database.Insert(null, key, record, 0).

Insert ( byte key, byte record, int flags ) : void

Inserts a Database item

This is an overloaded function for Database.Insert(null, key, record, flags).

InsertRecNo ( Transaction txn, byte record, int flags ) : byte[]

Inserts a Database Item into a Record Number Database

This method wraps the native ups_db_insert function.
This function inserts a record as a new Database item.

InsertRecNo ( byte record ) : byte[]

Inserts a Database Item into a Record Number Database

This is an overloaded function for Database.InsertRecNo(null, record, 0).

InsertRecNo ( byte record, int flags ) : byte[]

Inserts a Database Item into a Record Number Database

This is an overloaded function for Database.InsertRecNo(null, record, flags).

RegisterCompare ( String name, CompareFunc foo ) : void

Registers a global compare function.

This method wraps the native ups_register_compare function.

RemoveCursor ( Cursor c ) : void

Removes a Cursor from the Cursor list

SetCompareFunc ( CompareFunc foo ) : void

Sets the comparison function

This method wraps the native ups_db_set_compare_func function.

The CompareFunc delegate compares two index keys. It returns -1 if the first key is smaller, +1 if the second key is smaller or 0 if both keys are equal.

If foo is null, upscaledb will use the default compare function (which is based on memcmp(3)).

SetErrorHandler ( ErrorHandler eh ) : void

Sets the global error handler

This method wraps the native ups_set_error_handler function.

This handler will receive all debug messages that are emitted by upscaledb. You can install the default handler by setting eh to null.

보호된 메소드들

메소드 설명
Dispose ( bool all ) : void

Closes the Database

비공개 메소드들

메소드 설명
AppendNullParameter ( Parameter parameters ) : Upscaledb.Parameter[]
Database ( IntPtr handle ) : System

메소드 상세

AddCursor() 공개 메소드

Adds a Cursor to the Cursor list
public AddCursor ( Cursor c ) : void
c Cursor
리턴 void

Close() 공개 메소드

Closes the Database
This method wraps the native ups_db_close function.
Before closing the Database, the cache is flushed to Disk.
public Close ( ) : void
리턴 void

Database() 공개 메소드

Default Constructor
public Database ( ) : System
리턴 System

Dispose() 공개 메소드

Closes the Database
public Dispose ( ) : void
리턴 void

Dispose() 보호된 메소드

Closes the Database
protected Dispose ( bool all ) : void
all bool
리턴 void

Erase() 공개 메소드

Erases a Database Item
This method wraps the native ups_db_erase function.
This function erases a Database item. If the item with the specified key does not exist in the Database, error code UpsConst.UPS_KEY_NOT_FOUND is thrown.
Note that this method can not erase a single duplicate key. If the key has multiple duplicates, all duplicates of this key will be erased. Use Cursor.Erase to erase a specific duplicate key.
/// /// /// if the key was not found /// /// if you tried to insert a key in a read-only Database /// ///
public Erase ( Transaction txn, byte key ) : void
txn Transaction The optional Transaction
key byte The key of the item to delete
리턴 void

Erase() 공개 메소드

Erases a Database Item
public Erase ( byte key ) : void
key byte
리턴 void

Find() 공개 메소드

Searches an item in the Database, returns the record
public Find ( Transaction txn, byte key ) : byte[]
txn Transaction
key byte
리턴 byte[]

Find() 공개 메소드

Searches an item in the Database, returns the record
This method wraps the native ups_db_find function.

This function searches the Database for a key. If the key is found, the method will return the record of this item.
Database.Find can not search for duplicate keys. If the key has multiple duplicates, only the first duplicate is returned.
/// /// /// if the item was not found /// ///
public Find ( Transaction txn, byte &key, int flags ) : byte[]
txn Transaction The optional Transaction
key byte The key of the item
flags int The flags of the operation
리턴 byte[]

Find() 공개 메소드

Searches an item in the Database, returns the record
public Find ( byte key ) : byte[]
key byte
리턴 byte[]

GetCount() 공개 메소드

Returns the number of keys in this Database
public GetCount ( ) : System.Int64
리턴 System.Int64

GetCount() 공개 메소드

Returns the number of keys in this Database
This method wraps the native ups_db_count function.
You can specify UPS_SKIP_DUPLICATES if you do now want to include any duplicates in the count.
public GetCount ( Transaction txn, int flags ) : System.Int64
txn Transaction
flags int
리턴 System.Int64

GetCount() 공개 메소드

Returns the number of keys in this Database
public GetCount ( int flags ) : System.Int64
flags int
리턴 System.Int64

GetLastError() 공개 메소드

Returns the last error code
This method wraps the native ups_db_get_error function.
public GetLastError ( ) : int
리턴 int

GetVersion() 공개 정적인 메소드

Returns the upscaledb.dll version
public static GetVersion ( ) : Version
리턴 Version

Insert() 공개 메소드

Inserts a Database item
This is an overloaded function for Database.Insert(txn, key, record, 0).
public Insert ( Transaction txn, byte key, byte record ) : void
txn Transaction
key byte
record byte
리턴 void

Insert() 공개 메소드

Inserts a Database Item
This method wraps the native ups_db_insert function.
This function inserts a key/record pair as a new Database item.
If the key already exists in the Database, error code UpsConst.UPS_DUPLICATE_KEY is thrown.
If you wish to overwrite an existing entry specify the flag UpsConst.UPS_OVERWRITE
If you wish to insert a duplicate key specify the flag UpsConst.UPS_DUPLICATE. (Note that the Database has to be created with the flag UpsConst.UPS_ENABLE_DUPLICATE_KEYS in order to use duplicate keys.) The duplicate key is inserted after all other duplicate keys (see UpsConst.UPS_DUPLICATE_INSERT_LAST).
/// /// /// if the flags UpsConst.UPS_DUPLICATE AND /// UpsConst.UPS_OVERWRITE were specified, or if /// UpsConst.UPS_DUPLICATE was specified but the Database /// was not created with UpsConst.UPS_ENABLE_DUPLICATE_KEYS /// /// if you tried to insert a key in a read-only Database /// /// if key size is different than than the key size parameter /// specified for Database.Create. /// ///
public Insert ( Transaction txn, byte key, byte record, int flags ) : void
txn Transaction An optional Transaction object
key byte The key of the new item
record byte The record of the new item
flags int Optional flags for this operation. Possible /// flags are: /// /// /// If the key already exists, the record is overwritten. /// Otherwise, the key is inserted. /// /// If the key already exists, a duplicate key is inserted. /// The key is inserted before the already existing duplicates. /// ///
리턴 void

Insert() 공개 메소드

Inserts a Database item
This is an overloaded function for Database.Insert(null, key, record, 0).
public Insert ( byte key, byte record ) : void
key byte
record byte
리턴 void

Insert() 공개 메소드

Inserts a Database item
This is an overloaded function for Database.Insert(null, key, record, flags).
public Insert ( byte key, byte record, int flags ) : void
key byte
record byte
flags int
리턴 void

InsertRecNo() 공개 메소드

Inserts a Database Item into a Record Number Database
This method wraps the native ups_db_insert function.
This function inserts a record as a new Database item.
/// /// /// if you tried to insert a key in a read-only Database /// ///
public InsertRecNo ( Transaction txn, byte record, int flags ) : byte[]
txn Transaction An optional Transaction object
record byte The record of the new item
flags int Optional flags for this operation.
리턴 byte[]

InsertRecNo() 공개 메소드

Inserts a Database Item into a Record Number Database
This is an overloaded function for Database.InsertRecNo(null, record, 0).
public InsertRecNo ( byte record ) : byte[]
record byte
리턴 byte[]

InsertRecNo() 공개 메소드

Inserts a Database Item into a Record Number Database
This is an overloaded function for Database.InsertRecNo(null, record, flags).
public InsertRecNo ( byte record, int flags ) : byte[]
record byte
flags int
리턴 byte[]

RegisterCompare() 공개 정적인 메소드

Registers a global compare function.
This method wraps the native ups_register_compare function.
public static RegisterCompare ( String name, CompareFunc foo ) : void
name String Descriptive name of the compare function
foo CompareFunc Delegate object
리턴 void

RemoveCursor() 공개 메소드

Removes a Cursor from the Cursor list
public RemoveCursor ( Cursor c ) : void
c Cursor
리턴 void

SetCompareFunc() 공개 메소드

Sets the comparison function
This method wraps the native ups_db_set_compare_func function.

The CompareFunc delegate compares two index keys. It returns -1 if the first key is smaller, +1 if the second key is smaller or 0 if both keys are equal.

If foo is null, upscaledb will use the default compare function (which is based on memcmp(3)).
public SetCompareFunc ( CompareFunc foo ) : void
foo CompareFunc The compare delegate, or null
리턴 void

SetErrorHandler() 공개 정적인 메소드

Sets the global error handler
This method wraps the native ups_set_error_handler function.

This handler will receive all debug messages that are emitted by upscaledb. You can install the default handler by setting eh to null.
public static SetErrorHandler ( ErrorHandler eh ) : void
eh ErrorHandler The delegate which is called whenever an /// error message is emitted; set to null to set the default /// error handler
리턴 void