Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Common::Core::Ese::Database Class Reference

Manages the handle to an Extensible Storage Engine database, providing an API that exposes the operations that can be performed on the database. More...

#include <HCCEse.h>

Public Member Functions

constexpr Database () noexcept
 Constructs a Database object that is not connected to an Extensible Storage Engine database.
 
 Database (JET_SESID sessionId, JET_DBID databaseId)
 Constructs a Database object that is connected to an Extensible Storage Engine database.
 
 Database (const Database &other)=delete
 Copy construction is not allowed.
 
 Database (Database &&other) noexcept
 Move constructor, taking ownership of the handles from the other database object.
 
 ~Database ()
 
Databaseoperator= (const Database &other)=delete
 Copy assignment is not allowed.
 
Databaseoperator= (Database &&other) noexcept
 Move assignment implemented by swapping handles wit the argument database object.
 
JET_SESID SessionHandle () const
 Returns the handle of the session that was used to open or create the database.
 
JET_DBID Handle () const
 The raw database handle.
 
void OnDatabaseCreated ()
 
void OnDatabaseOpened ()
 
constexpr bool IsValid () const noexcept
 A Database object where the session handle is not equal to JET_sesidNil and the database handle is not equal to JET_dbidNil is considered to be a valid Database object.
 
constexpr operator bool () const noexcept
 A Database object where the session handle is not equal to JET_sesidNil and the database handle is not equal to JET_dbidNil is considered to be a valid Database object.
 
void Close ()
 Closes a database.
 
Result OpenTable (const wchar_t *tablename, const void *parameters, unsigned long parametersSize, OpenTableFlags flags, JET_TABLEID *tableId) const
 Opens a cursor on a previously created table.
 
Result OpenTable (const char *tablename, const void *parameters, unsigned long parametersSize, OpenTableFlags flags, JET_TABLEID *tableId) const
 Opens a cursor on a previously created table.
 
template<TableType T = Table, ApiCharType C>
T OpenTable (const C *tableName, OpenTableFlags flags=OpenTableFlags::Updatable, bool noexception=false) const
 Opens a cursor on a previously created table.
 
template<TableType T = Table, SimpleStringLike S>
T OpenTable (const S &tablename, OpenTableFlags flags=OpenTableFlags::Updatable, bool noexception=false) const
 Opens a cursor on a previously created table.
 
Result CreateTable (const wchar_t *tablename, unsigned long initialNumberOfPages, unsigned long density, JET_TABLEID *tableId) const
 
Result CreateTable (const char *tablename, unsigned long initialNumberOfPages, unsigned long density, JET_TABLEID *tableId) const
 
template<TableType T = Table, ApiCharType C>
T CreateTable (const C *tablename, unsigned long initialNumberOfPages=1, unsigned long density=0) const
 Creates an empty table in the database.
 
template<TableType T = Table, SimpleStringLike S>
T CreateTable (const S &tablename, unsigned long initialNumberOfPages=1, unsigned long density=0) const
 Creates an empty table in the database.
 
template<StringLike StringT = WideString>
Tables< StringT > GetTables () const
 Retrieves an Tables<StringT> that can be used to enumerate the tables in the database.
 
void DeleteTable (const wchar_t *tableName)
 Deletes a table in a database.
 
void DeleteTable (const char *tableName)
 Deletes a table in a database.
 
template<SimpleStringLike T>
void DeleteTable (const T &tableName)
 Deletes a table in a database.
 
ObjectInfo GetTableInfo (const wchar_t *objectName) const
 Retrieves information about a table in the database.
 
ObjectInfo GetTableInfo (const char *objectName) const
 Retrieves information about a table in the database.
 
template<SimpleStringLike S>
ObjectInfo GetTableInfo (const S &objectName) const
 Retrieves information about a table in the database.
 
bool TableExists (const wchar_t *objectName) const
 Test if a table exists in the database.
 
bool TableExists (const char *objectName) const
 Test if a table exists in the database.
 
template<SimpleStringLike S>
bool TableExists (const S &objectName) const
 Test if a table exists in the database.
 

Protected Member Functions

void BeginTransaction () const
 
void CommitTransaction (TransactionFlags flags=TransactionFlags::None) const
 

Private Attributes

JET_SESID sessionId_
 
JET_DBID databaseId_
 

Detailed Description

Manages the handle to an Extensible Storage Engine database, providing an API that exposes the operations that can be performed on the database.

Constructor & Destructor Documentation

◆ Database() [1/4]

Harlinn::Common::Core::Ese::Database::Database ( )
inlineconstexprnoexcept

Constructs a Database object that is not connected to an Extensible Storage Engine database.

◆ Database() [2/4]

Harlinn::Common::Core::Ese::Database::Database ( JET_SESID sessionId,
JET_DBID databaseId )
inline

Constructs a Database object that is connected to an Extensible Storage Engine database.

◆ Database() [3/4]

Harlinn::Common::Core::Ese::Database::Database ( const Database & other)
delete

Copy construction is not allowed.

◆ Database() [4/4]

Harlinn::Common::Core::Ese::Database::Database ( Database && other)
inlinenoexcept

Move constructor, taking ownership of the handles from the other database object.

◆ ~Database()

Harlinn::Common::Core::Ese::Database::~Database ( )
inline

Member Function Documentation

◆ BeginTransaction()

void Harlinn::Common::Core::Ese::Database::BeginTransaction ( ) const
inlineprotected

◆ Close()

void Harlinn::Common::Core::Ese::Database::Close ( )
inline

Closes a database.

◆ CommitTransaction()

void Harlinn::Common::Core::Ese::Database::CommitTransaction ( TransactionFlags flags = TransactionFlags::None) const
inlineprotected

◆ CreateTable() [1/4]

template<TableType T = Table, ApiCharType C>
T Harlinn::Common::Core::Ese::Database::CreateTable ( const C * tablename,
unsigned long initialNumberOfPages = 1,
unsigned long density = 0 ) const
inlinenodiscard

Creates an empty table in the database.

Template Parameters
TTable, or a type move assignable type derived from Table
Parameters
tablenameThe name of the table to create
initialNumberOfPagesThe initial number of database pages to allocate for the table. Specifying a number larger than one can reduce fragmentation if many rows are inserted into this table
densityThe table density, in percentage points. The number must be either 0 or in the range of 20 through 100. Passing 0 means that the default value should be used. The default is 80
Returns
A Table instance, or an instance of a type derived from Table, for the newly created database table.

◆ CreateTable() [2/4]

Result Harlinn::Common::Core::Ese::Database::CreateTable ( const char * tablename,
unsigned long initialNumberOfPages,
unsigned long density,
JET_TABLEID * tableId ) const
inline

◆ CreateTable() [3/4]

template<TableType T = Table, SimpleStringLike S>
T Harlinn::Common::Core::Ese::Database::CreateTable ( const S & tablename,
unsigned long initialNumberOfPages = 1,
unsigned long density = 0 ) const
inlinenodiscard

Creates an empty table in the database.

Template Parameters
TTable, or a type move assignable type derived from Table
Parameters
tablenameThe name of the table to create
initialNumberOfPagesThe initial number of database pages to allocate for the table. Specifying a number larger than one can reduce fragmentation if many rows are inserted into this table
densityThe table density, in percentage points. The number must be either 0 or in the range of 20 through 100. Passing 0 means that the default value should be used. The default is 80
Returns
A Table instance, or an instance of a type derived from Table, for the newly created database table.

◆ CreateTable() [4/4]

Result Harlinn::Common::Core::Ese::Database::CreateTable ( const wchar_t * tablename,
unsigned long initialNumberOfPages,
unsigned long density,
JET_TABLEID * tableId ) const
inline

◆ DeleteTable() [1/3]

void Harlinn::Common::Core::Ese::Database::DeleteTable ( const char * tableName)
inline

Deletes a table in a database.

Parameters
tableNameThe name of the table to delete.

◆ DeleteTable() [2/3]

template<SimpleStringLike T>
void Harlinn::Common::Core::Ese::Database::DeleteTable ( const T & tableName)
inline

Deletes a table in a database.

Parameters
tableNameThe name of the table to delete.

◆ DeleteTable() [3/3]

void Harlinn::Common::Core::Ese::Database::DeleteTable ( const wchar_t * tableName)
inline

Deletes a table in a database.

Parameters
tableNameThe name of the table to delete.

◆ GetTableInfo() [1/3]

ObjectInfo Harlinn::Common::Core::Ese::Database::GetTableInfo ( const char * objectName) const
inlinenodiscard

Retrieves information about a table in the database.

Parameters
objectNameThe name of the table.
Returns
The ObjectInfo object for the requeste table.

◆ GetTableInfo() [2/3]

template<SimpleStringLike S>
ObjectInfo Harlinn::Common::Core::Ese::Database::GetTableInfo ( const S & objectName) const
inlinenodiscard

Retrieves information about a table in the database.

Parameters
objectNameThe name of the table.
Returns
The ObjectInfo object for the requeste table.

◆ GetTableInfo() [3/3]

ObjectInfo Harlinn::Common::Core::Ese::Database::GetTableInfo ( const wchar_t * objectName) const
inlinenodiscard

Retrieves information about a table in the database.

Parameters
objectNameThe name of the table.
Returns
The ObjectInfo object for the requeste table.

◆ GetTables()

template<StringLike StringT = WideString>
Tables< StringT > Harlinn::Common::Core::Ese::Database::GetTables ( ) const
inlinenodiscard

Retrieves an Tables<StringT> that can be used to enumerate the tables in the database.

Template Parameters
StringT
Returns

◆ Handle()

JET_DBID Harlinn::Common::Core::Ese::Database::Handle ( ) const
inline

The raw database handle.

Returns
The raw database handle.

◆ IsValid()

bool Harlinn::Common::Core::Ese::Database::IsValid ( ) const
inlineconstexprnoexcept

A Database object where the session handle is not equal to JET_sesidNil and the database handle is not equal to JET_dbidNil is considered to be a valid Database object.

Returns
true if this Database object is valid, otherwise false.

◆ OnDatabaseCreated()

void Harlinn::Common::Core::Ese::Database::OnDatabaseCreated ( )
inline

◆ OnDatabaseOpened()

void Harlinn::Common::Core::Ese::Database::OnDatabaseOpened ( )
inline

◆ OpenTable() [1/4]

template<TableType T = Table, ApiCharType C>
T Harlinn::Common::Core::Ese::Database::OpenTable ( const C * tableName,
OpenTableFlags flags = OpenTableFlags::Updatable,
bool noexception = false ) const
inlinenodiscard

Opens a cursor on a previously created table.

Template Parameters
TEse::Table or a type derived from Ese::Table.
Cchar or wchar_t.
Parameters
tableNameThe name of the table to open.
flagsZero or more values from the OpenTableFlags enumeration. The values can be combined using the | operator.
noexceptionIf true this function will not throw an exception if table identified by tableName is not found in the database and return an invalid Table object.
Returns
A Table object representing the table in the database.

Derived classes should implement OnTableOpened( ) which is called just after constructing the Table, or Table derived object. This is an opportunity for Table derived objects to retrieve the column ids for the table.

◆ OpenTable() [2/4]

Result Harlinn::Common::Core::Ese::Database::OpenTable ( const char * tablename,
const void * parameters,
unsigned long parametersSize,
OpenTableFlags flags,
JET_TABLEID * tableId ) const
inline

Opens a cursor on a previously created table.

Parameters
tablenameThe name of the table to open.
parametersDeprecated. Set to nullptr.
parametersSizeDeprecated. Set to 0.
flagsZero or more values from the OpenTableFlags enumeration. The values can be combined using the | operator.
tableIdOn success, points to the identifier of the table. On failure, the contents for tableId are undefined.
Returns
A value from the Ese::Result enumeration.

◆ OpenTable() [3/4]

template<TableType T = Table, SimpleStringLike S>
T Harlinn::Common::Core::Ese::Database::OpenTable ( const S & tablename,
OpenTableFlags flags = OpenTableFlags::Updatable,
bool noexception = false ) const
inlinenodiscard

Opens a cursor on a previously created table.

Template Parameters
TEse::Table or a type derived from Ese::Table.
Cchar or wchar_t.
Parameters
tableNameThe name of the table to open.
flagsZero or more values from the OpenTableFlags enumeration. The values can be combined using the | operator.
noexceptionIf true this function will not throw an exception if table identified by tableName is not found in the database and return an invalid Table object.
Returns
A Table object representing the table in the database.

Derived classes should implement OnTableOpened( ) which is called just after constructing the Table, or Table derived object. This is an opportunity for Table derived objects to retrieve the column ids for the table. </ramarks>

◆ OpenTable() [4/4]

Result Harlinn::Common::Core::Ese::Database::OpenTable ( const wchar_t * tablename,
const void * parameters,
unsigned long parametersSize,
OpenTableFlags flags,
JET_TABLEID * tableId ) const
inline

Opens a cursor on a previously created table.

Parameters
tablenameThe name of the table to open.
parametersDeprecated. Set to nullptr.
parametersSizeDeprecated. Set to 0.
flagsZero or more values from the OpenTableFlags enumeration. The values can be combined using the | operator.
tableIdOn success, points to the identifier of the table. On failure, the contents for tableId are undefined.
Returns
A value from the Ese::Result enumeration.

◆ operator bool()

Harlinn::Common::Core::Ese::Database::operator bool ( ) const
inlineexplicitconstexprnoexcept

A Database object where the session handle is not equal to JET_sesidNil and the database handle is not equal to JET_dbidNil is considered to be a valid Database object.

◆ operator=() [1/2]

Database & Harlinn::Common::Core::Ese::Database::operator= ( const Database & other)
delete

Copy assignment is not allowed.

◆ operator=() [2/2]

Database & Harlinn::Common::Core::Ese::Database::operator= ( Database && other)
inlinenoexcept

Move assignment implemented by swapping handles wit the argument database object.

◆ SessionHandle()

JET_SESID Harlinn::Common::Core::Ese::Database::SessionHandle ( ) const
inline

Returns the handle of the session that was used to open or create the database.

Returns

◆ TableExists() [1/3]

bool Harlinn::Common::Core::Ese::Database::TableExists ( const char * objectName) const
inlinenodiscard

Test if a table exists in the database.

Parameters
objectNameThe name of the table.
Returns
true if the table exists.

◆ TableExists() [2/3]

template<SimpleStringLike S>
bool Harlinn::Common::Core::Ese::Database::TableExists ( const S & objectName) const
inlinenodiscard

Test if a table exists in the database.

Parameters
objectNameThe name of the table.
Returns
true if the table exists.

◆ TableExists() [3/3]

bool Harlinn::Common::Core::Ese::Database::TableExists ( const wchar_t * objectName) const
inlinenodiscard

Test if a table exists in the database.

Parameters
objectNameThe name of the table.
Returns
true if the table exists.

Member Data Documentation

◆ databaseId_

JET_DBID Harlinn::Common::Core::Ese::Database::databaseId_
private

◆ sessionId_

JET_SESID Harlinn::Common::Core::Ese::Database::sessionId_
private

The documentation for this class was generated from the following file: