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

future-architect / uroborosql / #893

17 Aug 2025 05:16PM UTC coverage: 88.615% (+0.1%) from 88.472%
#893

Pull #364

HidekiSugimoto189
add null guard
Pull Request #364: Add ConnectionSupplier Fix schema name option.

130 of 142 new or added lines in 5 files covered. (91.55%)

2 existing lines in 1 file now uncovered.

8204 of 9258 relevant lines covered (88.62%)

0.89 hits per line

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

66.67
/src/main/java/jp/co/future/uroborosql/connection/ConnectionSupplier.java
1
/**
2
 * Copyright (c) 2017-present, Future Corporation
3
 *
4
 * This source code is licensed under the MIT license found in the
5
 * LICENSE file in the root directory of this source tree.
6
 */
7
package jp.co.future.uroborosql.connection;
8

9
import java.sql.Connection;
10
import java.sql.DatabaseMetaData;
11
import java.sql.SQLException;
12

13
import jp.co.future.uroborosql.exception.UroborosqlSQLException;
14

15
/**
16
 * JDBCコネクション提供インターフェース
17
 *
18
 * @author H.Sugimoto
19
 */
20
public interface ConnectionSupplier {
21
        /**
22
         * コネクション取得。
23
         * @return コネクション
24
         */
25
        Connection getConnection();
26

27
        /**
28
         * コネクション取得。
29
         * @param ctx DB接続に使用するコンテキスト
30
         * @return コネクション
31
         */
32
        Connection getConnection(ConnectionContext ctx);
33

34
        /**
35
         * 接続しているDBプロダクト名+ バージョンを取得する
36
         *
37
         * @return DatabaseName + "-" + DatabaseVersion
38
         */
39
        default String getDatabaseName() {
40
                Connection conn = null;
1✔
41
                try {
42
                        conn = getConnection();
1✔
43
                        DatabaseMetaData metaData = conn.getMetaData();
1✔
44
                        return metaData.getDatabaseProductName() + "-" + metaData.getDatabaseMajorVersion() + "."
1✔
45
                                        + metaData.getDatabaseMinorVersion();
1✔
46
                } catch (SQLException ex) {
×
47
                        throw new UroborosqlSQLException(ex);
×
48
                } finally {
49
                        try {
50
                                if (conn != null && !conn.isClosed()) {
1✔
51
                                        conn.close();
1✔
52
                                }
UNCOV
53
                        } catch (SQLException ex) {
×
UNCOV
54
                                throw new UroborosqlSQLException(ex);
×
55
                        }
1✔
56
                }
57
        }
58
}
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