CDSRestDataProvider Namespace Reference

Qore CDSRestDataProviderDefs definitions. More...

## Classes

struct | QueryOperatorInfo
| Query operator info hash as returned by all operator functions. More...

## Functions

hash< QueryOperatorInfo > | query_make_op (string op, auto arg)
| returns an QueryOperatorInfo hash
hash< QueryOperatorInfo > | query_op_contains (string str)
| returns an QueryOperatorInfo hash for the `"contains"` operator with the given argument for use in cds queries More...
hash< QueryOperatorInfo > | query_op_eq (auto arg)
| returns an QueryOperatorInfo hash for the `"="` operator with the given argument for use in cds queries when comparing column values to immediate values More...
hash< QueryOperatorInfo > | query_op_ge (auto arg)
| returns an QueryOperatorInfo hash for the `">="` operator with the given argument for use in cds queries when comparing column values to immediate values More...
hash< QueryOperatorInfo > | query_op_gt (auto arg)
| returns an QueryOperatorInfo hash for the `">"` operator with the given argument for use in cds queries when comparing column values to immediate values More...
hash< QueryOperatorInfo > | query_op_le (auto arg)
| returns an QueryOperatorInfo hash for the `"<="` operator with the given argument for use in cds queries when comparing column values to immediate values More...
hash< QueryOperatorInfo > | query_op_like (string str)
| returns an QueryOperatorInfo hash for the `"contains"` operator with the given argument for use in cds queries More...
hash< QueryOperatorInfo > | query_op_lt (auto arg)
| returns an QueryOperatorInfo hash for the `"<"` operator with the given argument for use in cds queries when comparing column values to immediate values More...
hash< QueryOperatorInfo > | query_op_ne (auto arg)
| returns an QueryOperatorInfo hash for the `"!="` or `"<>"` operator with the given argument for use in cds queries when comparing column values to immediate values More...
hash< QueryOperatorInfo > | query_op_not (hash arg)
| returns an QueryOperatorInfo hash for the `"not"` operator; for use in cds queries More...
hash< string, hash< QueryOperatorInfo > > | query_wop_or (hash< auto > h1, hash< auto > h2)
| returns an QueryOperatorInfo hash with a fake `"_OR_"` column name; the list of arguments to the function is combined such that each hash in the list generates SQL expressions combined with "and" logic, and each of those clauses is combined with "or" logic; this is for use in cds queries More...

## Variables

const | DefaultQueryOpMap = ...
| a hash of valid operators for use in queries
const | QUERY_OP_CONTAINS = "contains"
| like/contains operator
const | QUERY_OP_ENDSWITH = "endswith"
| like/contains operator
const | QUERY_OP_EQ = "eq"
| the Query equals operator (=) for use in queries More...
const | QUERY_OP_GE = "ge"
| the Query greater than or equals operator (>=) for use in queries More...
const | QUERY_OP_GT = "gt"
| the Query greater than operator (>) for use in queries More...
const | QUERY_OP_LE = "le"
| the Query less than or equals (<=) operator for use in queries More...
const | QUERY_OP_LT = "lt"
| the Query less than (<) operator for use in queries More...
const | QUERY_OP_NE = "ne"
| the Query not equals operator (!= or <>) for use in queries More...
const | QUERY_OP_NOT = "not"
| the Query `"not"` operator for use in queries More...
const | QUERY_OP_OR = "or"
| to combine Query expressions with `"or"` for use in queries More...
const | QUERY_OP_STARTSWITH = "startswith"
| like/contains operator

## Detailed Description

Qore CDSRestDataProviderDefs definitions.

CDSRestDataProviderDefs.qc Copyright 2020 Qore Technologies, s.r.o.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. contains all public definitions in the CDSRestDataProvider module

## Function Documentation

## query_op_contains()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_contains | ( | string | str | ) |

returns an QueryOperatorInfo hash for the `"contains"` operator with the given argument for use in cds queries

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_contains("%smith%")});

Parameters

  str | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_eq()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_eq | ( | auto | arg | ) |

returns an QueryOperatorInfo hash for the `"="` operator with the given argument for use in cds queries when comparing column values to immediate values

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_eq("Smith")});

Parameters

  arg | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_ge()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_ge | ( | auto | arg | ) |

returns an QueryOperatorInfo hash for the `">="` operator with the given argument for use in cds queries when comparing column values to immediate values

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_ge("Apple")});

Parameters

  arg | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_gt()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_gt | ( | auto | arg | ) |

returns an QueryOperatorInfo hash for the `">"` operator with the given argument for use in cds queries when comparing column values to immediate values

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_gt("Apple")});

Parameters

  arg | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_le()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_le | ( | auto | arg | ) |

returns an QueryOperatorInfo hash for the `"<="` operator with the given argument for use in cds queries when comparing column values to immediate values

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_le("Zebra")});

Parameters

  arg | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_like()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_like | ( | string | str | ) |

returns an QueryOperatorInfo hash for the `"contains"` operator with the given argument for use in cds queries

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_like("%smith%")});

Parameters

  str | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_lt()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_lt | ( | auto | arg | ) |

returns an QueryOperatorInfo hash for the `"<"` operator with the given argument for use in cds queries when comparing column values to immediate values

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_lt("Zebra")});

Parameters

  arg | the argument for the operator

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_op_ne()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_ne | ( | auto | arg | ) |

returns an QueryOperatorInfo hash for the `"!="` or `"<>"` operator with the given argument for use in cds queries when comparing column values to immediate values

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Name": query_op_ne("Smith")});

Parameters

  arg | the argument for the operator

## query_op_not()

hash<QueryOperatorInfo> CDSRestDataProvider::query_op_not | ( | hash | arg | ) |

returns an QueryOperatorInfo hash for the `"not"` operator; for use in cds queries

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"name": query_op_not(query_op_eq(name))});

Returns
  an QueryOperatorInfo hash for use in cds queries

## query_wop_or()

hash<string, hash<QueryOperatorInfo> > CDSRestDataProvider::query_wop_or | ( | hash< auto > | h1,
|  | hash< auto > | h2
| ) |  |

returns an QueryOperatorInfo hash with a fake `"_OR_"` column name; the list of arguments to the function is combined such that each hash in the list generates SQL expressions combined with "and" logic, and each of those clauses is combined with "or" logic; this is for use in cds queries

Example:
  AbstractDataProviderRecordIterator i = provider.searchRecords({"Id": id} + query_wop_or({"Type": "C", "ValidationFlag": query_op_ne("Y")}, {"ExpirationFlag": 'Y'}));

Parameters

  h1 | the first hash of expressions to combine with `"or"` logic
  h2 | the second hash of expressions to combine with `"or"` logic
  ... | remaining expressions to combine with `"or"` logic

Returns
  a hash with an QueryOperatorInfo hash value keyed by a fake column name (`"_OR_"` with a numeric prefix for uniqueness) for use in a where operation description hash for use in cds queries

Note
  a random prefix is used so that multiple uses of the function can be used to generate a single where clause hash

## Variable Documentation

## QUERY_OP_EQ

const CDSRestDataProvider::QUERY_OP_EQ = "eq"

the Query equals operator (=) for use in queries

See also
  query_op_eq()

## QUERY_OP_GE

const CDSRestDataProvider::QUERY_OP_GE = "ge"

the Query greater than or equals operator (>=) for use in queries

See also
  query_op_ge()

## QUERY_OP_GT

const CDSRestDataProvider::QUERY_OP_GT = "gt"

the Query greater than operator (>) for use in queries

See also
  query_op_gt()

## QUERY_OP_LE

const CDSRestDataProvider::QUERY_OP_LE = "le"

the Query less than or equals (<=) operator for use in queries

See also
  query_op_le()

## QUERY_OP_LT

const CDSRestDataProvider::QUERY_OP_LT = "lt"

the Query less than (<) operator for use in queries

See also
  query_op_lt()

## QUERY_OP_NE

const CDSRestDataProvider::QUERY_OP_NE = "ne"

the Query not equals operator (!= or <>) for use in queries

See also
  query_op_ne()

## QUERY_OP_NOT

const CDSRestDataProvider::QUERY_OP_NOT = "not"

the Query `"not"` operator for use in queries

See also
  query_op_not()

## QUERY_OP_OR

const CDSRestDataProvider::QUERY_OP_OR = "or"

to combine Query expressions with `"or"` for use in queries

See also
  query_wquery_op_or()