SQL Update Operator Functions

## Functions

hash< UpdateOperatorInfo > | SqlUtil::make_uop (string uop, auto arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash More...
hash< UpdateOperatorInfo > | SqlUtil::uop_append (string arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"append"` or concatenate operator with the given argument More...
hash< UpdateOperatorInfo > | SqlUtil::uop_divide (auto arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"/"` operator with the given arguments More...
hash< UpdateOperatorInfo > | SqlUtil::uop_lower (*hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"lower"` operator with the given argument; returns a column value in lower case More...
hash< UpdateOperatorInfo > | SqlUtil::uop_minus (auto arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"-"` operator with the given arguments More...
hash< UpdateOperatorInfo > | SqlUtil::uop_multiply (auto arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"*"` operator with the given arguments More...
hash< UpdateOperatorInfo > | SqlUtil::uop_plus (auto arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"+"` operator with the given arguments More...
hash< UpdateOperatorInfo > | SqlUtil::uop_prepend (string arg, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"prepend"` operator with the given argument More...
hash< UpdateOperatorInfo > | SqlUtil::uop_seq (string seq)
| returns an UpdateOperatorInfo hash for the `"seq"` operator with the given argument giving the sequence name whose value should be returned More...
hash< UpdateOperatorInfo > | SqlUtil::uop_seq_currval (string seq)
| returns an UpdateOperatorInfo hash for the `"seq"` operator with the given argument giving the sequence name whose current value should be returned More...
hash< UpdateOperatorInfo > | SqlUtil::uop_substr (int start, *int count, *hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo hash for the `"substr"` operator with the given arguments; returns a substring of a column value More...
hash< UpdateOperatorInfo > | SqlUtil::uop_upper (*hash< UpdateOperatorInfo > nest)
| returns an UpdateOperatorInfo 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_substr(): extract a substring from a column
- uop_plus(): add a numeric value to a column
- uop_minus(): subtract a numeric value from a column
- uop_multiply(): multiply a column by a numeric value
- uop_divide(): divide a column by a numeric value
- uop_seq(): returns the value of the given sequence
- uop_seq_currval(): returns the last value issued in the current session for the given sequence

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

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

## Function Documentation

## make_uop()

hash<UpdateOperatorInfo> SqlUtil::make_uop | ( | string | uop,
|  | auto | arg,
|  | *hash< UpdateOperatorInfo > | nest
| ) |  |

returns an UpdateOperatorInfo hash

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 UpdateOperatorInfo 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

## uop_append()

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

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

Example:
  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 UpdateOperatorInfo hash corresponding to the arguments for use in update statements

## uop_divide()

hash<UpdateOperatorInfo> SqlUtil::uop_divide | ( | auto | arg,
|  | *hash< UpdateOperatorInfo > | nest
| ) |  |

returns an UpdateOperatorInfo hash for the `"/"` operator with the given arguments

Example:
  int rows_updated = t.update(("counter": uop_divide(2)));

Parameters

  arg | numeric value to divide the column by
  nest | any nested operation to the operator

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

## uop_lower()

hash<UpdateOperatorInfo> SqlUtil::uop_lower | ( | *hash< UpdateOperatorInfo > | nest | ) |

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

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

Parameters

  nest | any nested operation to the operator

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

## uop_minus()

hash<UpdateOperatorInfo> SqlUtil::uop_minus | ( | auto | arg,
|  | *hash< UpdateOperatorInfo > | nest
| ) |  |

returns an UpdateOperatorInfo hash for the `"-"` operator with the given arguments

Example:
  int rows_updated = t.update(("counter": uop_minus(1)));

Parameters

  arg | numeric value to subtract from the column
  nest | any nested operation to the operator

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

## uop_multiply()

hash<UpdateOperatorInfo> SqlUtil::uop_multiply | ( | auto | arg,
|  | *hash< UpdateOperatorInfo > | nest
| ) |  |

returns an UpdateOperatorInfo hash for the `"*"` operator with the given arguments

Example:
  int rows_updated = t.update(("counter": uop_multiply(2)));

Parameters

  arg | numeric value to multiply the column by
  nest | any nested operation to the operator

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

## uop_plus()

hash<UpdateOperatorInfo> SqlUtil::uop_plus | ( | auto | arg,
|  | *hash< UpdateOperatorInfo > | nest
| ) |  |

returns an UpdateOperatorInfo hash for the `"+"` operator with the given arguments

Example:
  int rows_updated = t.update(("counter": uop_plus(1)));

Parameters

  arg | numeric value to add to the column
  nest | any nested operation to the operator

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

## uop_prepend()

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

returns an UpdateOperatorInfo hash for the `"prepend"` operator with the given argument

Example:
  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 UpdateOperatorInfo hash corresponding to the arguments for use in update statements

## uop_seq()

hash<UpdateOperatorInfo> SqlUtil::uop_seq | ( | string | seq | ) |

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

Example:
  *list rows = t.update(("id": uop_seq("xid")), ("type": "user"));

Parameters

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

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

## uop_seq_currval()

hash<UpdateOperatorInfo> SqlUtil::uop_seq_currval | ( | string | seq | ) |

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

Example:
  *list rows = t.update(("id": uop_seq("xid")), ("type": "user"));

Parameters

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

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

## uop_substr()

hash<UpdateOperatorInfo> SqlUtil::uop_substr | ( | int | start,
|  | *int | count,
|  | *hash< UpdateOperatorInfo > | nest
| ) |  |

returns an UpdateOperatorInfo hash for the `"substr"` operator with the given arguments; returns a substring of a column value

Example:
  int rows_updated = t.update(("first_name": uop_substr(1, 1)));

Parameters

  start | position where the substring starts
  count | length of the substring in characters
  nest | any nested operation to the operator

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

## uop_upper()

hash<UpdateOperatorInfo> SqlUtil::uop_upper | ( | *hash< UpdateOperatorInfo > | nest | ) |

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

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

Parameters

  nest | any nested operation to the operator

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