Qore DbDataProvider Module Reference  2.0
DbDataProvider::DbDataProvider Class Reference

The database data provider class, provides tables as children. More...

Inherits AbstractDataProvider.

Public Member Functions

 beginTransaction ()
 Begins a transaction in the datasource. More...
 
 commit ()
 Commits any transaction in progress in the datasource. More...
 
 constructor (__7_ hash< auto > options)
 Creates the object from constructor options.
 
 constructor (AbstractDatabase db)
 creates the object
 
 constructor (AbstractDatasource ds, __7_ hash< auto > opts)
 creates the object
 
private 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. More...
 
__7_ list< hash< DataProviderSummaryInfo > > getChildProviderSummaryInfo ()
 Return data provider summary info.
 
__7_ string getDesc ()
 Returns the data provider description.
 
string getName ()
 Returns the data provider name.
 
hash< auto > makeTableDesc (string name, hash< string, AbstractDataField > fields, __7_ hash< auto > opts)
 Returns a table description hash from a field description. More...
 
 rollback ()
 Rolls back any transaction in progress in the datasource. More...
 
private 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. More...
 

Static Public Member Functions

static hash< GenericColumnInfo > getColumnDesc (AbstractDatabase db, AbstractDataField field, __7_ hash< auto > opts)
 Returns a column description hash for a field.
 
static AbstractDatasource getDatasource (AbstractDatasource ds)
 Returns the given AbstractDatasource object.
 
static AbstractDatasource getDatasource (string ds_string)
 Returns an AbstractDatasource object from the given string.
 
static __7_ hash< string, AbstractDataField > getRecordTypeFromDescribeHash (hash< auto > describe_hash)
 Returns the record type description from a describe hash. More...
 
static AbstractTable getTable (AbstractDatasource ds, string table_string)
 Returns an AbstractTable object from the given datasource and table arguments.
 
static AbstractTable getTable (string ds_string, string table_string)
 Returns an AbstractTable object from the given datasource and table strings.
 
static setDatasourceLookup (code datasource_lookup)
 Sets the datasource lookup.
 
static setTableLookup (code table_lookup)
 Sets the table lookup.
 

Public Attributes

const ChildCreateOptions
 Child provider creation options.
 
const ConstructorOptions
 Constructor options.
 
const ProviderInfo
 Provider info.
 
const SearchOptions
 Search options.
 

Protected Member Functions

 deleteChildProviderImpl (string name, __7_ hash< auto > child_delete_options)
 Deletes a child data provider. More...
 
__7_ AbstractDataProvider getChildProviderImpl (string name)
 Returns the given child provider or NOTHING if the given child is unknown. More...
 
__7_ list< stringgetChildProviderNamesImpl ()
 Returns a list of child data provider names, if any. More...
 
__7_ hash< string, AbstractDataField > getRecordTypeImpl (__7_ hash< auto > search_options)
 Returns the description of the record type, if any. More...
 
hash< DataProviderInfo > getStaticInfoImpl ()
 Returns data provider static info.
 
AbstractDataProviderRecordIterator searchRecordsImpl (__7_ hash< auto > where_cond, __7_ hash< auto > search_options)
 Returns an iterator for zero or more records matching the search options. More...
 

Protected Attributes

AbstractDatabase db
 The database object.
 

Static Protected Attributes

static __7_ code datasource_lookup
 Lookup to get an abstract datasource from a name.
 
static __7_ code table_lookup
 Lookup to get an abstract table from a datasource and a name.
 

Detailed Description

The database data provider class, provides tables as children.

Member Function Documentation

◆ beginTransaction()

DbDataProvider::DbDataProvider::beginTransaction ( )

Begins a transaction in the datasource.

See also
:
Since
DbDataProvider 1.0.1

◆ commit()

DbDataProvider::DbDataProvider::commit ( )

Commits any transaction in progress in the datasource.

See also
:

◆ createChildProviderImpl()

private AbstractDataProvider DbDataProvider::DbDataProvider::createChildProviderImpl ( string  name,
hash< string, AbstractDataField >  fields,
*hash< auto >  child_create_options 
)
inline

Creates a new child data provider and returns it after adding as a child.

Parameters
namethe name of the new child data provider
fieldsthe fields for the new child data provider
child_create_optionsthe options for creating the new child data provider
Returns
the new child data provider
Since
DataProvider 2.0

◆ deleteChildProviderImpl()

DbDataProvider::DbDataProvider::deleteChildProviderImpl ( string  name,
__7_ hash< auto >  child_delete_options 
)
protected

Deletes a child data provider.

Parameters
namethe name of the new child data provider
child_delete_optionsthe options for deleting a child data provider
Exceptions
DELETE-CHILD-PROVIDER-ERRORerror dropping the child data provider
Since
DataProvider 2.0

◆ getChildProviderImpl()

__7_ AbstractDataProvider DbDataProvider::DbDataProvider::getChildProviderImpl ( string  name)
protected

Returns the given child provider or NOTHING if the given child is unknown.

Returns
the given child provider or NOTHING if the given child is unknown
Exceptions
CHILD-PROVIDER-ERRORerror acquiring child provider
See also
getChildProviderEx()

◆ getChildProviderNamesImpl()

__7_ list<string> DbDataProvider::DbDataProvider::getChildProviderNamesImpl ( )
protected

Returns a list of child data provider names, if any.

Returns
a list of child data provider names, if any

◆ getRecordTypeFromDescribeHash()

static __7_ hash<string, AbstractDataField> DbDataProvider::DbDataProvider::getRecordTypeFromDescribeHash ( hash< auto >  describe_hash)
static

Returns the record type description from a describe hash.

Parameters
describe_hasha hash as returned by AbstractSQLStatement::describe()
Returns
the record type of the query results

◆ getRecordTypeImpl()

__7_ hash<string, AbstractDataField> DbDataProvider::DbDataProvider::getRecordTypeImpl ( __7_ hash< auto >  search_options)
protected

Returns the description of the record type, if any.

Parameters
search_optionsto be included and processed by validateSearchOptions() if recordRequiresSearchOptions() is True for this provider, otherwise any value provided in this argument is ignored

◆ makeTableDesc()

hash<auto> DbDataProvider::DbDataProvider::makeTableDesc ( string  name,
hash< string, AbstractDataField >  fields,
__7_ hash< auto >  opts 
)

Returns a table description hash from a field description.

Exceptions
TABLE-DESC-ERRORerror in table description

◆ rollback()

DbDataProvider::DbDataProvider::rollback ( )

Rolls back any transaction in progress in the datasource.

See also
:

◆ searchRecordsBulkImpl()

private AbstractDataProviderBulkRecordInterface DbDataProvider::DbDataProvider::searchRecordsBulkImpl ( int  block_size = 1000,
*hash< auto >  where_cond,
*hash< auto >  search_options 
)
inline

Returns an iterator for zero or more records matching the search options.

Parameters
block_sizethe number of records in a read block; must be a positive number
where_condthe search criteria after processing by processFieldValues()
search_optionsthe search options after processing by validateSearchOptions()
Exceptions
INVALID-BLOCK-SIZEthe block size must be a positive number
INVALID-OPERATIONthe data provider does not support reading

◆ searchRecordsImpl()

AbstractDataProviderRecordIterator DbDataProvider::DbDataProvider::searchRecordsImpl ( __7_ hash< auto >  where_cond,
__7_ hash< auto >  search_options 
)
protected

Returns an iterator for zero or more records matching the search options.

Parameters
where_condthe search criteria
search_optionsthe search options after processing by validateSearchOptions()
See also
requestSearchRecordsImpl()