33 "type":
"DbTableDataProvider",
34 "supports_read": True,
35 "supports_create": True,
36 "supports_update": True,
37 "supports_upsert": True,
38 "supports_delete": True,
39 "supports_native_search": True,
40 "supports_bulk_read": True,
41 "supports_bulk_create": True,
42 "supports_bulk_upsert": True,
43 "supports_children": False,
44 "supports_add_field": True,
45 "supports_update_field": True,
46 "supports_delete_field": True,
47 "supports_search_expressions": True,
52 "expressions": (AbstractDataProvider::GenericExpressions - DP_SEARCH_OP_REGEX) + {
53 OP_LIKE: <DataProviderExpressionInfo>{
58 "desc":
"The SQL 'like' operator",
59 "args": (DataProviderSignatureStringType, DataProviderSignatureStringValueType),
60 "return_type": AbstractDataProviderTypeMap.
"bool",
63 "transaction_management": True,
75 "sequence": <MapperRuntimeKeyInfo>{
76 "desc":
"names the DB sequence that will be used to populate the field",
77 "value_type":
"string",
79 "returns_type":
"int",
81 "sequence_currval": <MapperRuntimeKeyInfo>{
82 "desc":
"names the DB sequence that will be used to populate the field; the current value of the "
83 "sequence is used; will not increment the sequence",
84 "value_type":
"string",
86 "returns_type":
"int",
92 "datasource": <DataProviderOptionInfo>{
94 AbstractDataProviderType::get(StringType),
95 AbstractDataProviderType::get(
new Type(
"AbstractDatasource")),
97 "desc":
"the datasource connection string or an abstract datasource object; in case a connection "
98 "string is given, then the \"table\" option also needs to be given as a string",
100 "table": <DataProviderOptionInfo>{
102 AbstractDataProviderType::get(StringType),
103 AbstractDataProviderType::get(
new Type(
"AbstractTable")),
106 "desc":
"the table name or table object; if a table string is provided, then the \"datasource\" "
107 "option must also be provided",
122 "returning": <DataProviderOptionInfo>{
123 "type": AbstractDataProviderType::get(AbstractDataProviderType::anyType),
124 "desc":
"a string (giving the output name) or a hash describing the return parameters for an insert; "
125 "a hash will have the following keys: 'key': (required) the column name to return, and 'type' "
126 "(optional) the data type for the output placeholder buffer (ex: 'number')",
139 "upsert_strategy": <DataProviderOptionInfo>{
140 "type": AbstractDataProviderType::get(StringType),
141 "desc":
"providers the upsert strategy; 'UpsertInsertFirst': try to insert first, if it fails, try "
142 "updating; 'UpsertUpdateFirst': try to update first, if it fails, try inserting; "
143 "'UpsertSelectFirst': try to select first, if it fails, insert, if it succeeds, update if "
144 "necessary; 'UpsertInsertOnly': only insert, never update, 'UpsertUpdateOnly': only update, "
145 "never insert; 'UpsertAuto' (the default) use the most efficient upsert for the underlying DB",
147 "omit_update": <DataProviderOptionInfo>{
148 "type": AbstractDataProviderType::get(
new Type(
"softlist<string>")),
149 "desc":
"allows for an asymmetrical upsert where a set of column values is inserted, but a smaller "
150 "set is updated in case the unique key values are present in the target table; the value of this "
151 "option should be set to the columns to omit in the update clause",
180 "columns": <DataProviderOptionInfo>{
181 "type": AbstractDataProviderType::get(AbstractDataProviderType::anyType),
182 "desc":
"column argument for the select expression",
184 "limit": <DataProviderOptionInfo>{
185 "type": AbstractDataProviderType::get(IntType),
186 "desc":
"the maximum number of records to return",
188 "offset": <DataProviderOptionInfo>{
189 "type": AbstractDataProviderType::get(IntType),
190 "desc":
"the offset number in records to return",
192 "groupby": <DataProviderOptionInfo>{
193 "type":
new QoreListDataType(
new Type(
"softlist<auto>")),
194 "desc":
"group by argument for the select expression",
196 "having": <DataProviderOptionInfo>{
197 "type": AbstractDataProviderType::get(AutoHashType),
198 "desc":
"having argument for the select expression",
200 "orderby": <DataProviderOptionInfo>{
201 "type":
new QoreListDataType(
new Type(
"softlist<string>")),
202 "desc":
"order by argument for the select expression",
204 "forupdate": <DataProviderOptionInfo>{
205 "type": AbstractDataProviderType::get(SoftBoolType),
206 "desc":
"uses FOR UPDATE with the query to lock records selected",
212 AbstractTable::UR_Inserted: UpsertResultInserted,
213 AbstractTable::UR_Verified: UpsertResultVerified,
214 AbstractTable::UR_Updated: UpsertResultUpdated,
215 AbstractTable::UR_Unchanged: UpsertResultUnchanged,
216 AbstractTable::UR_Deleted: UpsertResultDeleted,
310 int doSequenceKey(
string sequence_name, hash<auto> ctx, *reference<bool> missing_input);
369 AbstractDataProviderBulkRecordInterface
searchRecordsBulkImpl(
int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
462 updateFieldImpl(
string name, AbstractDataField field, *hash<auto> field_update_options);
Defines a data provider based on a single SQL table.
Definition: DbTableDataProvider.qc.dox.h:28
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.
execDdlSql(list< auto > sqll)
Executes the given DDL SQL string list.
int doSequenceKey(string sequence_name, hash< auto > ctx, *reference< bool > missing_input)
Processes the sequence runtime key in mappers as a mapper key handler.
addFieldImpl(AbstractDataField field, *hash< auto > field_add_options)
Creates a new field.
*string getDesc()
Returns the data provider description.
string getName()
Returns the data provider name.
*AbstractDataProvider getChildProviders()
Returns child providers; return NOTHING if there are no child providers.
beginTransaction()
Begins a transaction in the datasource underlying the table.
Mutex db_lock()
lock for "db"
const MapperKeyInfo
Mapper runtime key info; see details below.
Definition: DbTableDataProvider.qc.dox.h:74
const DbUpsertMap
Maps SqlUtil Upsert Result Codes to DB Provider Upsert Result Codes.
Definition: DbTableDataProvider.qc.dox.h:211
commit()
Commits data written to the data provider.
const ProviderInfo
Provider info.
Definition: DbTableDataProvider.qc.dox.h:32
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
string upsertRecordImpl(hash< auto > rec, *hash< auto > upsert_options)
Upserts the given record to the data provider.
const ConstructorOptions
Constructor options.
Definition: DbTableDataProvider.qc.dox.h:91
bool updateSingleRecordImpl(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates a single record matching the search options.
const SearchOptions
Search options; see details below.
Definition: DbTableDataProvider.qc.dox.h:179
DbTableRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
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.
constructor(AbstractTable table, *LoggerInterface logger)
Creates the object.
alignTable(hash< auto > table_desc)
Align table with the given description.
const CreateOptions
Create options; see details below.
Definition: DbTableDataProvider.qc.dox.h:121
*hash< auto > createRecordImpl(hash< auto > rec, *hash< auto > create_options)
Writes the given record to the data provider.
*hash< string, AbstractDataField > getRecordTypeImpl(*hash< auto > search_options)
Returns the description of the record type, if any.
hash< DataProviderInfo > getInfo()
Returns data provider info.
*hash< auto > searchSingleRecordImpl(hash< auto > where_cond, *hash< auto > search_options)
Returns a single record matching the search options.
AbstractDatabase db
the database object, if required
Definition: DbTableDataProvider.qc.dox.h:224
AbstractDataProviderBulkOperation getBulkUpserter()
Returns a bulk upsert operation object for the data provider.
int deleteRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Deletes zero or more records.
AbstractTable table
the table
Definition: DbTableDataProvider.qc.dox.h:221
updateFieldImpl(string name, AbstractDataField field, *hash< auto > field_update_options)
Updates an existing field.
*hash< string, hash< MapperRuntimeKeyInfo > > getMapperRuntimeKeys()
Returns custom data mapper runtime keys.
constructor(*hash< auto > options)
Creates the object from constructor options.
const UpsertOptions
Upsert options; see details below.
Definition: DbTableDataProvider.qc.dox.h:138
rollback()
Rolls back data written to the data provider.
deleteFieldImpl(string name, *hash< auto > field_delete_options)
Deletes an existing field.
bool requiresTransactionManagement()
Returns True if the data provider supports transaction management.
int updateRecordsImpl(hash< auto > set, *hash< auto > where_cond, *hash< auto > search_options)
Updates zero or more records matching the 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:28
Qore AbstractDbRecordIterator class definition.
Definition: AbstractDbRecordIterator.qc.dox.h:26