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

torand / FasterSQL / 13432247935

20 Feb 2025 09:38AM UTC coverage: 61.863% (-0.5%) from 62.338%
13432247935

push

github

torand
feat: add ANSI/ISO SQL dialect

168 of 350 branches covered (48.0%)

Branch coverage included in aggregate %.

0 of 14 new or added lines in 2 files covered. (0.0%)

888 of 1357 relevant lines covered (65.44%)

3.46 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 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

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

32
    @Override
33
    public String getProductName() {
NEW
34
        return "ANSI/ISO";
×
35
    }
36

37
    @Override
38
    public boolean offsetBeforeLimit() {
NEW
39
        return true;
×
40
    }
41

42
    @Override
43
    public Optional<String> formatRowOffsetClause() {
NEW
44
        return Optional.of("offset ? rows");
×
45
    }
46

47
    @Override
48
    public Optional<String> formatRowLimitClause() {
NEW
49
        return Optional.of("fetch next ? rows only");
×
50
    }
51

52
    @Override
53
    public Optional<String> formatRowNumLiteral() {
NEW
54
        return Optional.empty();
×
55
    }
56

57
    @Override
58
    public String formatToNumberFunction(String operand, int precision, int scale) {
NEW
59
        return "to_number(%s)".formatted(operand);
×
60
    }
61

62
    @Override
63
    public String formatToCharFunction(String operand, String format) {
NEW
64
        return "to_char(%s, %s)".formatted(operand, format);
×
65
    }
66

67
    @Override
68
    public String formatSubstringFunction(String operand, int startPos, int length) {
NEW
69
        return "substring(" + operand + ", " + startPos + ", " + length + ")";
×
70
    }
71

72
    @Override
73
    public String formatConcatFunction(List<String> operands) {
NEW
74
        return "concat(%s)".formatted(String.join(", ", operands));
×
75
    }
76

77
    @Override
78
    public String formatLengthFunction(String operand) {
NEW
79
        return "length(" + operand + ")";
×
80
    }
81

82
    @Override
83
    public boolean supports(Capability capability) {
NEW
84
        return SUPPORTED_CAPS.contains(capability);
×
85
    }
86
}
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