File tree Expand file tree Collapse file tree 3 files changed +44
-19
lines changed
spring-data-relational/src/main/java/org/springframework/data/relational/core/sql Expand file tree Collapse file tree 3 files changed +44
-19
lines changed Original file line number Diff line number Diff line change 2929 * @author Jens Schauder
3030 * @since 2.3
3131 */
32- public class InlineQuery extends AbstractSegment implements TableLike {
32+ public class InlineQuery extends Subselect implements TableLike {
3333
34- private final Select select ;
3534 private final SqlIdentifier alias ;
3635
3736 InlineQuery (Select select , SqlIdentifier alias ) {
3837
3938 super (select );
4039
41- this .select = select ;
4240 this .alias = alias ;
4341 }
4442
@@ -81,10 +79,4 @@ public SqlIdentifier getName() {
8179 public SqlIdentifier getReferenceName () {
8280 return alias ;
8381 }
84-
85- @ Override
86- public String toString () {
87- return "(" + select + ") AS " + alias ;
88- }
89-
9082}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2022 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package org .springframework .data .relational .core .sql ;
17+
18+ /**
19+ * Baseclass for all kinds of "select in parenthesis".
20+ *
21+ * @since 3.1
22+ * @author Mark Paluch
23+ * @author Jens Schauder
24+ */
25+ public abstract class Subselect extends AbstractSegment {
26+
27+ private final Select select ;
28+
29+ protected Subselect (Select select ) {
30+ this .select = select ;
31+ }
32+
33+ public Select getSelect () {
34+ return select ;
35+ }
36+
37+ @ Override
38+ public String toString () {
39+ return "(" + select + ")" ;
40+ }
41+
42+ }
Original file line number Diff line number Diff line change 2121 * @author Jens Schauder
2222 * @since 1.1
2323 */
24- public class SubselectExpression extends AbstractSegment implements Expression {
25-
26- private final Select subselect ;
24+ public class SubselectExpression extends Subselect implements Expression {
2725
2826 SubselectExpression (Select subselect ) {
2927
3028 super (subselect );
31-
32- this .subselect = subselect ;
33- }
34-
35- @ Override
36- public String toString () {
37- return "(" + subselect + ")" ;
3829 }
3930}
You can’t perform that action at this time.
0 commit comments