rasdaman complete source
|
#include <database.hh>
Public Types | |
enum | access_status { not_open, read_write, read_only, exclusive } |
possible database states More... | |
enum | type_schema { CELL = 3, MARRAY = 2, COLLECTION = 1 } |
possible types define by symbolic names More... | |
Public Member Functions | |
r_Database () | |
default constructor More... | |
r_Database (const char *name) throw (r_Error) | |
constructor getting the rasmgr name More... | |
~r_Database () | |
destructor More... | |
void | open (const char *database_name, access_status status=read_write) throw ( r_Error ) |
open a database More... | |
void | close () |
close a database More... | |
void | create (const char *name) throw ( r_Error ) |
create a database with fixed schema RasDaSchema More... | |
void | destroy (const char *name) throw ( r_Error ) |
destroy a database More... | |
void | set_servername (const char *name, int port=RASMGRPORT) throw (r_Error) |
set the server name More... | |
void | set_useridentification (const char *name, const char *plain_pass) throw (r_Error) |
set the user name and password More... | |
access_status | get_status () const |
get the actual status More... | |
void | set_object_name (r_Object &obj, const char *name) throw (r_Error) |
give a name to an object (signature is not ODMG conformant because of compiler bug) More... | |
r_Ref_Any | lookup_object (const char *name) const throw ( r_Error ) |
lookup named objects in a database (must be called within open database and running transaction) More... | |
r_Ref_Any | lookup_object (const r_OId &oid) const throw ( r_Error ) |
lookup objects by oids in a database (must be called within open database and running transaction) More... | |
r_Type * | get_type_schema (const char *typeName, type_schema typetype) throw (r_Error) |
void | set_transfer_format (r_Data_Format format, const char *formatParams=NULL) throw ( r_Error ) |
set the transfer compression format, both for data sent from the server to the client and the other way around. More... | |
void | set_storage_format (r_Data_Format format, const char *formatParams=NULL) throw ( r_Error ) |
set the storage format for newly created MDD for this client More... | |
void | insertColl (const char *collName, const char *typeName, const r_OId &oid) throw ( r_Error ) |
void | removeObjFromColl (const char *name, const r_OId &oid) throw ( r_Error ) |
removes an object from a collection More... | |
ClientComm * | getComm () |
const r_OId | get_new_oid (unsigned short objType) const throw (r_Error) |
Static Public Attributes | |
static r_Database * | actual_database |
stores a pointer to the actually opened database More... | |
r_Database::r_Database | ( | ) |
default constructor
r_Database::r_Database | ( | const char * | name | ) | |
throw | ( | r_Error | |||
) |
constructor getting the rasmgr name
r_Database::~r_Database | ( | ) |
destructor
One error situations can occur which raise an exception of type {r_Error} with one of the following kinds: r_Error_NameInvalid && Name is NULL.\
void r_Database::close | ( | ) |
close a database
The method opens the database specified with { database_name}. Several error situations can occur which raise an exception of type {r_Error} with one of the following kinds:
{tabular}{lll} r_Error_HostInvalid && Host can not be found.\ r_Error_ServerInvalid && Server can not be found.\ r_Error_ClientUnknown && Client is not known by the server (earlier communication problems).\ r_Error_DatabaseUnknown && Database does not exist.\ r_Error_DatabaseOpen && Database is already open.\ r_Error_TransferFailed && Other communication problem. \ r_Error_NameInvalid && Name is NULL.\ {tabular}
void r_Database::create | ( | const char * | name | ) | |
throw | ( | r_Error | |||
) |
create a database with fixed schema RasDaSchema
void r_Database::destroy | ( | const char * | name | ) | |
throw | ( | r_Error | |||
) |
destroy a database
This method works only if a server host name has been specified with { set_servername()}. One of error situations can occur will raise an exception of type {r_Error} with one of the following kinds: r_Error_NameInvalid && Name is NULL.\
|
inline |
get the actual status
One of error situations can occur will raise an exception of type {r_Error} with one of the following kinds: r_Error_NameInvalid && Name is NULL.\
Referenced by RasdamanConnector::getStatus().
r_Type* r_Database::get_type_schema | ( | const char * | typeName, |
type_schema | typetype | ||
) | |||
throw | ( | r_Error | |
) |
The method looks up an object with { oid}. Right now, just objects of type {r_Set} and {r_GMarray} are allowed.
Error kinds: {tabular}{lll} r_Error_ClientUnknown && Client is not known by the server (earlier communication problems).\ r_Error_DatabaseClosed && Database is not open. \ r_Error_TransactionNotOpen && No transaction is active. \ r_Error_ObjectUnknown && The object with { oid} is not in the database.\ r_Error_TransferFailed && Other communication problem. \ {tabular}
ClientComm* r_Database::getComm | ( | ) |
void r_Database::insertColl | ( | const char * | collName, |
const char * | typeName, | ||
const r_OId & | oid | ||
) | |||
throw | ( | r_Error | |
) |
lookup named objects in a database (must be called within open database and running transaction)
The method gives the { name} to the object { obj}. The name is used for further retrieval of the object. Right now, names can just be given to sets of type { r_Set}. One of error situations can occur will raise an exception of type {r_Error} with one of the following kinds: r_Error_NameInvalid && Name is NULL.\
lookup objects by oids in a database (must be called within open database and running transaction)
The method looks up an object with { name}. Right now, just objects of type {r_Set} are allowed. Error kinds:
{tabular}{lll} r_Error_ClientUnknown && Client is not known by the server (earlier communication problems).\ r_Error_DatabaseClosed && Database is not open. \ r_Error_TransactionNotOpen && No transaction is active. \ r_Error_ObjectUnknown && The object with { name} is not in the database.\ r_Error_TransferFailed && Other communication problem. \ r_Error_NameInvalid && Name is NULL.\ {tabular}
void r_Database::open | ( | const char * | database_name, |
access_status | status = read_write |
||
) | |||
throw | ( | r_Error | |
) |
open a database
removes an object from a collection
give a name to an object (signature is not ODMG conformant because of compiler bug)
void r_Database::set_servername | ( | const char * | name, |
int | port = RASMGRPORT |
||
) | |||
throw | ( | r_Error | |
) |
set the server name
This method works only if a server host name has been specified with { set_servername()}. One of error situations can occur will raise an exception of type {r_Error} with one of the following kinds: r_Error_NameInvalid && Name is NULL.\
void r_Database::set_storage_format | ( | r_Data_Format | format, |
const char * | formatParams = NULL |
||
) | |||
throw | ( | r_Error | |
) |
set the storage format for newly created MDD for this client
The method sets the transfer compression used for the communications of this client with the server.
Error kinds: {tabular}{lll} r_Error_ClientUnknown && Client is not known by the server\ r_Error_DatabaseClosed && Database is not open\ r_Error_FeatureNotSupported && Unsupported transfer format\ {tabular}
void r_Database::set_transfer_format | ( | r_Data_Format | format, |
const char * | formatParams = NULL |
||
) | |||
throw | ( | r_Error | |
) |
set the transfer compression format, both for data sent from the server to the client and the other way around.
The method looks up the type structure with { typeName} as its name. typetype is 1 for marray and 2 for collection.
Error kinds: {tabular}{lll} r_Error_ClientUnknown && Client is not known by the server (earlier communication problems).\ r_Error_DatabaseClosed && Database is not open. \ r_Error_TransactionNotOpen && No transaction is active. \ r_Error_ObjectUnknown && The object with { typeName} is not in the database.\ r_Error_TransferFailed && Other communication problem. \ r_Error_TypeInvalid && The typetype is neither 1 nor 2. \ r_Error_NameInvalid && The typeName is neither NULL or is a "\0". \ {tabular}
void r_Database::set_useridentification | ( | const char * | name, |
const char * | plain_pass | ||
) | |||
throw | ( | r_Error | |
) |
set the user name and password
One of error situations can occur will raise an exception of type {r_Error} with one of the following kinds: r_Error_NameInvalid && Name is NULL.\
|
static |
stores a pointer to the actually opened database
This method sets the storage format to use for MDD created by this client in the RasDaMan database. The return values are identical to set_transfer_format()