Class ToChar
java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.scalar.conversion.ToChar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes the function's result over its already-evaluated argument values.intThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).intThe fewest arguments a call to this function may pass; fewer is an argument-count error.structuredRejection(int position) A plain OBJECT or ARRAY renders to its JSON text; a STRUCTURED value has no text conversion at all.vectorRejection(int position) A VECTOR has no text conversion, and the refusal is the SAME sentence a structured value gets — live quotes the whole call and names the conversion the written spelling routes through, soTO_CHAR(v)reports 'TO_CHAR' whereTO_VARCHAR(v)reports 'TO_VARCHAR'.Methods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, binaryRejection, booleanRejection, evaluate, fileRejection, geoRejection, getName, getReturnType, isVariadic, refusesMissingArgumentsByType, semiStructuredRejection, temporalRejection, temporalRejection, temporalRejection, textRejection, uuidRejection
-
Constructor Details
-
ToChar
public ToChar()
-
-
Method Details
-
structuredRejection
A plain OBJECT or ARRAY renders to its JSON text; a STRUCTURED value has no text conversion at all. Live,TO_VARCHAR(o)is{"k":"v1"}andTO_CHAR(a)is[1,2], whileTO_VARCHAR(so)is "invalid type [TO_VARCHAR(ST.SO)] for parameter 'TO_VARCHAR'" andTO_CHAR(so)the same sentence for 'TO_CHAR' — the parameter named is the name as WRITTEN, which is why one registered object serves both spellings. All three structured kinds refuse alike, and theCASTspellings of the same conversion are rejected by their own rule since they are not function calls.Position 0 only:
TO_VARCHAR(so, 'x')does fail live, but it fails for the ARGUMENT, naming the whole call — nothing has been measured about a structured value in the FORMAT position.- Overrides:
structuredRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the extra refusal this position gives a structured value, or
NONEwhen undeclared
-
vectorRejection
A VECTOR has no text conversion, and the refusal is the SAME sentence a structured value gets — live quotes the whole call and names the conversion the written spelling routes through, soTO_CHAR(v)reports 'TO_CHAR' whereTO_VARCHAR(v)reports 'TO_VARCHAR'.Position 0 only, and the ARGUMENT beats the ARITY: live gives
TO_VARCHAR(v, 'x')this same refusal rather than complaining about the format argument, echoing the format in the quoted call.- Overrides:
vectorRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a VECTOR value; by default none
-
evaluate
Description copied from class:BuiltInFunctionComputes the function's result over its already-evaluated argument values. A SQL NULL argument arrives as Javanull, and returningnullmakes the SQL result NULL.- Specified by:
evaluatein classBuiltInFunction- Parameters:
args- the argument values, in call order- Returns:
- the function's value for these arguments, or
nullfor SQL NULL
-
getMinArgCount
public int getMinArgCount()Description copied from class:BuiltInFunctionThe fewest arguments a call to this function may pass; fewer is an argument-count error.- Specified by:
getMinArgCountin classBuiltInFunction- Returns:
- the minimum accepted argument count
-
getMaxArgCount
public int getMaxArgCount()Description copied from class:BuiltInFunctionThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).- Specified by:
getMaxArgCountin classBuiltInFunction- Returns:
- the maximum accepted argument count
-