C# 클래스 Upscaledb.Environment

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

공개 메소드들

메소드 설명
Begin ( ) : Transaction

Begins a new Transaction

Begin ( int flags ) : Transaction

Begins a new Transaction

This method wraps the native ups_txn_begin function.

Close ( ) : void

Closes the Environment

This method wraps the native ups_env_close function.

Create ( String fileName, int flags ) : void

Creates a new Environment

This is an overloaded function for Create(fileName, flags, 0, null).

Create ( String fileName, int flags, int mode ) : void

Creates a new Environment

This is an overloaded function for Create(fileName, flags, mode, null).

Create ( String fileName, int flags, int mode, Parameter parameters ) : void

Creates a new Database

This method wraps the native ups_env_create function.
A Database Environment is a collection of Databases, which are all stored in one physical file (or in-memory). Per default, up to 16 Databases can be stored in one file ( on how to store even more Databases).
Each Database is identified by a positive 16bit value (except 0 and values at or above 0xf000). Databases in an Environment can be created with Environment.CreateDatabase(short) or opened with Environment.OpenDatabase(short).

Create ( string fileName ) : void

Creates a new Environment

This is an overloaded function for Create(fileName, 0, 0, null).

CreateDatabase ( short name ) : Database

Creates a new Database in this Environment

This is an overloaded function for CreateDatabase(name, 0, null).

CreateDatabase ( short name, int flags ) : Database

Creates a new Database in this Environment

This is an overloaded function for CreateDatabase(name, flags, null).

CreateDatabase ( short name, int flags, Parameter parameters ) : Database

Creates a new Database in this Environment

This method wraps the native ups_env_create_db function.

Dispose ( ) : void

Closes the Environment

Environment ( ) : System

Default Constructor

Environment ( IntPtr ptr ) : System

Default Constructor which sets the handle

This constructor is used by Database.GetEnvironment()

EraseDatabase ( short name ) : void

Deletes a Database from this Environment

This method wraps the native ups_env_erase_db function.

Flush ( ) : void

Flushes the Environment

This method wraps the native ups_env_flush function.
This function flushes the Database cache and writes the whole file to disk.
Since In-Memory Environments do not have a file on disk, the function will have no effect and will return successfully.

GetDatabaseNames ( ) : short[]

Returns the names of all Databases in this Environment

This method wraps the native ups_env_get_database_names function.
This function returns the names of all Databases and the number of Databases in an Environment.

GetHandle ( ) : IntPtr

Returns the Environment handle

Open ( String fileName, int flags ) : void

Opens an existing Environment

This is an overloaded function for Open(fileName, flags, null).

Open ( String fileName, int flags, Parameter parameters ) : void

Opens an existing Environment

This method wraps the native ups_env_open function.

Open ( string fileName ) : void

Opens an existing Environment

This is an overloaded function for Open(fileName, 0, null).

OpenDatabase ( short name ) : Database

Opens a Database in this Environment

This is an overloaded function for OpenDatabase(name, 0).

OpenDatabase ( short name, int flags ) : Database

Opens a Database in this Environment

This is an overloaded function for OpenDatabase(name, flags, null).

OpenDatabase ( short name, int flags, Parameter parameters ) : Database

Opens a Database in this Environment

This method wraps the native ups_env_open_db function.

RenameDatabase ( short oldName, short newName ) : void

Renames a Database in this Environment

This method wraps the native ups_env_rename_db function.

SelectRange ( String query, Cursor begin, Cursor end ) : Result

보호된 메소드들

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

Closes the Environment

비공개 메소드들

메소드 설명
AppendNullParameter ( Parameter parameters ) : Upscaledb.Parameter[]

메소드 상세

Begin() 공개 메소드

Begins a new Transaction
public Begin ( ) : Transaction
리턴 Transaction

Begin() 공개 메소드

Begins a new Transaction
This method wraps the native ups_txn_begin function.
public Begin ( int flags ) : Transaction
flags int
리턴 Transaction

Close() 공개 메소드

Closes the Environment
This method wraps the native ups_env_close function.
public Close ( ) : void
리턴 void

Create() 공개 메소드

Creates a new Environment
This is an overloaded function for Create(fileName, flags, 0, null).
public Create ( String fileName, int flags ) : void
fileName String
flags int
리턴 void

Create() 공개 메소드

Creates a new Environment
This is an overloaded function for Create(fileName, flags, mode, null).
public Create ( String fileName, int flags, int mode ) : void
fileName String
flags int
mode int
리턴 void

Create() 공개 메소드

Creates a new Database
This method wraps the native ups_env_create function.
A Database Environment is a collection of Databases, which are all stored in one physical file (or in-memory). Per default, up to 16 Databases can be stored in one file ( on how to store even more Databases).
Each Database is identified by a positive 16bit value (except 0 and values at or above 0xf000). Databases in an Environment can be created with Environment.CreateDatabase(short) or opened with Environment.OpenDatabase(short).
/// /// /// if an invalid combination of flags was specified /// /// if the value for UPS_PARAM_MAX_DATABASES is too /// high (either decrease it or increase the page size) /// /// if the file could not be opened or reading/writing failed /// /// if memory could not be allocated /// /// if the page size is not a multiple of 1024 /// /// if the key size is too large (at least 4 keys must /// fit in a page) /// /// if another process has locked the file /// ///
public Create ( String fileName, int flags, int mode, Parameter parameters ) : void
fileName String The file name of the Environment file. If /// the file already exists, it is overwritten. Can be null if you /// create an In-Memory Environment.
flags int Optional flags for this operation, combined /// with bitwise OR. Possible flags are: /// /// /// Immediately write modified pages to the disk. This /// slows down all Database operations, but may save the /// Database integrity in case of a system crash.
/// /// Creates an In-Memory Environment. No file will be created, /// and the Databases are lost after the Environment /// is closed. The parameter can /// be null. Do NOT use in combination with /// a cache size other than 0.
/// /// Do not use memory mapped files for I/O. By default, /// upscaledb checks if it can use mmap, since mmap is faster /// than read/write. For performance reasons, this flag should /// not be used.
/// /// Enables Transactions for this Database.
///
///
mode int File access rights for the new file. This is /// the mode parameter for creat(2). Ignored on /// Microsoft Windows.
parameters Parameter An array of /// structures. The following parameters are available:
/// /// /// The size of the Database cache, in bytes. The default size /// is defined in src/config.h as UPS_DEFAULT_CACHESIZE /// - usually 2 MB.
/// /// The size of a file page, in bytes. It is recommended not /// to change the default size. The default size depends on /// hardware and operating system. Page sizes must be 1024 or a /// multiple of 2048.
/// /// The number of maximum Databases in this Environment; /// default: 16. ///
///
리턴 void

Create() 공개 메소드

Creates a new Environment
This is an overloaded function for Create(fileName, 0, 0, null).
public Create ( string fileName ) : void
fileName string
리턴 void

CreateDatabase() 공개 메소드

Creates a new Database in this Environment
This is an overloaded function for CreateDatabase(name, 0, null).
public CreateDatabase ( short name ) : Database
name short
리턴 Database

CreateDatabase() 공개 메소드

Creates a new Database in this Environment
This is an overloaded function for CreateDatabase(name, flags, null).
public CreateDatabase ( short name, int flags ) : Database
name short
flags int
리턴 Database

CreateDatabase() 공개 메소드

Creates a new Database in this Environment
This method wraps the native ups_env_create_db function.
/// /// /// if an invalid combination of flags was specified /// /// if a Database with this name already exists in this /// Environment /// /// if memory could not be allocated /// /// if the key size is too large (at least 4 keys must /// fit in a page) /// /// if the maximum number of Databases per Environment /// was already created /// ///
public CreateDatabase ( short name, int flags, Parameter parameters ) : Database
name short The name of the Database. If a Database /// with this name already exists, /// is thrown. /// Database names from 0xf000 to 0xffff and 0 are reserved.
flags int Optional flags for creating the Database, /// combined with bitwise OR. Possible values are: /// /// /// Creates an "auto-increment" Database. Keys in Record /// Number Databases are automatically assigned an incrementing /// 64bit value. /// ///
parameters Parameter An array of /// structures. The following parameters are available:
/// /// /// The size of the keys in the B+Tree index. The default size /// is 21 bytes.
///
///
리턴 Database

Dispose() 공개 메소드

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

Dispose() 보호된 메소드

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

Environment() 공개 메소드

Default Constructor
public Environment ( ) : System
리턴 System

Environment() 공개 메소드

Default Constructor which sets the handle
This constructor is used by Database.GetEnvironment()
public Environment ( IntPtr ptr ) : System
ptr System.IntPtr
리턴 System

EraseDatabase() 공개 메소드

Deletes a Database from this Environment
This method wraps the native ups_env_erase_db function.
/// /// /// if a Database with this name does not exist /// /// if the Database with the new name is still open /// ///
public EraseDatabase ( short name ) : void
name short The name of the Database which is deleted. /// If a Database with this name does not exist, the function will throw /// .
리턴 void

Flush() 공개 메소드

Flushes the Environment
This method wraps the native ups_env_flush function.
This function flushes the Database cache and writes the whole file to disk.
Since In-Memory Environments do not have a file on disk, the function will have no effect and will return successfully.
public Flush ( ) : void
리턴 void

GetDatabaseNames() 공개 메소드

Returns the names of all Databases in this Environment
This method wraps the native ups_env_get_database_names function.
This function returns the names of all Databases and the number of Databases in an Environment.
public GetDatabaseNames ( ) : short[]
리턴 short[]

GetHandle() 공개 메소드

Returns the Environment handle
public GetHandle ( ) : IntPtr
리턴 System.IntPtr

Open() 공개 메소드

Opens an existing Environment
This is an overloaded function for Open(fileName, flags, null).
public Open ( String fileName, int flags ) : void
fileName String
flags int
리턴 void

Open() 공개 메소드

Opens an existing Environment
This method wraps the native ups_env_open function.
/// /// /// if an invalid combination of flags was specified /// /// if the file does not exist /// /// if the file could not be opened or reading/writing failed /// /// if the Database version is not compatible with the library /// version /// /// if memory could not be allocated /// /// if another process has locked the file /// ///
public Open ( String fileName, int flags, Parameter parameters ) : void
fileName String The file name of the Environment file.
flags int Optional flags for this operation, combined /// with bitwise OR. Possible flags are: /// /// /// Opens the file for reading only. Operations which need /// write access (i.e. Database.Insert) /// will return . ///
/// /// Immediately write modified pages to the disk. This /// slows down all Database operations, but may save the /// Database integrity in case of a system crash.
/// /// Do not use memory mapped files for I/O. By default, /// upscaledb checks if it can use mmap, since mmap is faster /// than read/write. For performance reasons, this flag should /// not be used.
/// /// Automatically recover the Database, if necessary. This /// flag imples . ///
/// /// Enables Transactions for this Database.
///
///
parameters Parameter An array of /// structures. The following parameters are available:
/// /// /// The size of the Database cache, in bytes. The default size /// is defined in src/config.h as UPS_DEFAULT_CACHESIZE /// - usually 2 MB.
///
///
리턴 void

Open() 공개 메소드

Opens an existing Environment
This is an overloaded function for Open(fileName, 0, null).
public Open ( string fileName ) : void
fileName string
리턴 void

OpenDatabase() 공개 메소드

Opens a Database in this Environment
This is an overloaded function for OpenDatabase(name, 0).
public OpenDatabase ( short name ) : Database
name short
리턴 Database

OpenDatabase() 공개 메소드

Opens a Database in this Environment
This is an overloaded function for OpenDatabase(name, flags, null).
public OpenDatabase ( short name, int flags ) : Database
name short
flags int
리턴 Database

OpenDatabase() 공개 메소드

Opens a Database in this Environment
This method wraps the native ups_env_open_db function.
/// /// /// if an invalid combination of flags was specified /// /// if a Database with this name does not exist /// /// if this Database was already opened /// /// if memory could not be allocated /// /// if another process has locked the file /// ///
public OpenDatabase ( short name, int flags, Parameter parameters ) : Database
name short The name of the Database. If a Database /// with this name does not exist, the function will throw /// .
flags int Optional flags for this operation, combined /// with bitwise OR. Possible flags are: /// /// /// Opens the database for reading. /// ///
parameters Parameter An array of /// structures. The following parameters are available:
/// /// ///
리턴 Database

RenameDatabase() 공개 메소드

Renames a Database in this Environment
This method wraps the native ups_env_rename_db function.
/// /// /// if the new Database name is reserved /// /// if a Database with this name does not exist /// /// if a Database with the new name already exists /// /// if memory could not be allocated /// ///
public RenameDatabase ( short oldName, short newName ) : void
oldName short The old name of the Database. If a Database /// with this name does not exist, the function will throw /// .
newName short The new name of the Database. If a Database /// with this name already exists, the function will throw /// .
리턴 void

SelectRange() 공개 메소드

public SelectRange ( String query, Cursor begin, Cursor end ) : Result
query String
begin Cursor
end Cursor
리턴 Result