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

torand / FasterSQL / 15071216480

16 May 2025 02:49PM UTC coverage: 69.877% (+2.4%) from 67.475%
15071216480

push

github

web-flow
Merge pull request #30 from torand/access-support

Access support

229 of 414 branches covered (55.31%)

Branch coverage included in aggregate %.

105 of 152 new or added lines in 26 files covered. (69.08%)

3 existing lines in 3 files now uncovered.

1193 of 1621 relevant lines covered (73.6%)

3.92 hits per line

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

85.71
/src/main/java/io/github/torand/fastersql/dialect/AccessDialect.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.CONCAT_OPERATOR;
23
import static io.github.torand.fastersql.dialect.Capability.LIMIT_OFFSET;
24
import static io.github.torand.fastersql.dialect.Capability.SELECT_FOR_UPDATE;
25

26
/**
27
 * Defines the Access dialect.
28
 *
29
 * <a href="https://support.microsoft.com/en-us/office/Queries-93fb69b7-cfc1-4f3e-ab56-b0a01523bb50#ID0EAABAAA=SQL_syntax&id0ebbd=sql_syntax" />
30
 */
31
public class AccessDialect implements Dialect {
32
    private final EnumSet<Capability> supportedCaps;
33

34
    public AccessDialect() {
35
        this(EnumSet.of(LIMIT_OFFSET, SELECT_FOR_UPDATE, CONCAT_OPERATOR));
6✔
36
    }
1✔
37

38
    private AccessDialect(EnumSet<Capability> capabilities) {
2✔
39
        this.supportedCaps = EnumSet.copyOf(capabilities);
4✔
40
    }
1✔
41

42
    @Override
43
    public String getProductName() {
44
        return "Access";
2✔
45
    }
46

47
    @Override
48
    public boolean offsetBeforeLimit() {
49
        return true;
2✔
50
    }
51

52
    @Override
53
    public Optional<String> formatRowOffsetClause() {
54
        return Optional.of("offset ? rows");
3✔
55
    }
56

57
    @Override
58
    public Optional<String> formatRowLimitClause() {
59
        return Optional.of("fetch next ? rows only");
3✔
60
    }
61

62
    @Override
63
    public Optional<String> formatRowNumLiteral() {
NEW
64
        return Optional.empty();
×
65
    }
66

67
    @Override
68
    public String formatToNumberFunction(String operand, int precision, int scale) {
69
        return "val(" + operand + ")";
3✔
70
    }
71

72
    @Override
73
    public String formatToCharFunction(String operand, String format) {
NEW
74
        throw new UnsupportedOperationException("Access does not support the to_char() function");
×
75
    }
76

77
    @Override
78
    public String formatSubstringFunction(String operand, int startPos, int length) {
79
        return "substring(" + operand + ", " + startPos + ", " + length + ")";
5✔
80
    }
81

82
    @Override
83
    public String formatConcatFunction(List<String> operands) {
NEW
84
        throw new UnsupportedOperationException("Access does not support the concat() function (use the concat infix operator instead)");
×
85
    }
86

87
    @Override
88
    public String formatLengthFunction(String operand) {
89
        return "len(" + operand + ")";
3✔
90
    }
91

92
    @Override
93
    public String formatCeilFunction(String operand) {
94
        return "ceil(" + operand + ")";
3✔
95
    }
96

97
    @Override
98
    public String formatRoundFunction(String operand) {
99
        return "round(" + operand + ", 0)";
3✔
100
    }
101

102
    @Override
103
    public String formatModuloFunction(String divisor, String dividend) {
104
        return "mod(" + divisor + ", " + dividend + ")";
4✔
105
    }
106

107
    @Override
108
    public String formatCurrentDateFunction() {
109
        return "current_date";
2✔
110
    }
111

112
    @Override
113
    public Optional<String> getConcatOperator() {
114
        return Optional.of("&");
3✔
115
    }
116

117
    @Override
118
    public boolean supports(Capability capability) {
119
        return supportedCaps.contains(capability);
5✔
120
    }
121
}
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