Qore DataProvider Module Reference  1.0
AbstractDataProvider.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
25 // assume local scope for variables, do not use "$" signs
26 // require type definitions everywhere
28 // enable all warnings
29 
31 namespace DataProvider {
36 const UpsertResultInserted = "inserted";
38 
40 const UpsertResultUpdated = "updated";
41 
43 const UpsertResultVerified = "verified";
44 
46 const UpsertResultUnchanged = "unchanged";
47 
49 const UpsertResultDeleted = "deleted";
51 
53 public struct DataProviderOptionInfo {
55  softlist<AbstractDataProviderType> type;
56 
58  bool required = False;
59 
61  string desc;
62 };
63 
65 public struct DataProviderInfo {
67 
69  string name;
70 
72 
74  string type;
75 
77 
80 
82 
85 
87 
90 
92 
95 
97 
100 
102 
105 
107 
113 
115 
121 
123 
129 
131 
134 
136 
139 
141 
144 
146 
149 
151 
154 
156 
158  *hash<string, hash<DataProviderOptionInfo>> constructor_options;
159 
161 
163  *hash<string, hash<DataProviderOptionInfo>> create_options;
164 
166 
168  *hash<string, hash<DataProviderOptionInfo>> upsert_options;
169 
171 
173  *hash<string, hash<DataProviderOptionInfo>> search_options;
174 
176 
178  *hash<string, hash<DataProviderOptionInfo>> request_options;
179 
181 
185  hash<string, hash<MapperRuntimeKeyInfo>> mapper_keys = Mapper::MapperKeyInfo;
186 
188 
190  *list<string> children;
191 };
192 
195 
196 public:
197 
199 
201  hash<auto> getInfoAsData();
202 
203 
205  hash<DataProviderInfo> getInfo();
206 
207 
209 
216  *hash<auto> createRecord(hash<auto> rec, *hash<auto> create_options);
217 
218 
220 
227  string upsertRecord(hash<auto> rec, *hash<auto> upsert_options);
228 
229 
231 
236  *hash<auto> searchFirstRecord(hash<auto> where_cond, *hash<auto> search_options);
237 
238 
240 
246  *hash<auto> searchSingleRecord(hash<auto> where_cond, *hash<auto> search_options);
247 
248 
250 
254  AbstractDataProviderRecordIterator getRecordIterator(*hash<auto> search_options);
255 
256 
258 
266  AbstractDataProviderBulkRecordInterface getBulkRecordInterface(int block_size = 1000, *hash<auto> search_options);
267 
268 
270 
279  AbstractDataProviderBulkRecordInterface searchRecordsBulk(int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
280 
281 
283 
288  AbstractDataProviderRecordIterator searchRecords(*hash<auto> where_cond, *hash<auto> search_options);
289 
290 
292 
300  AbstractDataProviderRecordIterator requestSearchRecords(auto req, *hash<auto> where_cond, *hash<auto> search_options);
301 
302 
304 
312  bool updateSingleRecord(hash<auto> set, hash<auto> where_cond, *hash<auto> search_options);
313 
314 
316 
324  int updateRecords(hash<auto> set, *hash<auto> where_cond, *hash<auto> search_options);
325 
326 
328 
336  int deleteRecords(*hash<auto> where_cond, *hash<auto> search_options);
337 
338 
340 
348  auto doRequest(auto req, *hash<auto> request_options);
349 
350 
352 
357 
358 
360 
365 
366 
368 
372  *hash<string, AbstractDataProviderType> getErrorResponseTypes();
373 
374 
376 
384 
385 
387 
389  *list<string> getChildProviderNames();
390 
391 
393 
400 
401 
403 
410 
411 
413 
420 
421 
423 
427 
428 
430 
432  commit();
433 
434 
436 
438  rollback();
439 
440 
442 
447 
448 
450 
455 
456 
458 
462  *hash<string, hash<MapperRuntimeKeyInfo>> getMapperRuntimeKeys();
463 
464 
466 
469  checkRead();
470 
471 
473 
476  checkCreate();
477 
478 
480 
483  checkUpsert();
484 
485 
487 
490  checkUpdate();
491 
492 
494 
497  checkDelete();
498 
499 
501 
504  checkRequest();
505 
506 
508 
510 protected:
511  *hash<auto> validateCreateOptions(*hash<auto> create_options);
512 public:
513 
514 
516 
518 protected:
519  *hash<auto> validateUpsertOptions(*hash<auto> upsert_options);
520 public:
521 
522 
524 
526 protected:
527  *hash<auto> validateSearchOptions(*hash<auto> search_options);
528 public:
529 
530 
532 
534 protected:
535  *hash<auto> validateRequestOptions(*hash<auto> request_options);
536 public:
537 
538 
540 protected:
541  processConstructorOptions(*hash<string, hash<DataProviderOptionInfo>> option_desc, *hash<auto> options);
542 public:
543 
544 
546 protected:
547  *hash<auto> checkOptions(string err, *hash<string, hash<DataProviderOptionInfo>> option_desc, *hash<auto> options);
548 public:
549 
550 
552 
559 protected:
560  *hash<auto> processFieldValues(*hash<auto> h, *hash<auto> search_options);
561 public:
562 
563 
565 protected:
566  error(string err, string fmt);
567 public:
568 
569 
571 
576 protected:
577  *hash<auto> searchFirstRecordImpl(hash<auto> where_cond, *hash<auto> search_options);
578 public:
579 
580 
582 
589 protected:
590  *hash<auto> searchSingleRecordImpl(hash<auto> where_cond, *hash<auto> search_options);
591 public:
592 
593 
595 
599 protected:
600  *list<string> getChildProviderNamesImpl();
601 public:
602 
603 
605 
607 protected:
609 public:
610 
611 
613 
619  *hash<string, AbstractDataField> getRecordType(*hash<auto> search_options);
620 
621 
623  *hash<string, AbstractDataField> getSoftRecordType(*hash<auto> search_options);
624 
625 
627 
630  *hash<string, hash<DataProviderOptionInfo>> getSearchOptions();
631 
632 
634 
637  *hash<string, hash<DataProviderOptionInfo>> getCreateOptions();
638 
639 
641 
644  *hash<string, hash<DataProviderOptionInfo>> getUpsertOptions();
645 
646 
648 
651  *hash<string, hash<DataProviderOptionInfo>> getRequestOptions();
652 
653 
655 
657  bool supportsRead();
658 
659 
661 
663  bool supportsBulkRead();
664 
665 
667 
669  bool supportsCreate();
670 
671 
673 
675  bool supportsUpdate();
676 
677 
679 
681  bool supportsUpsert();
682 
683 
685 
687  bool supportsDelete();
688 
689 
691 
693  bool supportsNativeSearch();
694 
695 
697 
699  bool supportsBulkCreate();
700 
701 
703 
705  bool supportsBulkUpsert();
706 
707 
709 
711  bool supportsRequest();
712 
713 
715 
718 
719 
721 
723  bool hasRecord();
724 
725 
727 
731 protected:
732  *hash<string, AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
733 public:
734 
735 
737 
744 protected:
745  AbstractDataProviderBulkRecordInterface searchRecordsBulkImpl(int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
746 public:
747 
748 
750 
755 protected:
756  AbstractDataProviderRecordIterator searchRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
757 public:
758 
759 
761 
769 protected:
770  AbstractDataProviderRecordIterator requestSearchRecordsImpl(auto req, *hash<auto> where_cond, *hash<auto> search_options);
771 public:
772 
773 
775 
780 protected:
781  *hash<auto> createRecordImpl(hash<auto> rec, *hash<auto> create_options);
782 public:
783 
784 
786 
791 protected:
792  string upsertRecordImpl(hash<auto> rec, *hash<auto> upsert_options);
793 public:
794 
795 
797 
801 protected:
802  bool updateSingleRecordImpl(hash<auto> set, hash<auto> where_cond, *hash<auto> search_options);
803 public:
804 
805 
807 
813 protected:
814  int updateRecordsImpl(hash<auto> set, hash<auto> where_cond, *hash<auto> search_options);
815 public:
816 
817 
819 
825 protected:
826  int deleteRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
827 public:
828 
829 
831 
836 protected:
837  auto doRequestImpl(auto req, *hash<auto> request_options);
838 public:
839 
840 
842 
846 protected:
848 public:
849 
850 
852 
856 protected:
858 public:
859 
860 
862 
866 protected:
867  *hash<string, AbstractDataProviderType> getErrorResponseTypesImpl();
868 public:
869 
870 
872 
878 protected:
880 public:
881 
882 
884 
886 protected:
888 public:
889 
890 
892  abstract string getName();
893 
895 protected:
896  abstract hash<DataProviderInfo> getStaticInfoImpl();
897 public:
898 };
899 };
bool supports_update
Does the data provider support record updates?
Definition: AbstractDataProvider.qc.dox.h:89
*AbstractDataProviderType getResponseTypeImpl()
Returns the description of a response message, if this object represents a response message.
hash< auto > getInfoAsData()
Returns static provider information as data; no objects are returned.
*hash< auto > searchSingleRecord(hash< auto > where_cond, *hash< auto > search_options)
Returns a single record matching the search options.
Data provider info.
Definition: AbstractDataProvider.qc.dox.h:65
AbstractDataProviderRecordIterator getRecordIterator(*hash< auto > search_options)
Returns an iterator iterating all records.
error(string err, string fmt)
thrown an exception
*hash< string, AbstractDataProviderType > getErrorResponseTypesImpl()
Returns a hash of error responses, if any.
checkUpdate()
Ensures that the data provider supports record upserts.
bool supports_upsert
Does the data provider support record upserts (create or update)?
Definition: AbstractDataProvider.qc.dox.h:94
auto doRequest(auto req, *hash< auto > request_options)
Makes a request and returns the response.
commit()
Commits data written to the data provider.
int updateRecordsImpl(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates zero or more records matching the search options.
int deleteRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Deletes zero or more records.
Abstract bulk data operation class.
Definition: AbstractDataProviderBulkOperation.qc.dox.h:33
processConstructorOptions(*hash< string, hash< DataProviderOptionInfo >> option_desc, *hash< auto > options)
processes options passed to the constructor
*AbstractDataProviderType getResponseType()
Returns the description of a response message, if this object represents a response message.
AbstractDataProvider getChildProviderEx(string name)
Returns the given child provider or throws an exception if the given child is unknown.
const UpsertResultUpdated
Indicates that the record was updated.
Definition: AbstractDataProvider.qc.dox.h:40
checkDelete()
Ensures that the data provider supports record deletion.
*hash< string, hash< DataProviderOptionInfo > > getCreateOptions()
Returns options that can be used for creating records.
*list< string > getChildProviderNames()
Returns a list of child data provider names, if any.
bool supportsUpdate()
Returns True if the data provider supports the record update API.
throwUnimplementedException()
Throws an INVALID-OPERATION exception.
Defines the abstract class for data provider iterators; the destructor releases the iterator.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:33
*hash< auto > createRecord(hash< auto > rec, *hash< auto > create_options)
Creates the given record in the data provider.
const UpsertResultDeleted
Indicates that the record was deleted.
Definition: AbstractDataProvider.qc.dox.h:49
AbstractDataProviderRecordIterator searchRecords(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
*AbstractDataProvider getChildProvider(string name)
Returns the given child provider or NOTHING if the given child is unknown.
The AbstractDataProvider class.
Definition: AbstractDataProvider.qc.dox.h:194
int updateRecords(hash< auto > set, *hash< auto > where_cond, *hash< auto > search_options)
Updates zero or more records matching the search options.
*AbstractDataProviderType getRequestType()
Returns the description of a successful request message, if any.
*hash< string, hash< DataProviderOptionInfo > > getUpsertOptions()
Returns options that can be used for upserting records.
*hash< string, hash< DataProviderOptionInfo > > create_options
Create options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:163
string name
Data provider name.
Definition: AbstractDataProvider.qc.dox.h:69
const UpsertResultInserted
Indicates that the record was inserted.
Definition: AbstractDataProvider.qc.dox.h:37
*hash< auto > checkOptions(string err, *hash< string, hash< DataProviderOptionInfo >> option_desc, *hash< auto > options)
verifies options according to the option
*hash< auto > validateSearchOptions(*hash< auto > search_options)
validates search options
string desc
The option description.
Definition: AbstractDataProvider.qc.dox.h:61
bool updateSingleRecord(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates a single record matching the search options.
*hash< string, hash< DataProviderOptionInfo > > constructor_options
Constructor options supported by the data provider for the constructor variant taking a hash.
Definition: AbstractDataProvider.qc.dox.h:158
bool transaction_management
Does the data provider require transaction management?
Definition: AbstractDataProvider.qc.dox.h:143
checkUpsert()
Ensures that the data provider supports record upserts.
*hash< string, AbstractDataProviderType > getErrorResponseTypes()
Returns a hash of error responses, if any.
AbstractDataProviderType getErrorResponseTypeImpl(string error_code)
Returns the type for the given error code.
bool supports_native_search
Does the data provider support native record searching?
Definition: AbstractDataProvider.qc.dox.h:104
*hash< string, hash< DataProviderOptionInfo > > getRequestOptions()
Returns options that can be used for requests.
const False
bool requiresTransactionManagement()
Returns True if the data provider supports transaction management.
AbstractDataProviderBulkRecordInterface searchRecordsBulk(int block_size=1000, *hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
bool has_record
Does the data provider provide a record?
Definition: AbstractDataProvider.qc.dox.h:148
*hash< auto > createRecordImpl(hash< auto > rec, *hash< auto > create_options)
Creates 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< string, hash< DataProviderOptionInfo > > request_options
Request options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:178
const UpsertResultUnchanged
Indicates that the record was left unchanged.
Definition: AbstractDataProvider.qc.dox.h:46
AbstractDataProviderRecordIterator requestSearchRecordsImpl(auto req, *hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options according to an API request.
*hash< string, hash< DataProviderOptionInfo > > search_options
Search options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:173
checkCreate()
Ensures that the data provider supports record creation.
abstract hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
*hash< auto > searchSingleRecordImpl(hash< auto > where_cond, *hash< auto > search_options)
Returns a single record matching the search options.
auto doRequestImpl(auto req, *hash< auto > request_options)
Makes a request and returns the response.
AbstractDataProvider getChildProviderPath(string path)
Returns the given child provider from a "/" separated path string; throws an exception if any element...
bool supportsBulkUpsert()
Returns True if the data provider supports bulk upserts.
Defines the abstract class for data provider iterators; the destructor releases the iterator.
Definition: AbstractDataProviderBulkRecordInterface.qc.dox.h:33
*AbstractDataProviderType getRequestTypeImpl()
Returns the description of a successful request message, if any.
hash< DataProviderInfo > getInfo()
Returns data provider info.
checkRead()
Ensures that the data provider supports read operations.
bool hasRecord()
Returns True if the data provider has a record type.
abstract string getName()
Returns the data provider name.
*hash< auto > processFieldValues(*hash< auto > h, *hash< auto > search_options)
processes search or set values to convert types if necessary
*hash< auto > validateUpsertOptions(*hash< auto > upsert_options)
validates upsert options
string upsertRecord(hash< auto > rec, *hash< auto > upsert_options)
Upserts the given record in the data provider.
bool supports_children
Does the data provider support children?
Definition: AbstractDataProvider.qc.dox.h:138
Data provider option info.
Definition: AbstractDataProvider.qc.dox.h:53
bool supports_read
Does the data provider support reading.
Definition: AbstractDataProvider.qc.dox.h:79
*hash< auto > searchFirstRecordImpl(hash< auto > where_cond, *hash< auto > search_options)
Returns the first record matching the search options.
checkRequest()
Ensures that the data provider supports the request API.
bool record_requires_search_options
Do we require search options to retrieve the record type?
Definition: AbstractDataProvider.qc.dox.h:153
softlist< AbstractDataProviderType > type
The option value type or types.
Definition: AbstractDataProvider.qc.dox.h:55
bool supportsBulkCreate()
Returns True if the data provider supports bulk creation output.
*hash< string, AbstractDataField > getRecordType(*hash< auto > search_options)
Returns the description of the record type, if any.
bool supports_bulk_create
Does the data provider support native / optimized bulk creation?
Definition: AbstractDataProvider.qc.dox.h:120
bool recordRequiresSearchOptions()
Returns True if the data provider requires search options to retrieve the record type.
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:161
*hash< string, hash< DataProviderOptionInfo > > upsert_options
Upsert options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:168
bool required
Required flag.
Definition: AbstractDataProvider.qc.dox.h:58
*hash< string, AbstractDataField > getSoftRecordType(*hash< auto > search_options)
Returns the description of the record type, if any.
bool supports_create
Does the data provider support record creation?
Definition: AbstractDataProvider.qc.dox.h:84
bool supportsRead()
Returns True if the data provider supports reading.
hash< auto > hash(object obj)
bool supports_delete
Does the data provider support record deletion?
Definition: AbstractDataProvider.qc.dox.h:99
AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
string upsertRecordImpl(hash< auto > rec, *hash< auto > upsert_options)
Upserts the given record to the data provider.
AbstractDataProviderBulkOperation getBulkInserter()
Returns a bulk insert operation object for the data provider.
int deleteRecords(*hash< auto > where_cond, *hash< auto > search_options)
Deletes zero or more records.
bool supportsRequest()
Returns True if the data provider supports requests.
bool supports_bulk_read
Does the data provider support native / optimized bulk reads?
Definition: AbstractDataProvider.qc.dox.h:112
bool supportsBulkRead()
Returns True if the data provider supports native bulk reading.
bool supports_request
Does the data provider support the request API?
Definition: AbstractDataProvider.qc.dox.h:133
bool supportsNativeSearch()
Returns True if the data provider supports the record search API natively.
*hash< string, hash< MapperRuntimeKeyInfo > > getMapperRuntimeKeys()
Returns custom data mapper runtime keys.
bool supportsCreate()
Returns True if the data provider supports the record creation API.
AbstractDataProviderBulkOperation getBulkUpserter()
Returns a bulk upsert operation object for the data provider.
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:32
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
AbstractDataProviderRecordIterator requestSearchRecords(auto req, *hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options according to an API request.
hash< string, hash< MapperRuntimeKeyInfo > > mapper_keys
A hash of mapper key information.
Definition: AbstractDataProvider.qc.dox.h:185
bool supportsUpsert()
Returns True if the data provider supports the record upsert API.
bool supportsDelete()
Returns True if the data provider supports the record deletion API.
bool updateSingleRecordImpl(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates a single record 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.
AbstractDataProviderType getErrorResponseType(string error_code)
Returns the type for the given error code.
*list< string > children
A list of child data providers in this data provider.
Definition: AbstractDataProvider.qc.dox.h:190
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
*hash< string, hash< DataProviderOptionInfo > > getSearchOptions()
Returns options that can be used for searching.
*hash< auto > validateRequestOptions(*hash< auto > request_options)
validates request options
bool supports_bulk_upsert
Does the data provider support native / optimized bulk upserts?
Definition: AbstractDataProvider.qc.dox.h:128
*hash< auto > searchFirstRecord(hash< auto > where_cond, *hash< auto > search_options)
Returns the first record matching the search options.
string type
The name of the provider type.
Definition: AbstractDataProvider.qc.dox.h:74
*hash< auto > validateCreateOptions(*hash< auto > create_options)
validates create options
rollback()
Rolls back data written to the data provider.
const UpsertResultVerified
Indicates that the record was verified as already in the target state.
Definition: AbstractDataProvider.qc.dox.h:43
AbstractDataProviderBulkRecordInterface getBulkRecordInterface(int block_size=1000, *hash< auto > search_options)
Returns an iterator iterating all records with the bulk read API.