39 "type":
"DbTableDataProvider",
40 "supports_read":
True,
41 "supports_create":
True,
42 "supports_update":
True,
43 "supports_upsert":
True,
44 "supports_delete":
True,
45 "supports_native_search":
True,
46 "supports_bulk_read":
True,
47 "supports_bulk_create":
True,
48 "supports_bulk_upsert":
True,
49 "supports_children":
False,
54 "transaction_management":
True,
61 "sequence": <MapperRuntimeKeyInfo>{
62 "desc":
"names the DB sequence that will be used to populate the field",
63 "value_type":
"string",
65 "returns_type":
"int",
67 "sequence_currval": <MapperRuntimeKeyInfo>{
68 "desc":
"names the DB sequence that will be used to populate the field; the current value of the " 69 "sequence is used; will not increment the sequence",
70 "value_type":
"string",
72 "returns_type":
"int",
78 "datasource": <DataProviderOptionInfo>{
80 AbstractDataProviderType::get(StringType),
81 AbstractDataProviderType::get(
new Type(
"AbstractDatasource")),
83 "desc":
"the datasource connection string or an abstract datasource object; in case a connection " 84 "string is given, then the \"table\" option also needs to be given as a string",
86 "table": <DataProviderOptionInfo>{
88 AbstractDataProviderType::get(StringType),
89 AbstractDataProviderType::get(
new Type(
"AbstractTable")),
92 "desc":
"the table name or table object; if a table string is provided, then the \"datasource\" " 93 "option must also be provided",
99 "returning": <DataProviderOptionInfo>{
100 "type": AbstractDataProviderType::get(AbstractDataProviderType::anyType),
101 "desc":
"a string (giving the output name) or a hash describing the return parameters for an insert; " 102 "a hash will have the following keys: 'key': (required) the column name to return, and 'type' " 103 "(optional) the data type for the output placeholder buffer (ex: 'number')",
109 "upsert_strategy": <DataProviderOptionInfo>{
110 "type": AbstractDataProviderType::get(StringType),
111 "desc":
"providers the upsert strategy; 'UpsertInsertFirst': try to insert first, if it fails, try " 112 "updating; 'UpsertUpdateFirst': try to update first, if it fails, try inserting; " 113 "'UpsertSelectFirst': try to select first, if it fails, insert, if it succeeds, update if " 114 "necessary; 'UpsertInsertOnly': only insert, never update, 'UpsertUpdateOnly': only update, " 115 "never insert; 'UpsertAuto' (the default) use the most efficient upsert for the underlying DB",
117 "omit_update": <DataProviderOptionInfo>{
118 "type": AbstractDataProviderType::get(
new Type(
"softlist<string>")),
119 "desc":
"allows for an asymmetrical upsert where a set of column values is inserted, but a smaller " 120 "set is updated in case the unique key values are present in the target table; the value of this " 121 "option should be set to the columns to omit in the update clause",
127 "columns": <DataProviderOptionInfo>{
128 "type": AbstractDataProviderType::get(AbstractDataProviderType::anyType),
129 "desc":
"column argument for the select expression",
131 "limit": <DataProviderOptionInfo>{
132 "type": AbstractDataProviderType::get(IntType),
133 "desc":
"the maximum number of records to return",
135 "offset": <DataProviderOptionInfo>{
136 "type": AbstractDataProviderType::get(IntType),
137 "desc":
"the offset number in records to return",
139 "groupby": <DataProviderOptionInfo>{
140 "type":
new QoreListDataType(
new Type(
"softlist<auto>")),
141 "desc":
"group by argument for the select expression",
143 "having": <DataProviderOptionInfo>{
144 "type": AbstractDataProviderType::get(AutoHashType),
145 "desc":
"having argument for the select expression",
147 "orderby": <DataProviderOptionInfo>{
148 "type":
new QoreListDataType(
new Type(
"softlist<string>")),
149 "desc":
"order by argument for the select expression",
151 "forupdate": <DataProviderOptionInfo>{
152 "type": AbstractDataProviderType::get(SoftBoolType),
153 "desc":
"uses FOR UPDATE with the query to lock records selected",
282 AbstractDataProviderBulkRecordInterface
searchRecordsBulkImpl(
int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
325 int updateRecordsImpl(hash<auto> set, *hash<auto> where_cond, *hash<auto> search_options);
AbstractDataProviderBulkOperation getBulkInserter()
Returns a bulk insert operation object for the data provider.
Defines the record iterator class for Table-based iterators.
Definition: DbTableRecordIterator.qc.dox.h:34
int doSequenceKey(string sequence_name)
Processes the sequence runtime key in mappers.
const UpsertResultUpdated
int doSequenceCurrvalKey(string sequence_name)
Processes the sequence_currval runtime key in mappers.
Mutex db_lock()
lock for "db"
const ProviderInfo
Provider info.
Definition: DbTableDataProvider.qc.dox.h:38
const UpsertResultDeleted
int updateRecordsImpl(hash< auto > set, *hash< auto > where_cond, *hash< auto > search_options)
Updates zero or more records matching the search options.
const UpsertResultInserted
*hash< string, hash< MapperRuntimeKeyInfo > > getMapperRuntimeKeys()
Returns custom data mapper runtime keys.
Defines a data provider based on a single SQL table.
Definition: DbTableDataProvider.qc.dox.h:34
commit()
Commits data written to the data provider.
int deleteRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Deletes zero or more records.
const MapperKeyInfo
Mapper runtime key info.
Definition: DbTableDataProvider.qc.dox.h:60
const SearchOptions
Search options.
Definition: DbTableDataProvider.qc.dox.h:126
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
bool requiresTransactionManagement()
Returns True if the data provider supports transaction management.
string upsertRecordImpl(hash< auto > rec, *hash< auto > upsert_options)
Upserts the given record to the data provider.
*AbstractDataProvider getChildProviders()
Returns child providers; return NOTHING if there are no child providers.
const UpsertResultUnchanged
const UpsertOptions
Upsert options.
Definition: DbTableDataProvider.qc.dox.h:108
AbstractDatabase db
the database object, if required
Definition: DbTableDataProvider.qc.dox.h:171
AbstractTable table
the table
Definition: DbTableDataProvider.qc.dox.h:168
*hash< string, AbstractDataField > getRecordTypeImpl(*hash< auto > search_options)
Returns the description of the record type, if any.
const DbUpsertMap
Maps SqlUtil Upsert Result Codes to DB Provider Upsert Result Codes.
Definition: DbTableDataProvider.qc.dox.h:158
*hash< auto > searchSingleRecordImpl(hash< auto > where_cond, *hash< auto > search_options)
Returns a single record matching the search options.
rollback()
Rolls back data written to the data provider.
*hash< auto > createRecordImpl(hash< auto > rec, *hash< auto > create_options)
Writes the given record to the data provider.
DbTableRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
string getName()
Returns the data provider name.
const CreateOptions
Create options.
Definition: DbTableDataProvider.qc.dox.h:98
constructor(AbstractTable table)
Creates the object.
bool updateSingleRecordImpl(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates a single record matching the search options.
Qore AbstractDbRecordIterator class definition.
Definition: AbstractDbRecordIterator.qc.dox.h:32
AbstractDataProviderBulkOperation getBulkUpserter()
Returns a bulk upsert operation object for the data provider.
const ConstructorOptions
Constructor options.
Definition: DbTableDataProvider.qc.dox.h:77
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.
const UpsertResultVerified