#include <dmprovider/SchemaTableNode.h>
Inheritance diagram for BSchemaTableNode:
This class can be instantiated by yourself on a particular schema database, or generated for you by BSchemaDatabaseNode.
Fix data access to use cursor ID instead of always row ID.
Implement adding and removing of columns in underlying table.
Make everything update when columns are added/removed.
ITable Implementation | |
virtual status_t | AddColumn (const SString &name, uint32_t typeCode, size_t maxSize, uint32_t flags, const SValue &extras) |
Add a new column to the table. | |
virtual SValue | ColumnNames () const |
Return set of column names. | |
virtual status_t | CreateRow (SString *name, const SValue &columns, uint32_t flags=0, sptr< INode > *createdRow=NULL) |
Create a new row in the table. | |
virtual status_t | RemoveColumn (const SString &name) |
Remove an existing column from the table. | |
virtual status_t | RemoveRow (const sptr< INode > &row) |
Remove an existing row from the table. | |
virtual SValue | Schema () const |
Return all information about columns. | |
ICatalog Implementation | |
virtual status_t | AddEntry (const SString &name, const SValue &entry) |
Add or modify an entry in the catalog. | |
virtual sptr< IDatum > | CreateDatum (SString *name, uint32_t flags, status_t *err) |
Create a new IDatum object inside of this catalog. | |
virtual sptr< INode > | CreateNode (SString *name, status_t *err) |
Create a new INode in this catalog. | |
virtual status_t | RemoveEntry (const SString &name) |
Remove an existing entry from the catalog. | |
virtual status_t | RenameEntry (const SString &entry, const SString &name) |
Change the name of an entry in the catalog. | |
Bookkeeping | |
Creation, destruction, locking, etc. | |
BSchemaTableNode (const SContext &context, const SDatabase &database, const SString &table, const SString &keyColumn=SString(), const SString &refPath=SString()) | |
SContext | Context () |
Disambiguate. | |
virtual void | InitAtom () |
Open and initialize the database. | |
virtual SValue | Inspect (const sptr< IBinder > &caller, const SValue &which, uint32_t flags) |
Make INode, IIterable, ITable, and IReferable accessible. | |
virtual lock_status_t | Lock () const |
Disambiguate. | |
status_t | StatusCheck () |
Returns initialization state of object, such as error code when opening database. | |
virtual void | Unlock () const |
Disambiguate. | |
virtual | ~BSchemaTableNode () |
Data Model Implementation | |
Provide default implementation based on new capabilities. | |
ssize_t | ColumnIndexOfLocked (const SString &entry) const |
Return the index for a column entry name in the table. | |
SString | ColumnNameAtLocked (size_t index) const |
Return the name of a column at a given index. | |
type_code | ColumnTypeAtLocked (size_t index) const |
Return the type of a column at a given index. | |
size_t | CountColumnsLocked () const |
Returns the total number of columns in the table. | |
SString | EntryNameForLocked (uint32_t rowID) const |
Return the name associated with a particular row ID. | |
virtual status_t | LookupEntry (const SString &entry, uint32_t flags, SValue *node) |
Implemented by calling LookupNode(). | |
virtual status_t | LookupNode (const SString &entry, sptr< RowNode > *outNode) |
Implemented by converting name to a rowID and then calling NodeForLocked(). | |
virtual void | MapSQLOrderColumn (SValue *inoutColumnName, SValue *inoutOrder) const |
Map custom columns to underlying database columns when sorting by them. | |
sptr< RowNode > | NodeForLocked (uint32_t rowID) |
Return INode object for a particular table row ID. | |
virtual void | ReportChangeAtLocked (size_t rowid, size_t col, const sptr< IBinder > &editor, uint32_t changes, off_t start=-1, off_t length=-1) |
Similar to BStreamDatum::ReportChangeLocked(), using same change flags. | |
bool | RowIDIsValidLocked (uint32_t rowID) const |
Return true if the given row ID exists in the table. | |
Object Generation | |
virtual sptr< GenericIterator > | NewGenericIterator (const SValue &args) |
Create and return a new iterator object. | |
virtual sptr< RowNode > | NewRowNodeLocked (uint32_t rowID) |
Called when a new row object needs to be created. | |
IReferable Implementation | |
virtual SString | Reference () const |
Official path to this object. | |
Configuration | |
Functions for customizing how the table is exposed. See the CustomColumn class for the API for adding new computed columns to the table. | |
SString | RowMimeTypeLocked () const |
Retrieve the MIME type of entries (row nodes). | |
virtual void | SetMimeType (const SString &value) |
By default, clients are not allowed to modify the MIME type. | |
status_t | StoreRowMimeTypeLocked (const SString &mimeType) |
Set the MIME type that all entries (row nodes) will report. | |
SString | TableName () const |
Return the name of this table. | |
Friends | |
class | CustomColumn |
class | DataAccessor |
class | QueryIterator |
class | RowNode |
Classes | |
struct | column_info |
struct | custom_column_info |
class | CustomColumn |
Base class for implementing custom column data in BSchemaTableNode. More... | |
class | DataAccessor |
Class providing direct access to BSchemaTableNode data. More... | |
class | QueryIterator |
Iterator over a BSchemaTableNode. More... | |
class | RowNode |
Node object generated for a row in BSchemaTableNode. More... |
|
|
|
|
|
Add a new column to the table.
Implements ITable. |
|
Add or modify an entry in the catalog.
The second reason for using this API is to add new types of objects to the catalog – if the SValue contains an IBinder object, the given object will be directly added as the new entry. This latter approach allows you to create places where the namespace crosses processes, mount new types of directories in the namespace, etc. Note, however, that many catalogs (such as one representing a filesystem) will not be able to host references to external objects. Contrast this with CreateNode() and CreateDatum(), which creates new entry objects that are owned and managed by the catalog.
Implements ICatalog. |
|
Return the index for a column entry name in the table. Returns B_ENTRY_NOT_FOUND if no column with the given name exists. |
|
Return the name of a column at a given index. The index must be in the range of [0..CountColumnsLocked()]. It does no bounds checking for you. |
|
Return set of column names.
Implements ITable. |
|
Return the type of a column at a given index. The index must be in the range of [0..CountColumnsLocked()]. It does no bounds checking for you. |
|
Disambiguate.
|
|
Returns the total number of columns in the table.
|
|
Create a new IDatum object inside of this catalog.
Note that the returned object may very well support other interfaces (including INode), however its main purpose is to hold data for you. Implements ICatalog. |
|
Create a new INode in this catalog.
This, along with CreateDatum(), is the mechanism you should normally use when entries in a particular catalog, because they allow the catalog to ensure that objects with the correct implementation are created. For example, if the catalog is on a filesystem, it will need to modify the filesystem data to hold the new structure and create and return a proxy object for the new entry it just created. Even in a generic catalog the use of this function is important, since it ensures objects are created in the same process as the parent directory. Consider, for example, an application that wishes to create a node with some data that will stay around after the application itself exits. Contrast this with AddEntry(), which if called with an IBinder object will place a reference to that object in the catalog. Implements ICatalog. |
|
Create a new row in the table.
Implements ITable. |
|
Return the name associated with a particular row ID.
|
|
Open and initialize the database.
Reimplemented from SAtom. |
|
Make INode, IIterable, ITable, and IReferable accessible.
Reimplemented from BnReferable. |
|
Disambiguate.
Reimplemented from BGenericIterable. |
|
Implemented by calling LookupNode().
Implements BGenericNode. |
|
Implemented by converting name to a rowID and then calling NodeForLocked().
|
|
Map custom columns to underlying database columns when sorting by them.
Reimplemented from SSQLBuilder. |
|
Create and return a new iterator object. Derived classes need to implement this to return their own GenericIterator subclass. Implements BGenericIterable. |
|
Called when a new row object needs to be created. The default implementation instantiates and returns a new IndexedDatum object. |
|
Return INode object for a particular table row ID.
|
|
Official path to this object. This property holds the canonical path at which you can find the object being queried. The returned path is always of the form "/some/path/to/me"; that is, SContext::Lookup() can be used to resolve the path back to the object.
Implements IReferable. |
|
Remove an existing column from the table.
Implements ITable. |
|
Remove an existing entry from the catalog.
Implements ICatalog. |
|
Remove an existing row from the table.
Implements ITable. |
|
Change the name of an entry in the catalog.
Implements ICatalog. |
|
Similar to BStreamDatum::ReportChangeLocked(), using same change flags. Also pushes the ITable change events. |
|
Return true if the given row ID exists in the table.
|
|
Retrieve the MIME type of entries (row nodes).
|
|
Return all information about columns.
Implements ITable. |
|
By default, clients are not allowed to modify the MIME type. To use the normal BMetaDataNode implementation, override this to call directly to BGenericNode::SetMimeType(). To change the MIME type yourself, you can call SetMimeTypeLocked(). Reimplemented from BGenericNode. |
|
Returns initialization state of object, such as error code when opening database.
|
|
Set the MIME type that all entries (row nodes) will report.
|
|
Return the name of this table.
|
|
Disambiguate.
Reimplemented from BGenericIterable. |
|
|
|
|
|
|
|
|