32 const ProviderInfo = <DataProviderInfo>{
33 "type":
"DbDataProvider",
34 "supports_read":
True,
35 "supports_bulk_read":
True,
36 "supports_children":
True,
37 "constructor_options": ConstructorOptions,
38 "search_options": SearchOptions,
41 "child_create_options": ChildCreateOptions,
42 "transaction_management":
True,
44 "record_requires_search_options":
True,
45 "supports_child_create":
True,
46 "supports_child_delete":
True,
50 const ConstructorOptions = {
51 "datasource": <DataProviderOptionInfo>{
53 AbstractDataProviderType::get(StringType),
54 AbstractDataProviderType::get(
new Type(
"AbstractDatasource")),
56 "desc":
"the datasource connection string or an abstract datasource object",
62 const SearchOptions = {
63 "sql": <DataProviderOptionInfo>{
64 "type": AbstractDataProviderType::get(StringType),
65 "desc":
"the raw SQL for the select statement",
68 "args": <DataProviderOptionInfo>{
69 "type": AbstractDataProviderType::get(AutoListType),
70 "desc":
"any bind arguments for the select statement",
75 const ChildCreateOptions = {
76 "primary_key": <DataProviderOptionInfo>{
77 "type": AbstractDataProviderType::get(
"softlist<string>"),
78 "desc":
"a list of column names for the primary key for the table; use `primary_key_name` to set the "
79 "name of the primary key constraint manually, otherwise a suitable name will be automatically "
82 "primary_key_name": <DataProviderOptionInfo>{
83 "type": AbstractDataProviderType::get(StringType),
84 "desc":
"the name of the primary key constraint; only used if `primary_key` is set",
86 "indexes": <DataProviderOptionInfo>{
88 "desc":
"a hash of indexes keyed by index name",
90 "foreign_constraints": <DataProviderOptionInfo>{
92 "desc":
"a hash of foreign constraints keyed by foreign constraint name",
184 *hash<auto> where_cond, *hash<auto> search_options) {
195 AbstractDataProviderRecordIterator
searchRecordsImpl(__7_ hash<auto> where_cond, __7_ hash<auto> search_options);
239 *hash<auto> child_create_options) {
240 hash<auto> table_desc = makeTableDesc(name, fields, child_create_options);
241 AbstractTable table = db.makeTable(name, table_desc);
242 DbTableTransactionHelper th(table);
275 static AbstractTable
getTable(
string ds_string,
string table_string);
278 static AbstractTable
getTable(AbstractDatasource ds,
string table_string);
281 static hash<GenericColumnInfo>
getColumnDesc(AbstractDatabase db, AbstractDataField field, __7_ hash<auto> opts);
286 hash<auto>
makeTableDesc(
string name, hash<string, AbstractDataField> fields, __7_ hash<auto> opts);
__7_ list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
static __7_ code datasource_lookup
Lookup to get an abstract datasource from a name.
Definition: DbDataProvider.qc.dox.h:101
static AbstractTable getTable(string ds_string, string table_string)
Returns an AbstractTable object from the given datasource and table strings.
beginTransaction()
Begins a transaction in the datasource.
commit()
Commits any transaction in progress in the datasource.
__7_ string getDesc()
Returns the data provider description.
AbstractDataProviderRecordIterator searchRecordsImpl(__7_ hash< auto > where_cond, __7_ hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
hash< auto > makeTableDesc(string name, hash< string, AbstractDataField > fields, __7_ hash< auto > opts)
Returns a table description hash from a field description.
AbstractDatabase db
The database object.
Definition: DbDataProvider.qc.dox.h:98
static AbstractTable getTable(AbstractDatasource ds, string table_string)
Returns an AbstractTable object from the given datasource and table arguments.
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.
Definition: DbDataProvider.qc.dox.h:238
static setDatasourceLookup(code datasource_lookup)
Sets the datasource lookup.
static AbstractDatasource getDatasource(AbstractDatasource ds)
Returns the given AbstractDatasource object.
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
deleteChildProviderImpl(string name, __7_ hash< auto > child_delete_options)
Deletes a child data provider.
__7_ AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
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.
Definition: DbDataProvider.qc.dox.h:183
constructor(AbstractDatasource ds, __7_ hash< auto > opts)
creates the object
static hash< GenericColumnInfo > getColumnDesc(AbstractDatabase db, AbstractDataField field, __7_ hash< auto > opts)
Returns a column description hash for a field.
__7_ list< hash< DataProviderSummaryInfo > > getChildProviderSummaryInfo()
Return data provider summary info.
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.
string getName()
Returns the data provider name.
static __7_ code table_lookup
Lookup to get an abstract table from a datasource and a name.
Definition: DbDataProvider.qc.dox.h:104
constructor(AbstractDatabase db)
creates the object
static setTableLookup(code table_lookup)
Sets the table lookup.
__7_ hash< string, AbstractDataField > getRecordTypeImpl(__7_ hash< auto > search_options)
Returns the description of the record type, if any.
constructor(__7_ hash< auto > options)
Creates the object from constructor options.
rollback()
Rolls back any transaction in progress in the datasource.
The type definition for foreign constraints.
Definition: DbForeignConstraintsDataType.qc.dox.h:4
The type definition for DB indexes.
Definition: DbIndexesDataType.qc.dox.h:4
Defines the record iterator class for Table-based iterators.
Definition: DbSelectBulkRecordInterface.qc.dox.h:28
Defines a data provider based on a single SQL table.
Definition: DbTableDataProvider.qc.dox.h:28
Qore AbstractDbRecordIterator class definition.
Definition: AbstractDbRecordIterator.qc.dox.h:26