The class for a database instance.
More...
#include <dbmain/Database.h>
|
| Database () |
| A trivial constructor. More...
|
|
| ~Database () |
| Automatically closes the database if not closed. More...
|
|
void | open (const std::string &path, size_t bpool_size, bool create, bool allow_overwrite=false) |
| Initializes the database components and opens or creates the database at the specified path . More...
|
|
constexpr bool | is_open () const |
|
void | close () |
| Closes the database. More...
|
|
FileManager * | file_manager () const |
|
BufferManager * | buf_manager () const |
|
CatCache * | catcache () const |
|
Schema * | actres_schema () const |
|
void | CreateTable (absl::string_view tabname, std::vector< Oid > coltypid, std::vector< uint64_t > coltypparam={}, const std::vector< absl::string_view > &field_names={}, std::vector< bool > colisnullable={}, std::vector< bool > colisarray={}) |
| Creates a table named tabname'', with coltypid.size()'' columns. More...
|
|
void | CreateIndex (absl::string_view idxname, Oid idxtabid, IdxType idxtyp, bool idxunique, std::vector< FieldId > idxcoltabcolids, std::vector< Oid > idxcolltfuncids={}, std::vector< Oid > idxcoleqfuncids={}) |
| Createa an index named idxname'' and inserts into the catalog. More...
|
|
const std::string & | GetLastDBPath () const |
|
|
static void | init_global () |
| Initializes all the global objects that are not associated with a particular database. More...
|
|
The class for a database instance.
There may only be one global database instance g_db'' at any time (see below). The constructor and destructor of the
Database'' class must be trivial because of the existence of the global variable. To initialize/destroy a database, call g_db->open(...)'' and
g_db->close()''.
◆ Database()
taco::Database::Database |
( |
| ) |
|
|
inline |
◆ ~Database()
taco::Database::~Database |
( |
| ) |
|
|
inline |
Automatically closes the database if not closed.
◆ actres_schema()
Schema * taco::Database::actres_schema |
( |
| ) |
const |
◆ buf_manager()
◆ catcache()
CatCache* taco::Database::catcache |
( |
| ) |
const |
|
inline |
◆ close()
void taco::Database::close |
( |
| ) |
|
Closes the database.
This also releases all the resources even if the database ends up in an error state.
◆ CreateIndex()
void taco::Database::CreateIndex |
( |
absl::string_view |
idxname, |
|
|
Oid |
idxtabid, |
|
|
IdxType |
idxtyp, |
|
|
bool |
idxunique, |
|
|
std::vector< FieldId > |
idxcoltabcolids, |
|
|
std::vector< Oid > |
idxcolltfuncids = {} , |
|
|
std::vector< Oid > |
idxcoleqfuncids = {} |
|
) |
| |
Createa an index named idxname'' and inserts into the catalog.
Ifidxname'' is an empty string, a default name will be generated.
The caller may optionally provide non-default < and = operators, as specified in CatCacheBase::AddIndex(). Both idxcolltfuncids
and idxcoleqfuncids
may be shorter than idxcoltabcolids
and may have InvalidOid
. Missing values and InvalidOid
are looked up from the catalog using the default operators for the type.
◆ CreateTable()
void taco::Database::CreateTable |
( |
absl::string_view |
tabname, |
|
|
std::vector< Oid > |
coltypid, |
|
|
std::vector< uint64_t > |
coltypparam = {} , |
|
|
const std::vector< absl::string_view > & |
field_names = {} , |
|
|
std::vector< bool > |
colisnullable = {} , |
|
|
std::vector< bool > |
colisarray = {} |
|
) |
| |
Creates a table named tabname'', with
coltypid.size()'' columns.
All the remaining vectors may be empty or of the same size as `‘coltypid’'. We will assign default values to the remainder of the parameters if they are empty. More specifically, the default type parameter is 0. The default field name for the ith column (starting from 0) is `‘col_i’'. By default, none of the field is nullable or is an array.
◆ file_manager()
◆ GetLastDBPath()
const std::string& taco::Database::GetLastDBPath |
( |
| ) |
const |
|
inline |
◆ init_global()
void taco::Database::init_global |
( |
| ) |
|
|
static |
Initializes all the global objects that are not associated with a particular database.
This must be called the first thing in main() and this may not be called more than once.
◆ is_open()
constexpr bool taco::Database::is_open |
( |
| ) |
const |
|
inlineconstexpr |
◆ open()
void taco::Database::open |
( |
const std::string & |
path, |
|
|
size_t |
bpool_size, |
|
|
bool |
create, |
|
|
bool |
allow_overwrite = false |
|
) |
| |
Initializes the database components and opens or creates the database at the specified path
.
If allow_overwrite
and create are both true and the specified path already exists, it silently removes the existing directory before opens the database.
◆ m_actres_schema
Schema* taco::Database::m_actres_schema |
|
private |
◆ m_buf_manager
◆ m_catcache
◆ m_db_path
std::string taco::Database::m_db_path |
|
private |
◆ m_file_manager
◆ m_initialized
bool taco::Database::m_initialized |
|
private |
The documentation for this class was generated from the following files: