• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

torand / FasterSQL / 15346133148

30 May 2025 11:50AM UTC coverage: 70.397% (+0.1%) from 70.298%
15346133148

push

github

torand
chore: test javadoc publish

235 of 420 branches covered (55.95%)

Branch coverage included in aggregate %.

1237 of 1671 relevant lines covered (74.03%)

3.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/io/github/torand/fastersql/dialect/AnsiIsoDialect.java
1
/*
2
 * Copyright (c) 2024-2025 Tore Eide Andersen
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
 *      http://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 io.github.torand.fastersql.dialect;
17

18
import java.util.EnumSet;
19
import java.util.List;
20
import java.util.Optional;
21

22
import static io.github.torand.fastersql.dialect.Capability.LIMIT_OFFSET;
23
import static io.github.torand.fastersql.dialect.Capability.MODULO_OPERATOR;
24
import static io.github.torand.fastersql.dialect.Capability.SELECT_FOR_UPDATE;
25
import static io.github.torand.fastersql.dialect.Capability.TRUNCATE_TABLE;
26

27
/**
28
 * Defines the <a href="https://standards.iso.org/iso-iec/9075/-2/ed-6/en/ISO_IEC_9075-2(E)_Foundation.bnf.txt">ANSI/ISO</a> (ISO/IEC 9075) SQL dialect.
29
 */
30
public class AnsiIsoDialect implements Dialect {
31
    private static final EnumSet<Capability> SUPPORTED_CAPS = EnumSet.of(LIMIT_OFFSET, MODULO_OPERATOR, SELECT_FOR_UPDATE, TRUNCATE_TABLE);
×
32

33
    /**
34
     * Creates an ANSI/ISO {@link Dialect} implementation.
35
     */
36
    public AnsiIsoDialect() {}
×
37

38
    @Override
39
    public String getProductName() {
40
        return "ANSI/ISO";
×
41
    }
42

43
    @Override
44
    public boolean offsetBeforeLimit() {
45
        return true;
×
46
    }
47

48
    @Override
49
    public Optional<String> formatRowOffsetClause() {
50
        return Optional.of("offset ? rows");
×
51
    }
52

53
    @Override
54
    public Optional<String> formatRowLimitClause() {
55
        return Optional.of("fetch next ? rows only");
×
56
    }
57

58
    @Override
59
    public Optional<String> formatRowNumLiteral() {
60
        return Optional.empty();
×
61
    }
62

63
    @Override
64
    public String formatToNumberFunction(String operand, int precision, int scale) {
65
        return "to_number(%s)".formatted(operand);
×
66
    }
67

68
    @Override
69
    public String formatToCharFunction(String operand, String format) {
70
        return "to_char(%s, %s)".formatted(operand, format);
×
71
    }
72

73
    @Override
74
    public String formatSubstringFunction(String operand, int startPos, int length) {
75
        return "substring(" + operand + ", " + startPos + ", " + length + ")";
×
76
    }
77

78
    @Override
79
    public String formatConcatFunction(List<String> operands) {
80
        return "concat(%s)".formatted(String.join(", ", operands));
×
81
    }
82

83
    @Override
84
    public String formatLengthFunction(String operand) {
85
        return "length(" + operand + ")";
×
86
    }
87

88
    @Override
89
    public String formatCeilFunction(String operand) {
90
        return "ceil(" + operand + ")";
×
91
    }
92

93
    @Override
94
    public String formatRoundFunction(String operand) {
95
        return "round(" + operand + ")";
×
96
    }
97

98
    @Override
99
    public String formatModuloFunction(String divisor, String dividend) {
100
        throw new UnsupportedOperationException("ANSI/ISO SQL does not support the mod() function (use the modulo infix operator instead)");
×
101
    }
102

103
    @Override
104
    public String formatCurrentDateFunction() {
105
        return "current_date";
×
106
    }
107

108
    @Override
109
    public Optional<String> getConcatOperator() {
110
        return Optional.of("||");
×
111
    }
112

113
    @Override
114
    public boolean supports(Capability capability) {
115
        return SUPPORTED_CAPS.contains(capability);
×
116
    }
117
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc