Loading...
Searching...
No Matches
DbDataProvider.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
namespace DbDataProvider {
class DbDataProvider : public AbstractDataProvider {
public:
const ProviderInfo = <DataProviderInfo>{
"type": "DbDataProvider",
"supports_read": True,
"supports_bulk_read": True,
"supports_children": True,
"constructor_options": ConstructorOptions,
"search_options": SearchOptions,
"create_options": NOTHING,
"upsert_options": NOTHING,
"child_create_options": ChildCreateOptions,
"supports_search_expressions": True,
"expressions": AbstractDataProvider::GenericExpressions,
"transaction_management": True,
"has_record": True,
"record_requires_search_options": True,
"supports_child_create": True,
"supports_child_delete": True,
"children_can_support_apis": False,
"children_can_support_records": True,
"children_can_support_transactions": True,
};
const MapperKeyInfo = Mapper::MapperKeyInfo + {
"sequence": <MapperRuntimeKeyInfo>{
"desc": "names the DB sequence that will be used to populate the field",
"value_type": "string",
"unique_roles": "*",
"returns_type": "int",
},
"sequence_currval": <MapperRuntimeKeyInfo>{
"desc": "names the DB sequence that will be used to populate the field; the current value of the "
"sequence is used; will not increment the sequence",
"value_type": "string",
"unique_roles": "*",
"returns_type": "int",
},
};
const ConstructorOptions = {
"datasource": <DataProviderOptionInfo>{
"type": (
AbstractDataProviderType::get(StringType),
AbstractDataProviderType::get(new Type("AbstractDatasource")),
),
"desc": "the datasource connection string or an abstract datasource object",
"required": True,
},
};
const SearchOptions = {
"sql": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the raw SQL for the select statement",
"required": True,
},
"args": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(AutoListType),
"desc": "any bind arguments for the select statement",
},
};
const ChildCreateOptions = {
"primary_key": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get("softlist<string>"),
"desc": "a list of column names for the primary key for the table; use `primary_key_name` to set the "
"name of the primary key constraint manually, otherwise a suitable name will be automatically "
"generated",
},
"primary_key_name": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(StringType),
"desc": "the name of the primary key constraint; only used if `primary_key` is set",
},
"indexes": <DataProviderOptionInfo>{
"type": new DbIndexesDataType(),
"desc": "a hash of indexes keyed by index name",
},
"foreign_constraints": <DataProviderOptionInfo>{
"type": new DbForeignConstraintsDataType(),
"desc": "a hash of foreign constraints keyed by foreign constraint name",
},
};
protected:
AbstractDatabase db;
static *code datasource_lookup;
static *code table_lookup;
public:
constructor(AbstractDatasource ds, *hash<auto> opts);
constructor(AbstractDatabase db);
constructor(*hash<auto> options);
string getName();
*string getDesc();
beginTransaction();
commit();
rollback();
*hash<string, hash<MapperRuntimeKeyInfo>> getMapperRuntimeKeys();
int doSequenceKey(string sequence_name, hash<auto> ctx, *reference<bool> missing_input);
int doSequenceCurrvalKey(string sequence_name, hash<auto> ctx, *reference<bool> missing_input);
static *hash<string, AbstractDataField> getRecordTypeFromDescribeHash(hash<auto> describe_hash);
protected:
*hash<string, AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
public:
protected:
AbstractDataProviderBulkRecordInterface searchRecordsBulkImpl(int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
public:
protected:
AbstractDataProviderRecordIterator searchRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
public:
*list<hash<DataProviderSummaryInfo>> getChildProviderSummaryInfo();
protected:
*list<string> getChildProviderNamesImpl();
public:
protected:
*AbstractDataProvider getChildProviderImpl(string name);
public:
protected:
hash<DataProviderInfo> getStaticInfoImpl();
public:
protected:
AbstractDataProvider createChildProviderImpl(string name, hash<string, AbstractDataField> fields, *hash<auto> child_create_options);
public:
protected:
deleteChildProviderImpl(string name, *hash<auto> child_delete_options);
public:
static setDatasourceLookup(code datasource_lookup);
static setTableLookup(code table_lookup);
static AbstractDatasource getDatasource(AbstractDatasource ds);
static AbstractDatasource getDatasource(string ds_string);
static AbstractTable getTable(string ds_string, string table_string);
static AbstractTable getTable(AbstractDatasource ds, string table_string);
static hash<GenericColumnInfo> getColumnDesc(AbstractDatabase db, AbstractDataField field, *hash<auto> opts);
hash<auto> makeTableDesc(string name, hash<string, AbstractDataField> fields, *hash<auto> opts);
};
};
DbDataProvider::DbDataProvider::datasource_lookup
static *code datasource_lookup
Lookup to get an abstract datasource from a name.
Definition: DbDataProvider.qc.dox.h:131
DbDataProvider::DbDataProvider::getTable
static AbstractTable getTable(string ds_string, string table_string)
Returns an AbstractTable object from the given datasource and table strings.
DbDataProvider::DbDataProvider::beginTransaction
beginTransaction()
Begins a transaction in the datasource.
DbDataProvider::DbDataProvider::commit
commit()
Commits any transaction in progress in the datasource.
DbDataProvider::DbDataProvider::getRecordTypeFromDescribeHash
static *hash< string, AbstractDataField > getRecordTypeFromDescribeHash(hash< auto > describe_hash)
Returns the record type description from a describe hash.
DbDataProvider::DbDataProvider::searchRecordsBulkImpl
AbstractDataProviderBulkRecordInterface searchRecordsBulkImpl(int block_size=1000, *hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
DbDataProvider::DbDataProvider::getDesc
*string getDesc()
Returns the data provider description.
DbDataProvider::DbDataProvider::getMapperRuntimeKeys
*hash< string, hash< MapperRuntimeKeyInfo > > getMapperRuntimeKeys()
Returns custom data mapper runtime keys.
DbDataProvider::DbDataProvider::searchRecordsImpl
AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
DbDataProvider::DbDataProvider::db
AbstractDatabase db
The database object.
Definition: DbDataProvider.qc.dox.h:128
DbDataProvider::DbDataProvider::getTable
static AbstractTable getTable(AbstractDatasource ds, string table_string)
Returns an AbstractTable object from the given datasource and table arguments.
DbDataProvider::DbDataProvider::doSequenceKey
int doSequenceKey(string sequence_name, hash< auto > ctx, *reference< bool > missing_input)
Processes the sequence runtime key in mappers as a mapper key handler.
DbDataProvider::DbDataProvider::getColumnDesc
static hash< GenericColumnInfo > getColumnDesc(AbstractDatabase db, AbstractDataField field, *hash< auto > opts)
Returns a column description hash for a field.
DbDataProvider::DbDataProvider::setDatasourceLookup
static setDatasourceLookup(code datasource_lookup)
Sets the datasource lookup.
DbDataProvider::DbDataProvider::getDatasource
static AbstractDatasource getDatasource(AbstractDatasource ds)
Returns the given AbstractDatasource object.
DbDataProvider::DbDataProvider::deleteChildProviderImpl
deleteChildProviderImpl(string name, *hash< auto > child_delete_options)
Deletes a child data provider.
DbDataProvider::DbDataProvider::getChildProviderImpl
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
DbDataProvider::DbDataProvider::constructor
constructor(AbstractDatasource ds, *hash< auto > opts)
creates the object
DbDataProvider::DbDataProvider::getChildProviderNamesImpl
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
DbDataProvider::DbDataProvider::doSequenceCurrvalKey
int doSequenceCurrvalKey(string sequence_name, hash< auto > ctx, *reference< bool > missing_input)
Processes the sequence_currval runtime key in mappers as a mapper key handler.
DbDataProvider::DbDataProvider::makeTableDesc
hash< auto > makeTableDesc(string name, hash< string, AbstractDataField > fields, *hash< auto > opts)
Returns a table description hash from a field description.
DbDataProvider::DbDataProvider::getDatasource
static AbstractDatasource getDatasource(string ds_string)
Returns an AbstractDatasource object from the given string.
DbDataProvider::DbDataProvider::getName
string getName()
Returns the data provider name.
DbDataProvider::DbDataProvider::table_lookup
static *code table_lookup
Lookup to get an abstract table from a datasource and a name.
Definition: DbDataProvider.qc.dox.h:134
DbDataProvider::DbDataProvider::constructor
constructor(AbstractDatabase db)
creates the object
DbDataProvider::DbDataProvider::getRecordTypeImpl
*hash< string, AbstractDataField > getRecordTypeImpl(*hash< auto > search_options)
Returns the description of the record type, if any.
DbDataProvider::DbDataProvider::setTableLookup
static setTableLookup(code table_lookup)
Sets the table lookup.
DbDataProvider::DbDataProvider::getStaticInfoImpl
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
DbDataProvider::DbDataProvider::createChildProviderImpl
AbstractDataProvider createChildProviderImpl(string name, hash< string, AbstractDataField > fields, *hash< auto > child_create_options)
Creates a new child data provider and returns it after adding as a child.
DbDataProvider::DbDataProvider::getChildProviderSummaryInfo
*list< hash< DataProviderSummaryInfo > > getChildProviderSummaryInfo()
Return data provider summary info.
DbDataProvider::DbDataProvider::constructor
constructor(*hash< auto > options)
Creates the object from constructor options.
DbDataProvider::DbDataProvider::rollback
rollback()
Rolls back any transaction in progress in the datasource.
DbDataProvider::DbForeignConstraintsDataType
The type definition for foreign constraints.
Definition: DbForeignConstraintsDataType.qc.dox.h:28
DbDataProvider::DbIndexesDataType
The type definition for DB indexes.
Definition: DbIndexesDataType.qc.dox.h:28
DbDataProvider
Qore AbstractDbRecordIterator class definition.
Definition: AbstractDbRecordIterator.qc.dox.h:26