• 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

92.86
/src/main/java/io/github/torand/fastersql/statement/TruncateStatement.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.statement;
17

18
import io.github.torand.fastersql.dialect.AnsiIsoDialect;
19
import io.github.torand.fastersql.model.Table;
20
import io.github.torand.fastersql.sql.Context;
21

22
import java.util.stream.Stream;
23

24
import static io.github.torand.fastersql.dialect.Capability.TRUNCATE_TABLE;
25
import static io.github.torand.fastersql.sql.Command.TRUNCATE;
26
import static java.util.Objects.requireNonNull;
27

28
/**
29
 * Implements a TRUNCATE statement.
30
 */
31
public class TruncateStatement implements PreparableStatement {
32
    private final Table<?> table;
33

34
    TruncateStatement(Table<?> table) {
2✔
35
        this.table = requireNonNull(table, "No table specified");
6✔
36
    }
1✔
37

38
    @Override
39
    public String sql(Context context) {
40
        final Context localContext = context.withCommand(TRUNCATE);
4✔
41

42
        StringBuilder sb = new StringBuilder();
4✔
43
        if (localContext.getDialect().supports(TRUNCATE_TABLE)) {
5✔
44
            sb.append("truncate table ");
5✔
45
        } else {
46
            sb.append("delete from ");
4✔
47
        }
48
        sb.append(table.sql(localContext));
7✔
49

50
        return sb.toString();
3✔
51
    }
52

53
    @Override
54
    public Stream<Object> params(Context context) {
55
        return Stream.empty();
2✔
56
    }
57

58
    @Override
59
    public String toString() {
UNCOV
60
        return toString(new AnsiIsoDialect());
×
61
    }
62
}
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