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

torand / FasterSQL / 13389227868

18 Feb 2025 11:10AM UTC coverage: 59.667% (+0.9%) from 58.785%
13389227868

push

github

torand
test: H2 specific testing of select and insert clauses

157 of 346 branches covered (45.38%)

Branch coverage included in aggregate %.

846 of 1335 relevant lines covered (63.37%)

3.35 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/MariaDbDialect.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.CONCAT_OPERATOR;
23
import static io.github.torand.fastersql.dialect.Capability.LIMIT_OFFSET;
24

25
public class MariaDbDialect implements Dialect {
×
26
    private static final EnumSet<Capability> SUPPORTED_CAPS = EnumSet.of(LIMIT_OFFSET, CONCAT_OPERATOR);
×
27

28
    @Override
29
    public String getProductName() {
30
        return "MariaDB";
×
31
    }
32

33
    @Override
34
    public boolean offsetBeforeLimit() {
35
        return true;
×
36
    }
37

38
    @Override
39
    public Optional<String> formatRowOffsetClause() {
40
        return Optional.of("offset ?");
×
41
    }
42

43
    @Override
44
    public Optional<String> formatRowLimitClause() {
45
        return Optional.of("limit ?");
×
46
    }
47

48
    @Override
49
    public Optional<String> formatRowNumLiteral() {
50
        return Optional.empty();
×
51
    }
52

53
    @Override
54
    public String formatToNumberFunction(String operand, int precision, int scale) {
55
        return "cast(" + operand + " as decimal(" + precision + "," + scale + "))";
×
56
    }
57

58
    @Override
59
    public String formatSubstringFunction(String operand, int startPos, int length) {
60
        return "substring(" + operand + ", " + startPos + ", " + length + ")";
×
61
    }
62

63
    @Override
64
    public String formatConcatFunction(List<String> operands) {
65
        throw new UnsupportedOperationException("Use the concat infix operator for MariaDb");
×
66
    }
67

68
    @Override
69
    public String formatLengthFunction(String operand) {
70
        return "char_length(" + operand + ")";
×
71
    }
72

73
    @Override
74
    public boolean supports(Capability capability) {
75
        return SUPPORTED_CAPS.contains(capability);
×
76
    }
77
}
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