VisualIB  1.0
IBExpress library for making use of Borland IBExpress outside of C++Builder
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
VIB::Database Class Reference

VIB::Database wraps the VisualIB VIBDatabase C structure to provide a C++11 object with semantics compatible with those of Borland TIBDatabase. More...

#include <classVIBDatabase.h>

Classes

class  DBParamClass
 Class implementing the DBParamByDPB property, which reimplements the AnsiString DBParamByDPB[int Idx] property of TIBDatabase. More...
 
class  ParamClass
 Class implementing the Params property, which reimplements the TStrings *Params property of TIBDatabase. More...
 

Public Member Functions

 Database (VIBDatabase *pvdb=NULL)
 Construct a VIB::Database instance.
 
virtual ~Database ()
 Destroy the VIB::Database.
 
VIBDatabasegetVIBDatabase () const
 Get a pointer to the wrapped VIBDatabase structure instance, for use with the VisualIB C API.
 
int Call (int ErrCode, bool RaiseError)
 Internal method used to make calls to the InterBase API.
 
void CheckActive ()
 Call CheckActive to raise an error if the connection to the database server is inactive.
 
void CheckDatabaseName ()
 Call CheckDatabaseName to check if the DatabaseName property is empty, and raise an error if it is.
 
void CheckInactive ()
 Call CheckInactive to raise an error if the connection to the database server is active.
 
void Close ()
 Call Close to disconnect from the source of database information.
 
void CloseDataSets ()
 Call CloseDataSets to close all active datasets without disconnecting from the database server.
 
void CreateDatabase ()
 Call CreateDatabase to create a database using Params as the rest of the CREATE DATABASE command.
 
void DropDatabase ()
 Call DropDatabase to drop a database, which removes the database file from the server.
 
void ForceClose ()
 Use ForceClose to force the database connection to close; even if the underlying API call fails, the database handle is reset to NULL.
 
void FlushSchema ()
 Undocumented TIBDatabase method.
 
bool Has_COMPUTED_BLR (const std::string &Relation, const std::string &Field)
 Undocumented TIBDatabase method.
 
bool Has_DEFAULT_VALUE (const std::string &Relation, const std::string &Field)
 Undocumented TIBDatabase method.
 
int IndexOfDBConst (const char *st)
 Use IndexOfDBConst to locate a parameter in the database parameters list.
 
void Open ()
 Call Open to establish a connection to the source of database information.
 
bool TestConnected ()
 Use TestConnected to determine whether a database is connected to the server.
 
void RemoveTransaction (int Idx)
 Call RemoveTransaction to disassociate a specified transaction from the database.
 
void RemoveTransactions ()
 Call RemoveTransactions to disassociate all transactions from the database.
 

Public Attributes

Property< bool > AllowStreamedConnected
 Undocumented property.
 
Property< bool > Connected
 Set to true to establish a database connection without opening a dataset.
 
Property< std::string > DatabaseName
 Use to specify the name of the database to use with a database component.
 
Property< int > DataSetCount
 Use to determine the number of datasets listed by the DataSets property.
 
Property< int > DBSQLDialect
 Get the database SQL dialect.
 
Property< void ** > Handle
 Use to make calls directly to the InterBase API.
 
Property< bool > HandleIsShared
 Read to determine if the handle to the database is shared.
 
Property< int > IdleTimer
 Specifies how long the database should wait before disconnecting an idle connection.
 
Property< bool > IsReadOnly
 Indicates whether or not the database is set to read-only.
 
Property< bool > LoginPrompt
 Specifies whether a login dialog appears immediately before opening a new connection.
 
Property< ParamClass * > Params
 Specifies the database parameters to pass to the InterBase server.
 
Property< int > SQLDialect
 Sets or returns the SQL dialect used by the client.
 
Property< int > SQLObjectCount
 Returns the number of SQL objects in the database.
 
Property< VIBTraceFlags > TraceFlags
 Specifies the database operations to track with the SQL Monitor at runtime.
 
Property< int > TransactionCount
 Returns the number of transactions associated with the database component.
 
ArrayProperty< DBParamClass
*, std::string > 
DBParamByDPB
 Use to inspect and set DPB parameters without looking at the Params string list.
 

Protected Attributes

VIBDatabasevdb
 Wrapped instance of VIBDatabase structure.
 
ParamClass paramsObj
 Protected instance of Params wrapper object.
 
DBParamClass dbParamObj
 Protected instance of DBParamByDPB wrapper object.
 

Friends

class ParamClass
 

Detailed Description

VIB::Database wraps the VisualIB VIBDatabase C structure to provide a C++11 object with semantics compatible with those of Borland TIBDatabase.

Constructor & Destructor Documentation

VIB::Database::Database ( VIBDatabase pvdb = NULL)

Construct a VIB::Database instance.

Parameters
[in]pvdbOptional pointer to an existing VIBDatabase structure of which this class instance should take ownership.
VIB::Database::~Database ( )
virtual

Destroy the VIB::Database.

Any connections still open on the wrapped VIBDatabase instance will be closed, and then it will be destroyed as well.

Member Function Documentation

int VIB::Database::Call ( int  ErrCode,
bool  RaiseError 
)

Internal method used to make calls to the InterBase API.

Gives the option of raising an exception or returning an error based on the value of RaiseError.

Note
Reimplements TIBDatabase::Call
Parameters
[in]ErrCodeInterBase API error code.
[in]RaiseErrorIf true, an exception should be raised.
Returns
Unknown; InterBase API code?
void VIB::Database::CheckActive ( )

Call CheckActive to raise an error if the connection to the database server is inactive.

Note
Reimplements TIBDatabase::CheckActive
void VIB::Database::CheckDatabaseName ( )

Call CheckDatabaseName to check if the DatabaseName property is empty, and raise an error if it is.

Note
Reimplements TIBDatabase::CheckDatabaseName
void VIB::Database::CheckInactive ( )

Call CheckInactive to raise an error if the connection to the database server is active.

Note
Reimplements TIBDatabase::CheckInactive
void VIB::Database::Close ( )

Call Close to disconnect from the source of database information.

Before the connection component is deactivated, all associated datasets are closed. Calling Close is the same as setting the Connected property to false. In most cases, closing a connection frees system resources allocated to the connection.

Note
If a previously active connection is closed and then reopened, any associated datasets must be individually reopened.
Reimplements TCustomConnection::Close
void VIB::Database::CloseDataSets ( )

Call CloseDataSets to close all active datasets without disconnecting from the database server.

Note
Reimplements TIBDatabase::CloseDataSets
void VIB::Database::CreateDatabase ( )

Call CreateDatabase to create a database using Params as the rest of the CREATE DATABASE command.

Note
Reimplements TIBDatabase::CreateDatabase
void VIB::Database::DropDatabase ( )

Call DropDatabase to drop a database, which removes the database file from the server.

Warning
Does exactly what it says. Data cannot be recovered without a backup!
Note
Reimplements TIBDatabase::DropDatabase
void VIB::Database::FlushSchema ( )

Undocumented TIBDatabase method.

Note
Reimplements TIBDatabase::FlushSchema
void VIB::Database::ForceClose ( )

Use ForceClose to force the database connection to close; even if the underlying API call fails, the database handle is reset to NULL.

Note
Reimplements TIBDatabase::ForceClose
VIBDatabase* VIB::Database::getVIBDatabase ( ) const
inline

Get a pointer to the wrapped VIBDatabase structure instance, for use with the VisualIB C API.

Returns
Pointer to the wrapped and owned VIBDatabase instance.
bool VIB::Database::Has_COMPUTED_BLR ( const std::string &  Relation,
const std::string &  Field 
)

Undocumented TIBDatabase method.

Parameters
[in]RelationName of a database relation (table, view, etc).
[in]FieldName of a database field.
Returns
True or false depending if the field of this relation has computed BLR?
Note
Reimplements TIBDatabase::Has_COMPUTED_BLR
bool VIB::Database::Has_DEFAULT_VALUE ( const std::string &  Relation,
const std::string &  Field 
)

Undocumented TIBDatabase method.

Parameters
[in]RelationName of a database relation (table, view, etc).
[in]FieldName of a database field.
Returns
True or false depending if the field of this relation has a default value?
Note
Reimplements TIBDatabase::Has_DEFAULT_VALUE
int VIB::Database::IndexOfDBConst ( const char *  st)

Use IndexOfDBConst to locate a parameter in the database parameters list.

Returns
Parameter index, or -1 if the parameter is not found.
Note
Reimplements TIBDatabase::IndexOfDBConst
void VIB::Database::Open ( )

Call Open to establish a connection to the source of database information.

Open sets the Connected property to true.

Note
Reimplements TCustomConnection::Open
void VIB::Database::RemoveTransaction ( int  Idx)

Call RemoveTransaction to disassociate a specified transaction from the database.

Parameters
[in]IdxIndex of the transaction to remove.
void VIB::Database::RemoveTransactions ( )

Call RemoveTransactions to disassociate all transactions from the database.

Note
Reimplements TIBDatabase::RemoveTransactions
bool VIB::Database::TestConnected ( )

Use TestConnected to determine whether a database is connected to the server.

Returns
True if the connection is good, and false otherwise.
Note
Reimplements TIBDatabase::TestConnected

Member Data Documentation

Property<bool> VIB::Database::Connected

Set to true to establish a database connection without opening a dataset.

Set to false to close a database connection. An application can check Connected to determine the current status of a database connection.

Note
Reimplements TIBDatabase::Connected
Property<std::string> VIB::Database::DatabaseName

Use to specify the name of the database to use with a database component.

For local InterBase databases, this can be a filename. Otherwise, use the standard InterBase server_name:filename syntax.

Note
Reimplements TIBDatabase::DatabaseName
Property<int> VIB::Database::DataSetCount

Use to determine the number of datasets listed by the DataSets property.

DataSets may include only the active datasets that use the connection component, or it may list all datasets. Use as an upper bound when iterating through the DataSets property.

Note
Read-only property.
Reimplements TCustomConnection::DataSetCount
ArrayProperty<DBParamClass *, std::string> VIB::Database::DBParamByDPB

Use to inspect and set DPB parameters without looking at the Params string list.

Note
Reimplements TIBDatabase::DBParamByDPB
Property<int> VIB::Database::DBSQLDialect

Get the database SQL dialect.

Note
Read-only property.
Reimplements TIBDatabase::DBSQLDialect
Property<void **> VIB::Database::Handle

Use to make calls directly to the InterBase API.

Note
Read-only property.
Reimplements TIBDatabase::Handle
Property<bool> VIB::Database::HandleIsShared

Read to determine if the handle to the database is shared.

Note
Read-only property.
Reimplements TIBDatabase::HandleIsShared
Property<int> VIB::Database::IdleTimer

Specifies how long the database should wait before disconnecting an idle connection.

Note
Reimplements TIBDatabase::IdleTimer
Property<bool> VIB::Database::IsReadOnly

Indicates whether or not the database is set to read-only.

Note
Reimplements TIBDatabase::IsReadOnly
Property<bool> VIB::Database::LoginPrompt

Specifies whether a login dialog appears immediately before opening a new connection.

When set to false, the application must supply username and password values programmatically.

Note
Reimplements TCustomConnection::LoginPrompt
Property<ParamClass *> VIB::Database::Params

Specifies the database parameters to pass to the InterBase server.

Use the Add method of the property object to add string parameters.

Note
Reimplements TIBDatabase::Params
Property<int> VIB::Database::SQLDialect

Sets or returns the SQL dialect used by the client.

If the connection is active, the SQLDialect property canot be set to a value greater than the database SQL dialect. If the connection is inactive, then on connect an OnDialectDowngradeWarning event may be fired and the SQLDialect property will be downgraded to match the database SQL dialect.

Note
Reimplements TIBDatabase::SQLDialect
Property<int> VIB::Database::SQLObjectCount

Returns the number of SQL objects in the database.

SQL objects are usually defined as InterBase datasets, IBSQL, and blobs.

Note
Read-only property.
Reimplements TIBDatabase::SQLObjectCount
Property<VIBTraceFlags> VIB::Database::TraceFlags

Specifies the database operations to track with the SQL Monitor at runtime.

TraceFlags is only meaningful for the SQL Monitor, which is provided to enable performance tuning and SQL debugging when working with remote SQL database servers.

See Also
VIBTraceFlags
Note
Reimplements TIBDatabase::TraceFlags
Property<int> VIB::Database::TransactionCount

Returns the number of transactions associated with the database component.

Note
Read-only property.
Reimplements TIBDatabase::TransactionCount

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