DbDataProvider.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
// minimum required Qore version
// assume local scope for variables, do not use "$" signs
// require type definitions everywhere
// enable all warnings
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,
"transaction_management": True,
"has_record": True,
"record_requires_search_options": True,
};
const ConstructorOptions = {
"datasource": <DataProviderOptionInfo>{
"type": (
AbstractDataProviderType::get(StringType),
AbstractDataProviderType::get(new Type("AbstractDatasource")),
),
"desc": "the datasource connection string or an abstract datasource object",
},
"database": <DataProviderOptionInfo>{
"type": AbstractDataProviderType::get(new Type("AbstractDatabase")),
"desc": "the database for the object",
},
};
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",
},
};
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();
commit();
rollback();
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:
protected:
*list<string> getChildProviderNamesImpl();
public:
protected:
*AbstractDataProvider getChildProviderImpl(string name);
public:
protected:
hash<DataProviderInfo> getStaticInfoImpl();
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);
};
};
DbDataProvider::DbDataProvider::rollback
rollback()
Rolls back any transaction in progress in the datasource.
DbDataProvider::DbDataProvider::getName
string getName()
Returns the data provider name.
DbDataProvider::DbDataProvider::commit
commit()
Commits any transaction in progress in the datasource.
DbDataProvider::DbDataProvider::setTableLookup
static setTableLookup(code table_lookup)
Sets the table lookup.
DbDataProvider::DbDataProvider::constructor
constructor(AbstractDatasource ds, *hash< auto > opts)
creates the object
DbDataProvider::DbDataProvider::datasource_lookup
static *code datasource_lookup
Lookup to get an abstract datasource from a name.
Definition: DbDataProvider.qc.dox.h:85
DbDataProvider::DbDataProvider::getRecordTypeImpl
*hash< string, AbstractDataField > getRecordTypeImpl(*hash< auto > search_options)
Returns the description of the record type, if any.
DbDataProvider::DbDataProvider::getDatasource
static AbstractDatasource getDatasource(string ds_string)
Returns an AbstractDatasource object from the given string.
True
const True
DbDataProvider::DbDataProvider::getTable
static AbstractTable getTable(AbstractDatasource ds, string table_string)
Returns an AbstractTable object from the given datasource and table arguments.
NOTHING
const NOTHING
DbDataProvider::DbDataProvider::getStaticInfoImpl
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
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:88
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::getRecordTypeFromDescribeHash
static *hash< string, AbstractDataField > getRecordTypeFromDescribeHash(hash< auto > describe_hash)
Returns the record type description from a describe hash.
DbDataProvider::DbDataProvider::db
AbstractDatabase db
The database object.
Definition: DbDataProvider.qc.dox.h:82
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::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::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::getChildProviderImpl
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
DbDataProvider::DbDataProvider::getChildProviderNamesImpl
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
DbDataProvider
Qore AbstractDbRecordIterator class definition.
Definition: AbstractDbRecordIterator.qc.dox.h:32
DbDataProvider::DbDataProvider::constructor
constructor(AbstractDatabase db)
creates the object
DbDataProvider::DbDataProvider::constructor
constructor(*hash< auto > options)
Creates the object from constructor options.