Drizzled Public API Documentation

Schema Class Reference
Inheritance diagram for Schema:
drizzled::plugin::StorageEngine drizzled::plugin::Plugin drizzled::plugin::MonitoredInTransaction

Public Types

typedef uint64_t Table_flags
 
typedef std::pair< const
std::string, const std::string > 
map_key
 
typedef std::map< const
map_key, plugin::Plugin * > 
map
 
typedef std::vector< Plugin * > vector
 

Public Member Functions

drizzled::Cursorcreate (drizzled::Table &)
 
void doGetSchemaIdentifiers (drizzled::identifier::schema::vector &)
 
drizzled::message::schema::shared_ptr doGetSchemaDefinition (const drizzled::identifier::Schema &)
 
bool doCreateSchema (const drizzled::message::Schema &)
 
bool doAlterSchema (const drizzled::message::Schema &)
 
bool doDropSchema (const drizzled::identifier::Schema &)
 
int doGetTableDefinition (drizzled::Session &, const drizzled::identifier::Table &, drizzled::message::Table &)
 
bool doDoesTableExist (drizzled::Session &, const drizzled::identifier::Table &)
 
int doRenameTable (drizzled::Session &, const drizzled::identifier::Table &, const drizzled::identifier::Table &)
 
int doCreateTable (drizzled::Session &, drizzled::Table &, const drizzled::identifier::Table &, const drizzled::message::Table &)
 
int doDropTable (drizzled::Session &, const drizzled::identifier::Table &)
 
const char ** bas_ext () const
 
void get_auto_increment (uint64_t, uint64_t, uint64_t, uint64_t *, uint64_t *)
 
void doGetTableIdentifiers (drizzled::CachedDirectory &directory, const drizzled::identifier::Schema &schema_identifier, drizzled::identifier::table::vector &set_of_identifiers)
 
const std::string & getTableDefinitionFileExtension ()
 
virtual
message::Table::Index::IndexType 
default_index_type () const
 
const std::vector< std::string > & getAliases () const
 
void addAlias (std::string alias)
 
virtual void print_error (int error, myf errflag, const Table &table) const
 
bool is_user_selectable () const
 
bool check_flag (const engine_flag_bits flag) const
 
virtual uint32_t index_flags (enum ha_key_alg) const
 
virtual void startStatement (Session *session)
 
virtual void endStatement (Session *session)
 
virtual int close_connection (Session *)
 
virtual bool flush_logs ()
 
virtual bool show_status (Session *, stat_print_fn *, enum ha_stat_type)
 
int renameTable (Session &session, const drizzled::identifier::Table &from, const drizzled::identifier::Table &to)
 
Cursor * getCursor (Table &share)
 
uint32_t max_record_length () const
 
uint32_t max_keys () const
 
uint32_t max_key_parts () const
 
uint32_t max_key_length () const
 
uint32_t max_key_part_length (void) const
 
virtual uint32_t max_supported_record_length (void) const
 
virtual uint32_t max_supported_keys (void) const
 
virtual uint32_t max_supported_key_parts (void) const
 
virtual uint32_t max_supported_key_length (void) const
 
virtual uint32_t max_supported_key_part_length (void) const
 
virtual bool participatesInSqlTransaction () const
 
virtual bool participatesInXaTransaction () const
 
virtual bool alwaysRegisterForXaTransaction () const
 
virtual bool validateCreateTableOption (const std::string &key, const std::string &state)
 
virtual bool validateCreateSchemaOption (const std::string &key, const std::string &state)
 
virtual void shutdownPlugin ()
 
virtual void startup (drizzled::Session &)
 
void activate ()
 
void deactivate ()
 
bool isActive () const
 
const std::string & getName () const
 
void setModule (module::Module *module)
 
const std::string & getTypeName () const
 
virtual bool removeLast () const
 
const std::string & getModuleName () const
 
size_t getId () const
 

Static Public Member Functions

static bool addPlugin (plugin::StorageEngine *engine)
 
static void removePlugin (plugin::StorageEngine *engine)
 
static message::table::shared_ptr getTableMessage (Session &session, const drizzled::identifier::Table &identifier, bool include_temporary_tables=true)
 
static bool doesTableExist (Session &session, const drizzled::identifier::Table &identifier, bool include_temporary_tables=true)
 
static plugin::StorageEngine * findByName (const std::string &find_str)
 
static plugin::StorageEngine * findByName (Session &session, const std::string &find_str)
 
static void closeConnection (Session &)
 
static void dropDatabase (char *path)
 
static bool flushLogs (plugin::StorageEngine *db_type)
 
static bool dropTable (Session &session, const drizzled::identifier::Table &identifier)
 
static bool dropTable (Session &session, const drizzled::identifier::Table &identifier, drizzled::error_t &error)
 
static bool dropTable (Session &session, StorageEngine &engine, const identifier::Table &identifier, drizzled::error_t &error)
 
static void getIdentifiers (Session &session, const identifier::Schema &schema_identifier, identifier::table::vector &set_of_identifiers)
 
static void getIdentifiers (Session &session, identifier::schema::vector &schemas)
 
static bool canCreateTable (const drizzled::identifier::Table &identifier)
 
static message::schema::shared_ptr getSchemaDefinition (const drizzled::identifier::Table &identifier)
 
static message::schema::shared_ptr getSchemaDefinition (const drizzled::identifier::Schema &identifier)
 
static bool doesSchemaExist (const drizzled::identifier::Schema &identifier)
 
static const charset_info_st * getSchemaCollation (const drizzled::identifier::Schema &identifier)
 
static bool createSchema (const drizzled::message::Schema &schema_message)
 
static bool dropSchema (Session &session, const identifier::Schema &identifier, message::schema::const_reference schema_message)
 
static bool alterSchema (const drizzled::message::Schema &schema_message)
 
static const std::string & resolveName (const StorageEngine *engine)
 
static bool createTable (Session &session, const identifier::Table &identifier, message::Table &table_message)
 
static void removeLostTemporaryTables (Session &session, const char *directory)
 

Protected Types

typedef std::map< std::string,
message::Table > 
ProtoCache
 Used as a protobuf storage currently by TEMP only engines.
 

Protected Member Functions

void print_keydup_error (uint32_t key_nr, const char *msg, const Table &table) const
 
virtual bool get_error_message (int error, String *buf) const
 
virtual bool doCanCreateTable (const drizzled::identifier::Table &identifier)
 

Static Protected Member Functions

static int deleteDefinitionFromPath (const drizzled::identifier::Table &identifier)
 
static int renameDefinitionFromPath (const drizzled::identifier::Table &dest, const drizzled::identifier::Table &src)
 
static int writeDefinitionFromPath (const drizzled::identifier::Table &identifier, const message::Table &proto)
 
static bool readTableFile (const std::string &path, message::Table &table_message)
 

Protected Attributes

std::string table_definition_ext
 
ProtoCache proto_cache
 
pthread_mutex_t proto_cache_mutex
 

Private Types

typedef boost::unordered_map
< std::string,
drizzled::message::schema::shared_ptr > 
SchemaCache
 

Private Member Functions

bool writeSchemaFile (const drizzled::identifier::Schema &schema_identifier, const drizzled::message::Schema &db)
 
bool readSchemaFile (const drizzled::identifier::Schema &schema_identifier, drizzled::message::Schema &schema)
 
bool readSchemaFile (std::string filename, drizzled::message::Schema &schema)
 
void prime ()
 

Private Attributes

SchemaCache schema_cache
 
bool schema_cache_filled
 
boost::shared_mutex mutex
 

Detailed Description

Definition at line 30 of file schema.h.

Member Function Documentation

virtual bool drizzled::plugin::StorageEngine::alwaysRegisterForXaTransaction ( ) const
inlinevirtualinherited

Returns true if the class should be registered for every XA transaction regardless of whether the class modifies the server's state.

Note

As an example, the XaTransactionApplier plugin class returns true for this virtual method. Even though it does not change the result of the transaction (it simply is logging the changes made by other resource managers), the applier plugin should be enlisted in all XA transactions in order to be able to rollback or recover its logging activity properly.

Implements drizzled::plugin::MonitoredInTransaction.

Reimplemented in drizzled::plugin::TransactionalStorageEngine, and drizzled::plugin::XaStorageEngine.

Definition at line 433 of file storage_engine.h.

const char ** Schema::bas_ext ( ) const
virtual

If frm_error() is called then we will use this to find out what file extentions exist for the storage engine. This is also used by the default rename_table and delete_table method in Cursor.cc.

For engines that have two file name extentions (separate meta/index file and data file), the order of elements is relevant. First element of engine file name extentions array should be meta/index file extention. Second element - data file extention. This order is assumed by prepare_for_repair() when REPAIR Table ... USE_FRM is issued.

Implements drizzled::plugin::StorageEngine.

Definition at line 324 of file schema.cc.

bool drizzled::plugin::StorageEngine::canCreateTable ( const drizzled::identifier::Table identifier)
staticinherited
Note
on success table can be created.

Definition at line 952 of file storage_engine.cc.

void drizzled::plugin::StorageEngine::closeConnection ( Session session)
staticinherited
Note
don't bother to rollback here, it's done already

Definition at line 196 of file storage_engine.cc.

bool drizzled::plugin::StorageEngine::createTable ( Session session,
const identifier::Table identifier,
message::Table table_message 
)
staticinherited

Initiates table-file and calls appropriate database-creator.

Return values
0ok
1error

Definition at line 413 of file storage_engine.cc.

References drizzled::Table::delete_table().

int Schema::doDropTable ( drizzled::Session session,
const drizzled::identifier::Table identifier 
)
inlinevirtual

Delete all files with extension from bas_ext().

Parameters
nameBase name of table
Note
We assume that the Cursor may return more extensions than was actually used for the file.
Return values
0If we successfully deleted at least one file from base_ext and didn't get any other errors than ENOENT
!0Error

Implements drizzled::plugin::StorageEngine.

Definition at line 88 of file schema.h.

bool StorageEngine::doesTableExist ( Session session,
const drizzled::identifier::Table identifier,
bool  include_temporary_tables = true 
)
staticinherited

Utility method which hides some of the details of getTableDefinition()

Definition at line 249 of file storage_engine.cc.

bool drizzled::plugin::StorageEngine::get_error_message ( int  error,
String buf 
) const
protectedvirtualinherited

Return an error message specific to this Cursor.

Parameters
errorerror code previously returned by Cursor
bufpointer to String where to add error message
Returns
Returns true if this is a temporary error

Definition at line 805 of file storage_engine.cc.

Referenced by drizzled::plugin::StorageEngine::print_error().

size_t drizzled::plugin::MonitoredInTransaction::getId ( ) const
inlineinherited

Returns the "slot" or ID of the monitored resource

Definition at line 87 of file monitored_in_transaction.h.

virtual bool drizzled::plugin::StorageEngine::participatesInSqlTransaction ( ) const
inlinevirtualinherited

Returns true if the class should participate in the SQL transaction.

Implements drizzled::plugin::MonitoredInTransaction.

Reimplemented in drizzled::plugin::TransactionalStorageEngine, and drizzled::plugin::XaStorageEngine.

Definition at line 425 of file storage_engine.h.

virtual bool drizzled::plugin::StorageEngine::participatesInXaTransaction ( ) const
inlinevirtualinherited

Returns true if the class should participate in the XA transaction.

Implements drizzled::plugin::MonitoredInTransaction.

Reimplemented in drizzled::plugin::TransactionalStorageEngine, and drizzled::plugin::XaStorageEngine.

Definition at line 429 of file storage_engine.h.

void drizzled::plugin::StorageEngine::print_error ( int  error,
myf  errflag,
const Table table 
) const
virtualinherited

Print error that we got from Cursor function.

Note
In case of delete table it's only safe to use the following parts of the 'table' structure:
  • table->getShare()->path
  • table->alias

Definition at line 603 of file storage_engine.cc.

References drizzled::Table::get_dup_key(), drizzled::plugin::StorageEngine::get_error_message(), and drizzled::Table::key_info.

bool Schema::readSchemaFile ( std::string  filename,
drizzled::message::Schema schema 
)
private
Note
If parsing fails, either someone has done a "mkdir" or has deleted their opt file. So what do we do? We muddle through the adventure by generating one with a name in it, and the charset set to the default.

Definition at line 284 of file schema.cc.

bool Schema::writeSchemaFile ( const drizzled::identifier::Schema schema_identifier,
const drizzled::message::Schema db 
)
private

path is path to database, not schema file

Note
we do the rename to make it crash safe.

Definition at line 213 of file schema.cc.


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