Qore DataProvider Module Reference  1.2.2
AbstractDataProvider.qc.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
26 namespace DataProvider {
32 const UpsertResultInserted = "inserted";
33 
35 const UpsertResultUpdated = "updated";
36 
38 const UpsertResultVerified = "verified";
39 
41 const UpsertResultUnchanged = "unchanged";
42 
44 const UpsertResultDeleted = "deleted";
46 
48 public struct DataProviderOptionInfo {
50  softlist<AbstractDataProviderType> type;
51 
53  bool required = False;
54 
56  string desc;
57 };
58 
60 public struct DataProviderInfo {
62 
64  string name;
65 
67 
69  string type;
70 
72 
75 
77 
80 
82 
85 
87 
90 
92 
95 
97 
100 
102 
108 
110 
116 
118 
124 
126 
129 
131 
134 
136 
139 
141 
144 
146 
149 
151 
153  *hash<string, hash<DataProviderOptionInfo>> constructor_options;
154 
156 
158  *hash<string, hash<DataProviderOptionInfo>> create_options;
159 
161 
163  *hash<string, hash<DataProviderOptionInfo>> upsert_options;
164 
166 
168  *hash<string, hash<DataProviderOptionInfo>> search_options;
169 
171 
173  *hash<string, hash<DataProviderOptionInfo>> request_options;
174 
176 
180  hash<string, hash<MapperRuntimeKeyInfo>> mapper_keys = Mapper::MapperKeyInfo;
181 
183 
185  *list<string> children;
186 };
187 
190 
191 public:
192 
193 protected:
195  static bool callbacks_locked = False;
196 
199 
201  static code cb_resolve_value;
202 
203 public:
204 
206 
208  hash<auto> getInfoAsData();
209 
210 
212  hash<DataProviderInfo> getInfo();
213 
214 
216 
225  *hash<auto> createRecord(hash<auto> rec, *hash<auto> create_options);
226 
227 
229 
236  string upsertRecord(hash<auto> rec, *hash<auto> upsert_options);
237 
238 
240 
245  *hash<auto> searchFirstRecord(hash<auto> where_cond, *hash<auto> search_options);
246 
247 
249 
255  *hash<auto> searchSingleRecord(hash<auto> where_cond, *hash<auto> search_options);
256 
257 
259 
264 
265 
267 
275  AbstractDataProviderBulkRecordInterface getBulkRecordInterface(int block_size = 1000, *hash<auto> search_options);
276 
277 
279 
288  AbstractDataProviderBulkRecordInterface searchRecordsBulk(int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
289 
290 
292 
297  AbstractDataProviderRecordIterator searchRecords(*hash<auto> where_cond, *hash<auto> search_options);
298 
299 
301 
309  AbstractDataProviderRecordIterator requestSearchRecords(auto req, *hash<auto> where_cond, *hash<auto> search_options);
310 
311 
313 
321  bool updateSingleRecord(hash<auto> set, hash<auto> where_cond, *hash<auto> search_options);
322 
323 
325 
333  int updateRecords(hash<auto> set, *hash<auto> where_cond, *hash<auto> search_options);
334 
335 
337 
345  int deleteRecords(*hash<auto> where_cond, *hash<auto> search_options);
346 
347 
349 
357  auto doRequest(auto req, *hash<auto> request_options);
358 
359 
361 
366 
367 
369 
374 
375 
377 
381  *hash<string, AbstractDataProviderType> getErrorResponseTypes();
382 
383 
385 
393 
394 
396 
398  *list<string> getChildProviderNames();
399 
400 
402 
409 
410 
412 
419 
420 
422 
429 
430 
432 
436 
437 
439 
448 
449 
451 
458 
459 
461 
468 
469 
471 
476 
477 
479 
484 
485 
487 
491  *hash<string, hash<MapperRuntimeKeyInfo>> getMapperRuntimeKeys();
492 
493 
495 
499 
500 
502 
506 
507 
509 
513 
514 
516 
520 
521 
523 
527 
528 
530 
534 
535 
537 
542 
544 
554  static bool setDynamicValueCallbacks(code value_needs_resolution, code resolve_value);
555 
557 protected:
558  static bool checkCallbacks();
559 public:
560 
561 
563 
565 protected:
566  *hash<auto> validateCreateOptions(*hash<auto> create_options);
567 public:
568 
569 
571 
573 protected:
574  *hash<auto> validateUpsertOptions(*hash<auto> upsert_options);
575 public:
576 
577 
579 
581 protected:
582  *hash<auto> validateSearchOptions(*hash<auto> search_options);
583 public:
584 
585 
587 
589 protected:
590  *hash<auto> validateRequestOptions(*hash<auto> request_options);
591 public:
592 
593 
595 protected:
596  processConstructorOptions(*hash<string, hash<DataProviderOptionInfo>> option_desc, *hash<auto> options);
597 public:
598 
599 
601 protected:
602  *hash<auto> checkOptions(string err, *hash<string, hash<DataProviderOptionInfo>> option_desc, *hash<auto> options);
603 public:
604 
605 
607 
614 protected:
615  *hash<auto> processFieldValues(*hash<auto> h, *hash<auto> search_options);
616 public:
617 
618 
620 protected:
621  error(string err, string fmt);
622 public:
623 
624 
626 
631 protected:
632  *hash<auto> searchFirstRecordImpl(hash<auto> where_cond, *hash<auto> search_options);
633 public:
634 
635 
637 
644 protected:
645  *hash<auto> searchSingleRecordImpl(hash<auto> where_cond, *hash<auto> search_options);
646 public:
647 
648 
650 
654 protected:
655  *list<string> getChildProviderNamesImpl();
656 public:
657 
658 
660 
662 protected:
664 public:
665 
666 
668 
674  *hash<string, AbstractDataField> getRecordType(*hash<auto> search_options);
675 
676 
678  *hash<string, AbstractDataField> getSoftRecordType(*hash<auto> search_options);
679 
680 
682  *hash<string, AbstractDataField> getOrNothingRecordType(*hash<auto> search_options);
683 
684 
686 
689  *hash<string, hash<DataProviderOptionInfo>> getSearchOptions();
690 
691 
693 
696  *hash<string, hash<DataProviderOptionInfo>> getCreateOptions();
697 
698 
700 
703  *hash<string, hash<DataProviderOptionInfo>> getUpsertOptions();
704 
705 
707 
710  *hash<string, hash<DataProviderOptionInfo>> getRequestOptions();
711 
712 
714 
716  bool supportsRead();
717 
718 
720 
723 
724 
726 
729 
730 
732 
735 
736 
738 
741 
742 
744 
747 
748 
750 
753 
754 
756 
759 
760 
762 
765 
766 
768 
771 
772 
774 
777 
778 
780 
782  bool hasRecord();
783 
784 
786 
790 protected:
791  *hash<string, AbstractDataField> getRecordTypeImpl(*hash<auto> search_options);
792 public:
793 
794 
796 
803 protected:
804  AbstractDataProviderBulkRecordInterface searchRecordsBulkImpl(int block_size = 1000, *hash<auto> where_cond, *hash<auto> search_options);
805 public:
806 
807 
809 
814 protected:
815  AbstractDataProviderRecordIterator searchRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
816 public:
817 
818 
820 
828 protected:
829  AbstractDataProviderRecordIterator requestSearchRecordsImpl(auto req, *hash<auto> where_cond, *hash<auto> search_options);
830 public:
831 
832 
834 
842 protected:
843  *hash<auto> createRecordImpl(hash<auto> rec, *hash<auto> create_options);
844 public:
845 
846 
848 
853 protected:
854  string upsertRecordImpl(hash<auto> rec, *hash<auto> upsert_options);
855 public:
856 
857 
859 
863 protected:
864  bool updateSingleRecordImpl(hash<auto> set, hash<auto> where_cond, *hash<auto> search_options);
865 public:
866 
867 
869 
875 protected:
876  int updateRecordsImpl(hash<auto> set, hash<auto> where_cond, *hash<auto> search_options);
877 public:
878 
879 
881 
887 protected:
888  int deleteRecordsImpl(*hash<auto> where_cond, *hash<auto> search_options);
889 public:
890 
891 
893 
898 protected:
899  auto doRequestImpl(auto req, *hash<auto> request_options);
900 public:
901 
902 
904 
908 protected:
910 public:
911 
912 
914 
918 protected:
920 public:
921 
922 
924 
928 protected:
929  *hash<string, AbstractDataProviderType> getErrorResponseTypesImpl();
930 public:
931 
932 
934 
940 protected:
942 public:
943 
944 
946 
948 protected:
950 public:
951 
952 
954  abstract string getName();
955 
957 protected:
958  abstract hash<DataProviderInfo> getStaticInfoImpl();
959 public:
960 };
961 };
Abstract bulk data operation class.
Definition: AbstractDataProviderBulkOperation.qc.dox.h:33
Defines the abstract class for data provider iterators; the destructor releases the iterator.
Definition: AbstractDataProviderBulkRecordInterface.qc.dox.h:33
The AbstractDataProvider class.
Definition: AbstractDataProvider.qc.dox.h:189
static code cb_resolve_value
static callback for dynamic value resolution
Definition: AbstractDataProvider.qc.dox.h:201
error(string err, string fmt)
thrown an exception
*hash< string, hash< MapperRuntimeKeyInfo > > getMapperRuntimeKeys()
Returns custom data mapper runtime keys.
*hash< auto > searchFirstRecordImpl(hash< auto > where_cond, *hash< auto > search_options)
Returns the first record matching the search options.
bool supportsCreate()
Returns True if the data provider supports the record creation API.
beginTransaction()
Begins a transaction with a data provider.
*hash< string, AbstractDataProviderType > getErrorResponseTypes()
Returns a hash of error responses, if any.
*list< string > getChildProviderNamesImpl()
Returns a list of child data provider names, if any.
*AbstractDataProviderType getRequestType()
Returns the description of a successful request message, if any.
bool supportsDelete()
Returns True if the data provider supports the record deletion API.
checkUpdate()
Ensures that the data provider supports record upserts.
*hash< string, AbstractDataField > getRecordTypeImpl(*hash< auto > search_options)
Returns the description of the record type, if any.
*hash< string, AbstractDataField > getSoftRecordType(*hash< auto > search_options)
Returns the description of the record type with soft types, if any.
AbstractDataProviderBulkOperation getBulkUpserter()
Returns a bulk upsert operation object for the data provider.
bool updateSingleRecordImpl(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates a single record matching the search options.
AbstractDataProviderBulkRecordInterface getBulkRecordInterface(int block_size=1000, *hash< auto > search_options)
Returns an iterator iterating all records with the bulk read API.
processConstructorOptions(*hash< string, hash< DataProviderOptionInfo >> option_desc, *hash< auto > options)
processes options passed to the constructor
*hash< string, AbstractDataField > getRecordType(*hash< auto > search_options)
Returns the description of the record type, if any.
bool supportsRequest()
Returns True if the data provider supports requests.
*AbstractDataProvider getChildProvider(string name)
Returns the given child provider or NOTHING if the given child is unknown.
hash< DataProviderInfo > getInfo()
Returns data provider info.
int deleteRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Deletes zero or more records.
*hash< string, hash< DataProviderOptionInfo > > getRequestOptions()
Returns options that can be used for requests.
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.
throwUnimplementedException()
Throws an INVALID-OPERATION exception.
commit()
Commits data written to the data provider.
bool supportsNativeSearch()
Returns True if the data provider supports the record search API natively.
bool supportsRead()
Returns True if the data provider supports reading.
bool requiresTransactionManagement()
Returns True if the data provider supports transaction management.
AbstractDataProviderRecordIterator getRecordIterator(*hash< auto > search_options)
Returns an iterator iterating all records.
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, AbstractDataProviderType > getErrorResponseTypesImpl()
Returns a hash of error responses, if any.
*hash< auto > createRecord(hash< auto > rec, *hash< auto > create_options)
Creates the given record in the data provider.
*hash< auto > validateCreateOptions(*hash< auto > create_options)
validates create options
int updateRecordsImpl(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates zero or more records matching the search options.
*hash< auto > validateSearchOptions(*hash< auto > search_options)
validates search options
string upsertRecordImpl(hash< auto > rec, *hash< auto > upsert_options)
Upserts the given record to the data provider.
rollback()
Rolls back data written to the data provider.
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.
*AbstractDataProviderType getResponseType()
Returns the description of a response message, if this object represents a response message.
*hash< auto > processFieldValues(*hash< auto > h, *hash< auto > search_options)
processes search or set values to convert types if necessary
*AbstractDataProviderType getResponseTypeImpl()
Returns the description of a response message, if this object represents a response message.
abstract hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
bool recordRequiresSearchOptions()
Returns True if the data provider requires search options to retrieve the record type.
static bool callbacks_locked
flag if callbacks are locked
Definition: AbstractDataProvider.qc.dox.h:195
AbstractDataProviderBulkOperation getBulkInserter()
Returns a bulk insert operation object for the data provider.
AbstractDataProviderRecordIterator searchRecordsImpl(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
bool supportsBulkUpsert()
Returns True if the data provider supports bulk upserts.
*AbstractDataProviderType getRequestTypeImpl()
Returns the description of a successful request message, if any.
static bool setDynamicValueCallbacks()
Ensures that no callbacks can be set for dynamic URI resolution.
bool updateSingleRecord(hash< auto > set, hash< auto > where_cond, *hash< auto > search_options)
Updates a single record matching the search options.
auto doRequest(auto req, *hash< auto > request_options)
Makes a request and returns the response.
static code cb_value_needs_resolution
static callback the returns a bool if the value needs dynamic resolution
Definition: AbstractDataProvider.qc.dox.h:198
*hash< string, AbstractDataField > getOrNothingRecordType(*hash< auto > search_options)
Returns the description of the record type with "or nothing" types, if any.
checkCreate()
Ensures that the data provider supports record creation.
hash< auto > getInfoAsData()
Returns static provider information as data; no objects are returned.
*hash< string, hash< DataProviderOptionInfo > > getUpsertOptions()
Returns options that can be used for upserting records.
checkRead()
Ensures that the data provider supports read operations.
*hash< auto > searchFirstRecord(hash< auto > where_cond, *hash< auto > search_options)
Returns the first record matching the search options.
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.
*hash< string, hash< DataProviderOptionInfo > > getSearchOptions()
Returns options that can be used for searching.
*AbstractDataProvider getChildProviderImpl(string name)
Returns the given child provider or NOTHING if the given child is unknown.
int updateRecords(hash< auto > set, *hash< auto > where_cond, *hash< auto > search_options)
Updates zero or more records matching the search options.
*hash< auto > searchSingleRecord(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.
AbstractDataProviderRecordIterator searchRecords(*hash< auto > where_cond, *hash< auto > search_options)
Returns an iterator for zero or more records matching the search options.
checkDelete()
Ensures that the data provider supports record deletion.
AbstractDataProviderType getErrorResponseType(string error_code)
Returns the type for the given error code.
bool supportsBulkRead()
Returns True if the data provider supports native bulk reading.
AbstractDataProvider getChildProviderPath(string path)
Returns the given child provider from a "/" separated path string; throws an exception if any element...
*list< string > getChildProviderNames()
Returns a list of child data provider names, if any.
string upsertRecord(hash< auto > rec, *hash< auto > upsert_options)
Upserts the given record in the data provider.
*hash< auto > searchSingleRecordImpl(hash< auto > where_cond, *hash< auto > search_options)
Returns a single record matching the search options.
AbstractDataProviderType getErrorResponseTypeImpl(string error_code)
Returns the type for the given error code.
abstract string getName()
Returns the data provider name.
bool hasRecord()
Returns True if the data provider has a record type.
static bool setDynamicValueCallbacks(code value_needs_resolution, code resolve_value)
Set callbacks for dynamic URI resolution to allow for variable URI path elements to be resolved at ru...
*hash< auto > createRecordImpl(hash< auto > rec, *hash< auto > create_options)
Creates the given record to the data provider.
checkRequest()
Ensures that the data provider supports the request API.
*hash< auto > validateUpsertOptions(*hash< auto > upsert_options)
validates upsert options
bool supportsUpsert()
Returns True if the data provider supports the record upsert API.
AbstractDataProvider getChildProviderEx(string name)
Returns the given child provider or throws an exception if the given child is unknown.
static bool checkCallbacks()
Checks if callbacks have already been set or locked.
*hash< auto > checkOptions(string err, *hash< string, hash< DataProviderOptionInfo >> option_desc, *hash< auto > options)
verifies options according to the option
bool supportsUpdate()
Returns True if the data provider supports the record update API.
int deleteRecords(*hash< auto > where_cond, *hash< auto > search_options)
Deletes zero or more records.
checkUpsert()
Ensures that the data provider supports record upserts.
bool supportsBulkCreate()
Returns True if the data provider supports bulk creation output.
*hash< auto > validateRequestOptions(*hash< auto > request_options)
validates request options
*hash< string, hash< DataProviderOptionInfo > > getCreateOptions()
Returns options that can be used for creating records.
Defines the abstract class for data provider iterators; the destructor releases the iterator.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:33
describes a data type
Definition: AbstractDataProviderType.qc.dox.h:88
const False
hash< auto > hash(object obj)
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27
const UpsertResultUnchanged
Indicates that the record was left unchanged.
Definition: AbstractDataProvider.qc.dox.h:41
const UpsertResultDeleted
Indicates that the record was deleted.
Definition: AbstractDataProvider.qc.dox.h:44
const UpsertResultInserted
Indicates that the record was inserted.
Definition: AbstractDataProvider.qc.dox.h:32
const UpsertResultVerified
Indicates that the record was verified as already in the target state.
Definition: AbstractDataProvider.qc.dox.h:38
const UpsertResultUpdated
Indicates that the record was updated.
Definition: AbstractDataProvider.qc.dox.h:35
Data provider info.
Definition: AbstractDataProvider.qc.dox.h:60
bool supports_delete
Does the data provider support record deletion?
Definition: AbstractDataProvider.qc.dox.h:94
bool supports_bulk_read
Does the data provider support native / optimized bulk reads?
Definition: AbstractDataProvider.qc.dox.h:107
bool transaction_management
Does the data provider require transaction management?
Definition: AbstractDataProvider.qc.dox.h:138
string type
The name of the provider type.
Definition: AbstractDataProvider.qc.dox.h:69
bool supports_native_search
Does the data provider support native record searching?
Definition: AbstractDataProvider.qc.dox.h:99
*hash< string, hash< DataProviderOptionInfo > > request_options
Request options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:173
*hash< string, hash< DataProviderOptionInfo > > search_options
Search options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:168
string name
Data provider name.
Definition: AbstractDataProvider.qc.dox.h:64
bool supports_bulk_upsert
Does the data provider support native / optimized bulk upserts?
Definition: AbstractDataProvider.qc.dox.h:123
hash< string, hash< MapperRuntimeKeyInfo > > mapper_keys
A hash of mapper key information.
Definition: AbstractDataProvider.qc.dox.h:180
bool supports_read
Does the data provider support reading.
Definition: AbstractDataProvider.qc.dox.h:74
bool record_requires_search_options
Do we require search options to retrieve the record type?
Definition: AbstractDataProvider.qc.dox.h:148
bool supports_update
Does the data provider support record updates?
Definition: AbstractDataProvider.qc.dox.h:84
*hash< string, hash< DataProviderOptionInfo > > upsert_options
Upsert options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:163
bool supports_request
Does the data provider support the request API?
Definition: AbstractDataProvider.qc.dox.h:128
*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:153
*hash< string, hash< DataProviderOptionInfo > > create_options
Create options supported by the data provider.
Definition: AbstractDataProvider.qc.dox.h:158
bool supports_create
Does the data provider support record creation?
Definition: AbstractDataProvider.qc.dox.h:79
*list< string > children
A list of child data providers in this data provider.
Definition: AbstractDataProvider.qc.dox.h:185
bool supports_upsert
Does the data provider support record upserts (create or update)?
Definition: AbstractDataProvider.qc.dox.h:89
bool supports_bulk_create
Does the data provider support native / optimized bulk creation?
Definition: AbstractDataProvider.qc.dox.h:115
bool supports_children
Does the data provider support children?
Definition: AbstractDataProvider.qc.dox.h:133
bool has_record
Does the data provider provide a record?
Definition: AbstractDataProvider.qc.dox.h:143
Data provider option info.
Definition: AbstractDataProvider.qc.dox.h:48
softlist< AbstractDataProviderType > type
The option value type or types.
Definition: AbstractDataProvider.qc.dox.h:50
string desc
The option description.
Definition: AbstractDataProvider.qc.dox.h:56
bool required
Required flag.
Definition: AbstractDataProvider.qc.dox.h:53