| 1 |
/* |
| 2 |
* Copyright 2004-2023 H2 Group. Multiple-Licensed under the MPL 2.0, |
| 3 |
* and the EPL 1.0 (https://h2database.com/html/license.html). |
| 4 |
* Initial Developer: H2 Group |
| 5 |
*/ |
| 6 |
package org.h2.mode; |
| 7 |
|
| 8 |
/** |
| 9 |
* This class contains information about a built-in function. |
| 10 |
*/ |
| 11 |
public final class FunctionInfo { |
| 12 |
|
| 13 |
/** |
| 14 |
* The name of the function. |
| 15 |
*/ |
| 16 |
public final String name; |
| 17 |
|
| 18 |
/** |
| 19 |
* The function type. |
| 20 |
*/ |
| 21 |
public final int type; |
| 22 |
|
| 23 |
/** |
| 24 |
* The number of parameters. |
| 25 |
*/ |
| 26 |
final int parameterCount; |
| 27 |
|
| 28 |
/** |
| 29 |
* The data type of the return value. |
| 30 |
*/ |
| 31 |
public final int returnDataType; |
| 32 |
|
| 33 |
/** |
| 34 |
* If the result of the function is NULL if any of the parameters is NULL. |
| 35 |
*/ |
| 36 |
public final boolean nullIfParameterIsNull; |
| 37 |
|
| 38 |
/** |
| 39 |
* If this function always returns the same value for the same parameters. |
| 40 |
*/ |
| 41 |
public final boolean deterministic; |
| 42 |
|
| 43 |
/** |
| 44 |
* Creates new instance of built-in function information. |
| 45 |
* |
| 46 |
* @param name |
| 47 |
* the name of the function |
| 48 |
* @param type |
| 49 |
* the function type |
| 50 |
* @param parameterCount |
| 51 |
* the number of parameters |
| 52 |
* @param returnDataType |
| 53 |
* the data type of the return value |
| 54 |
* @param nullIfParameterIsNull |
| 55 |
* if the result of the function is NULL if any of the parameters |
| 56 |
* is NULL |
| 57 |
* @param deterministic |
| 58 |
* if this function always returns the same value for the same |
| 59 |
* parameters |
| 60 |
*/ |
| 61 |
public FunctionInfo(String name, int type, int parameterCount, int returnDataType, boolean nullIfParameterIsNull, |
| 62 |
boolean deterministic) { |
| 63 |
this.name = name; |
| 64 |
this.type = type; |
| 65 |
this.parameterCount = parameterCount; |
| 66 |
this.returnDataType = returnDataType; |
| 67 |
this.nullIfParameterIsNull = nullIfParameterIsNull; |
| 68 |
this.deterministic = deterministic; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Creates a copy of built-in function information with a different name. A |
| 73 |
* copy will require parentheses. |
| 74 |
* |
| 75 |
* @param source |
| 76 |
* the source information |
| 77 |
* @param name |
| 78 |
* the new name |
| 79 |
*/ |
| 80 |
public FunctionInfo(FunctionInfo source, String name) { |
| 81 |
this.name = name; |
| 82 |
type = source.type; |
| 83 |
returnDataType = source.returnDataType; |
| 84 |
parameterCount = source.parameterCount; |
| 85 |
nullIfParameterIsNull = source.nullIfParameterIsNull; |
| 86 |
deterministic = source.deterministic; |
| 87 |
} |
| 88 |
|
| 89 |
} |