1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
30
30
*/
31
31
public class CallParameterMetaData {
32
32
33
+ private final boolean function ;
34
+
33
35
@ Nullable
34
- private String parameterName ;
36
+ private final String parameterName ;
35
37
36
- private int parameterType ;
38
+ private final int parameterType ;
37
39
38
- private int sqlType ;
40
+ private final int sqlType ;
39
41
40
42
@ Nullable
41
- private String typeName ;
43
+ private final String typeName ;
42
44
43
- private boolean nullable ;
45
+ private final boolean nullable ;
44
46
45
47
46
48
/**
47
- * Constructor taking all the properties.
49
+ * Constructor taking all the properties except the function marker .
48
50
*/
51
+ @ Deprecated
49
52
public CallParameterMetaData (
50
53
@ Nullable String columnName , int columnType , int sqlType , @ Nullable String typeName , boolean nullable ) {
51
54
55
+ this (false , columnName , columnType , sqlType , typeName , nullable );
56
+ }
57
+
58
+ /**
59
+ * Constructor taking all the properties including the function marker.
60
+ * @since 5.2.9
61
+ */
62
+ public CallParameterMetaData (boolean function , @ Nullable String columnName , int columnType ,
63
+ int sqlType , @ Nullable String typeName , boolean nullable ) {
64
+
65
+ this .function = function ;
52
66
this .parameterName = columnName ;
53
67
this .parameterType = columnType ;
54
68
this .sqlType = sqlType ;
@@ -58,15 +72,23 @@ public CallParameterMetaData(
58
72
59
73
60
74
/**
61
- * Get the parameter name.
75
+ * Return whether this parameter is declared in a function.
76
+ * @since 5.2.9
77
+ */
78
+ public boolean isFunction () {
79
+ return this .function ;
80
+ }
81
+
82
+ /**
83
+ * Return the parameter name.
62
84
*/
63
85
@ Nullable
64
86
public String getParameterName () {
65
87
return this .parameterName ;
66
88
}
67
89
68
90
/**
69
- * Get the parameter type.
91
+ * Return the parameter type.
70
92
*/
71
93
public int getParameterType () {
72
94
return this .parameterType ;
@@ -75,31 +97,33 @@ public int getParameterType() {
75
97
/**
76
98
* Determine whether the declared parameter qualifies as a 'return' parameter
77
99
* for our purposes: type {@link DatabaseMetaData#procedureColumnReturn} or
78
- * {@link DatabaseMetaData#procedureColumnResult}.
100
+ * {@link DatabaseMetaData#procedureColumnResult}, or in case of a function,
101
+ * {@link DatabaseMetaData#functionReturn}.
79
102
* @since 4.3.15
80
103
*/
81
104
public boolean isReturnParameter () {
82
- return (this .parameterType == DatabaseMetaData .procedureColumnReturn ||
83
- this .parameterType == DatabaseMetaData .procedureColumnResult );
105
+ return (this .function ? this .parameterType == DatabaseMetaData .functionReturn :
106
+ (this .parameterType == DatabaseMetaData .procedureColumnReturn ||
107
+ this .parameterType == DatabaseMetaData .procedureColumnResult ));
84
108
}
85
109
86
110
/**
87
- * Get the parameter SQL type.
111
+ * Return the parameter SQL type.
88
112
*/
89
113
public int getSqlType () {
90
114
return this .sqlType ;
91
115
}
92
116
93
117
/**
94
- * Get the parameter type name.
118
+ * Return the parameter type name.
95
119
*/
96
120
@ Nullable
97
121
public String getTypeName () {
98
122
return this .typeName ;
99
123
}
100
124
101
125
/**
102
- * Get whether the parameter is nullable.
126
+ * Return whether the parameter is nullable.
103
127
*/
104
128
public boolean isNullable () {
105
129
return this .nullable ;
0 commit comments