Loading...
Searching...
No Matches
AbstractDataProviderRecordIterator.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
// assume local scope for variables, do not use "$" signs
// require type definitions everywhere
// enable all warnings
namespace DataProvider {
const DP_OP_AND = "AND";
const DP_OP_OR = "OR";
const DP_SEARCH_OP_REGEX = "regex";
const DP_SEARCH_OP_LT = "<";
const DP_SEARCH_OP_LE = "<=";
const DP_SEARCH_OP_GT = ">";
const DP_SEARCH_OP_GE = ">=";
const DP_SEARCH_OP_NE = "!=";
const DP_SEARCH_OP_EQ = "=";
const DP_SEARCH_OP_BETWEEN = "between";
const DP_SEARCH_OP_IN = "in";
const DP_SEARCH_OP_NOT = "not";
public struct SearchOperatorInfo {
string op;
auto arg;
};
const DefaultGenericSearchOpMap = {
DP_SEARCH_OP_REGEX: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return regex(field_value.toString(), cmd.arg.pattern, cmd.arg.options);
},
),
DP_SEARCH_OP_LT: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value < cmd.arg;
},
),
DP_SEARCH_OP_LE: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value <= cmd.arg;
},
),
DP_SEARCH_OP_GT: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value > cmd.arg;
},
),
DP_SEARCH_OP_GE: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value >= cmd.arg;
},
),
DP_SEARCH_OP_NE: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value != cmd.arg;
},
),
DP_SEARCH_OP_EQ: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value == cmd.arg;
},
),
DP_SEARCH_OP_BETWEEN: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return field_value >= cmd.arg[0] && field_value <= cmd.arg[1];
},
),
DP_SEARCH_OP_IN: (
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return cmd.arg ? (cmd.arg{field_value} ?? False) : !field_value.val();
},
),
DP_SEARCH_OP_NOT: (
"recursive": True,
"code": bool sub (hash<auto> cmd, auto field_value, string field_name, hash<auto> rec) {
return !field_value;
},
),
};
hash<SearchOperatorInfo> dp_make_op(string op, auto arg);
hash<SearchOperatorInfo> dp_op_regex(string str);
hash<SearchOperatorInfo> dp_op_like(string str);
hash<SearchOperatorInfo> dp_op_lt(auto arg);
hash<SearchOperatorInfo> dp_op_le(auto arg);
hash<SearchOperatorInfo> dp_op_gt(auto arg);
hash<SearchOperatorInfo> dp_op_ge(auto arg);
hash<SearchOperatorInfo> dp_op_ne(auto arg);
hash<SearchOperatorInfo> dp_op_eq(auto arg);
hash<SearchOperatorInfo> dp_op_between(auto l, auto r);
hash<SearchOperatorInfo> dp_op_in();
hash<SearchOperatorInfo> dp_op_in(list<auto> args);
hash<SearchOperatorInfo> dp_op_not(hash<auto> arg);
class AbstractDataProviderRecordIterator : public AbstractIterator {
public:
bool supportsBulkApi();
*AbstractDataProviderBulkRecordInterface getBulkApi();
*hash<string, AbstractDataField> getRecordType();
abstract hash<auto> getValue();
protected:
auto doMemberGate(string key);
public:
protected:
static bool matchGeneric(hash<auto> record, hash<DataProviderExpression> where_cond);
public:
protected:
static bool matchGeneric(hash<auto> record, *hash<auto> where_cond);
public:
protected:
static bool evalOperator(string field, hash<auto> cmd, hash<auto> op, hash<auto> record);
public:
protected:
static bool matchGenericValue(auto expects, auto val);
public:
};
};
DataProvider::AbstractDataProviderBulkRecordInterface
Defines the abstract class for data provider iterators; the destructor releases the iterator.
Definition: AbstractDataProviderBulkRecordInterface.qc.dox.h:33
DataProvider::AbstractDataProviderRecordIterator
Defines the abstract class for data provider iterators; the destructor releases the iterator.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:339
DataProvider::AbstractDataProviderRecordIterator::matchGeneric
static bool matchGeneric(hash< auto > record, *hash< auto > where_cond)
Checks if the current record matches the search criteria.
DataProvider::AbstractDataProviderRecordIterator::getValue
abstract hash< auto > getValue()
returns a single record if the iterator is valid
DataProvider::AbstractDataProviderRecordIterator::matchGenericValue
static bool matchGenericValue(auto expects, auto val)
Match a single value.
DataProvider::AbstractDataProviderRecordIterator::evalOperator
static bool evalOperator(string field, hash< auto > cmd, hash< auto > op, hash< auto > record)
Evaluates a generic search operator on the field value and record and returns the result.
DataProvider::AbstractDataProviderRecordIterator::getBulkApi
*AbstractDataProviderBulkRecordInterface getBulkApi()
Returns the bulk data interface if supported.
DataProvider::AbstractDataProviderRecordIterator::supportsBulkApi
bool supportsBulkApi()
Returns True if the iterator supports bulk operation.
DataProvider::AbstractDataProviderRecordIterator::matchGeneric
static bool matchGeneric(hash< auto > record, hash< DataProviderExpression > where_cond)
Checks if the current record matches the search criteria.
DataProvider::AbstractDataProviderRecordIterator::doMemberGate
auto doMemberGate(string key)
Returns the value of the given field in the current record, if the iterator is valid.
DataProvider::AbstractDataProviderRecordIterator::getRecordType
*hash< string, AbstractDataField > getRecordType()
Returns the record description, if available.
DataProvider
Qore AbstractDataField class definition.
Definition: AbstractDataField.qc.dox.h:27
DataProvider::DP_SEARCH_OP_EQ
const DP_SEARCH_OP_EQ
Identifies the generic data provider equals operator (=) for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:81
DataProvider::DP_OP_OR
const DP_OP_OR
OR logic.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:41
DataProvider::DP_SEARCH_OP_REGEX
const DP_SEARCH_OP_REGEX
Identifies the regex operator for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:51
DataProvider::dp_op_ge
hash< SearchOperatorInfo > dp_op_ge(auto arg)
returns an SearchOperatorInfo hash for the ">=" operator with the given argument
DataProvider::dp_op_in
hash< SearchOperatorInfo > dp_op_in()
returns an SearchOperatorInfo hash for the "in" operator with all arguments passed to the function
DataProvider::DP_SEARCH_OP_GT
const DP_SEARCH_OP_GT
Identifies the generic data provider greater than operator (>) for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:66
DataProvider::DP_SEARCH_OP_IN
const DP_SEARCH_OP_IN
Identifies the generic data provider "in" operator for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:91
DataProvider::dp_op_between
hash< SearchOperatorInfo > dp_op_between(auto l, auto r)
returns an SearchOperatorInfo hash for the "between" operator with the given arguments
DataProvider::dp_op_lt
hash< SearchOperatorInfo > dp_op_lt(auto arg)
returns an SearchOperatorInfo hash for the "<" operator with the given argument
DataProvider::dp_op_regex
hash< SearchOperatorInfo > dp_op_regex(string str)
returns an SearchOperatorInfo hash for regular expression matches
DataProvider::DP_SEARCH_OP_GE
const DP_SEARCH_OP_GE
Identifies the generic data provider greater than or equals operator (>=) for use in generic search c...
Definition: AbstractDataProviderRecordIterator.qc.dox.h:71
DataProvider::DP_SEARCH_OP_BETWEEN
const DP_SEARCH_OP_BETWEEN
Identifies the generic data provider "between" operator for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:86
DataProvider::DefaultGenericSearchOpMap
const DefaultGenericSearchOpMap
a hash of valid operators for use in generic search criteria
Definition: AbstractDataProviderRecordIterator.qc.dox.h:106
DataProvider::DP_OP_AND
const DP_OP_AND
AND logic.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:38
DataProvider::DP_SEARCH_OP_NE
const DP_SEARCH_OP_NE
Identifies the generic data provider not equals operator (!= or <>) for use in generic search criteri...
Definition: AbstractDataProviderRecordIterator.qc.dox.h:76
DataProvider::DP_SEARCH_OP_NOT
const DP_SEARCH_OP_NOT
Identifies the generic data provider "not" operator for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:96
DataProvider::dp_op_like
hash< SearchOperatorInfo > dp_op_like(string str)
returns an SearchOperatorInfo hash for the SQL-like "like" operator with the given argument
DataProvider::dp_op_eq
hash< SearchOperatorInfo > dp_op_eq(auto arg)
returns an SearchOperatorInfo hash for the "=" operator with the given argument
DataProvider::dp_op_gt
hash< SearchOperatorInfo > dp_op_gt(auto arg)
returns an SearchOperatorInfo hash for the ">" operator with the given argument
DataProvider::dp_op_not
hash< SearchOperatorInfo > dp_op_not(hash< auto > arg)
returns an SearchOperatorInfo hash for the "not" operator
DataProvider::DP_SEARCH_OP_LT
const DP_SEARCH_OP_LT
Identifies the generic data provider less than (<) operator for use in generic search criteria.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:56
DataProvider::dp_op_le
hash< SearchOperatorInfo > dp_op_le(auto arg)
returns an SearchOperatorInfo hash for the "<=" operator with the given argument
DataProvider::dp_op_ne
hash< SearchOperatorInfo > dp_op_ne(auto arg)
returns an SearchOperatorInfo hash for the "!=" or "<>" operator with the given argument
DataProvider::DP_SEARCH_OP_LE
const DP_SEARCH_OP_LE
Identifies the generic data provider less than or equals (<=) operator for use in generic search crit...
Definition: AbstractDataProviderRecordIterator.qc.dox.h:61
DataProvider::dp_make_op
hash< SearchOperatorInfo > dp_make_op(string op, auto arg)
returns an SearchOperatorInfo hash
DataProvider::SearchOperatorInfo
Generic operator info hash as returned by all generic search operator functions.
Definition: AbstractDataProviderRecordIterator.qc.dox.h:100
DataProvider::SearchOperatorInfo::op
string op
the operator string code
Definition: AbstractDataProviderRecordIterator.qc.dox.h:101
DataProvider::SearchOperatorInfo::arg
auto arg
optional argument
Definition: AbstractDataProviderRecordIterator.qc.dox.h:102