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

torand / FasterSQL / 15294773771

28 May 2025 08:01AM UTC coverage: 70.078% (+0.2%) from 69.877%
15294773771

Pull #31

github

web-flow
Merge 9f1c324c0 into 6be86da23
Pull Request #31: feat: add support for SQLite dialect

233 of 418 branches covered (55.74%)

Branch coverage included in aggregate %.

28 of 33 new or added lines in 12 files covered. (84.85%)

45 existing lines in 10 files now uncovered.

1212 of 1644 relevant lines covered (73.72%)

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

35
    @Override
36
    public String getProductName() {
UNCOV
37
        return "ANSI/ISO";
×
38
    }
39

40
    @Override
41
    public boolean offsetBeforeLimit() {
UNCOV
42
        return true;
×
43
    }
44

45
    @Override
46
    public Optional<String> formatRowOffsetClause() {
UNCOV
47
        return Optional.of("offset ? rows");
×
48
    }
49

50
    @Override
51
    public Optional<String> formatRowLimitClause() {
UNCOV
52
        return Optional.of("fetch next ? rows only");
×
53
    }
54

55
    @Override
56
    public Optional<String> formatRowNumLiteral() {
UNCOV
57
        return Optional.empty();
×
58
    }
59

60
    @Override
61
    public String formatToNumberFunction(String operand, int precision, int scale) {
UNCOV
62
        return "to_number(%s)".formatted(operand);
×
63
    }
64

65
    @Override
66
    public String formatToCharFunction(String operand, String format) {
UNCOV
67
        return "to_char(%s, %s)".formatted(operand, format);
×
68
    }
69

70
    @Override
71
    public String formatSubstringFunction(String operand, int startPos, int length) {
UNCOV
72
        return "substring(" + operand + ", " + startPos + ", " + length + ")";
×
73
    }
74

75
    @Override
76
    public String formatConcatFunction(List<String> operands) {
UNCOV
77
        return "concat(%s)".formatted(String.join(", ", operands));
×
78
    }
79

80
    @Override
81
    public String formatLengthFunction(String operand) {
UNCOV
82
        return "length(" + operand + ")";
×
83
    }
84

85
    @Override
86
    public String formatCeilFunction(String operand) {
UNCOV
87
        return "ceil(" + operand + ")";
×
88
    }
89

90
    @Override
91
    public String formatRoundFunction(String operand) {
UNCOV
92
        return "round(" + operand + ")";
×
93
    }
94

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

100
    @Override
101
    public String formatCurrentDateFunction() {
UNCOV
102
        return "current_date";
×
103
    }
104

105
    @Override
106
    public Optional<String> getConcatOperator() {
UNCOV
107
        return Optional.of("||");
×
108
    }
109

110
    @Override
111
    public boolean supports(Capability capability) {
UNCOV
112
        return SUPPORTED_CAPS.contains(capability);
×
113
    }
114
}
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