Qore SqlUtil Module Reference: SQL Update Operator Functions

Qore SqlUtil Module Reference 1.2

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

All Classes Namespaces Functions Variables Groups Pages
Functions
SQL Update Operator Functions

## Functions
hash | SqlUtil::make_uop (string uop, any arg, *hash nest)
| returns a hash with `uop`, `arg`, and `nest` keys More...
hash | SqlUtil::uop_append (string arg, *hash nest)
| returns a hash for the `"append"` or concatenate operator with the given argument More...
hash | SqlUtil::uop_lower (*hash nest)
| returns a hash for the `"lower"` operator with the given argument; returns a column value in lower case More...
hash | SqlUtil::uop_prepend (string arg, *hash nest)
| returns a hash for the `"prepend"` operator with the given argument More...
hash | SqlUtil::uop_seq (string seq)
| returns a hash for the `"seq"` operator with the given argument giving the sequence name whose value should be returned More...
hash | SqlUtil::uop_upper (*hash nest)
| returns a hash for the `"upper"` operator with the given argument; returns a column value in upper case More...

## Detailed Description

These are functions that can be used as the values of update keys in select statements:

- uop_prepend(): prepend a string to the output of a column
- uop_append(): append a string to the output of a column
- uop_upper(): return a column in upper case
- uop_lower(): return a column in lower case
- uop_seq(): returns the value of the given sequence

Update operator functions can be nested as in the following example:

Example:
  my int $rows_updated = t.update(("permission_type": uop_append("-migrated", uop_lower())));

## Function Documentation

hash SqlUtil::make_uop | ( | string | uop,
|  | any | arg,
|  | *hash | nest
| ) |  |

returns a hash with `uop`, `arg`, and `nest` keys

Parameters

  uop | the update operator (one of SQL Update Operators)
  arg | the argument to the operator
  nest | any nested operation to the operator

Returns
  an update operator description hash corresponding to the arguments for use in update statements

Note
  Normally this function is not called directly, but rather by the other update operator functions

hash SqlUtil::uop_append | ( | string | arg,
|  | *hash | nest
| ) |  |

returns a hash for the `"append"` or concatenate operator with the given argument

Example:
  my int $rows_updated = t.update(("permission_type": uop_append("-migrated", uop_lower())));

Parameters

  arg | the text to prepend to the row values in the output column
  nest | any nested operation to the operator

Returns
  an update operator description hash corresponding to the arguments for use in update statements

hash SqlUtil::uop_lower | ( | *hash | nest | ) |

returns a hash for the `"lower"` operator with the given argument; returns a column value in lower case

Example:
  my int $rows_updated = t.update(("permission_type": uop_lower()));

Parameters

  nest | any nested operation to the operator

Returns
  an update operator description hash corresponding to the arguments for use in update statements

hash SqlUtil::uop_prepend | ( | string | arg,
|  | *hash | nest
| ) |  |

returns a hash for the `"prepend"` operator with the given argument

Example:
  my int $rows_updated = t.update(("permission_type": uop_prepend("migrated-", uop_lower())));

Parameters

  arg | the text to prepend to the row values in the output column
  nest | any nested operation to the operator

Returns
  an update operator description hash corresponding to the arguments for use in update statements

hash SqlUtil::uop_seq | ( | string | seq | ) |

returns a hash for the `"seq"` operator with the given argument giving the sequence name whose value should be returned

Example:
  my *list $rows = $table.selectRows(("columns": ("id", "name", cop_seq("xid")), "where": ("type": "user")));

Parameters

  seq | the name of the sequence whose value should be returned

Returns
  an update operator description hash corresponding to the arguments for use in update statements

hash SqlUtil::uop_upper | ( | *hash | nest | ) |

returns a hash for the `"upper"` operator with the given argument; returns a column value in upper case

Example:
  my int $rows_updated = t.update(("permission_type": uop_upper()));

Parameters

  nest | any nested operation to the operator

Returns
  an update operator description hash corresponding to the arguments for use in update statements