Qore SqlUtil Module Reference  1.5
SQL Update Operator Functions

Functions

hash< UpdateOperatorInfoSqlUtil::make_uop (string uop, auto arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash More...
 
hash< UpdateOperatorInfoSqlUtil::uop_append (string arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash for the "append" or concatenate operator with the given argument More...
 
hash< UpdateOperatorInfoSqlUtil::uop_divide (auto arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash for the "/" operator with the given arguments More...
 
hash< UpdateOperatorInfoSqlUtil::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< UpdateOperatorInfoSqlUtil::uop_minus (auto arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash for the "-" operator with the given arguments More...
 
hash< UpdateOperatorInfoSqlUtil::uop_multiply (auto arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash for the "*" operator with the given arguments More...
 
hash< UpdateOperatorInfoSqlUtil::uop_plus (auto arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash for the "+" operator with the given arguments More...
 
hash< UpdateOperatorInfoSqlUtil::uop_prepend (string arg, *hash< UpdateOperatorInfo > nest)
 returns an UpdateOperatorInfo hash for the "prepend" operator with the given argument More...
 
hash< UpdateOperatorInfoSqlUtil::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< UpdateOperatorInfoSqlUtil::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< UpdateOperatorInfoSqlUtil::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< UpdateOperatorInfoSqlUtil::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:

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
uopthe update operator (one of SQL Update Operators)
argthe argument to the operator
nestany 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
argthe text to prepend to the row values in the output column
nestany 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
argnumeric value to divide the column by
nestany 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
nestany 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
argnumeric value to subtract from the column
nestany 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
argnumeric value to multiply the column by
nestany 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
argnumeric value to add to the column
nestany 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
argthe text to prepend to the row values in the output column
nestany 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
seqthe 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
seqthe 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
startposition where the substring starts
countlength of the substring in characters
nestany 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
nestany nested operation to the operator
Returns
an UpdateOperatorInfo hash corresponding to the arguments for use in update statements