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

future-architect / uroborosql / #743

28 Jun 2024 04:17PM UTC coverage: 90.988% (+0.5%) from 90.484%
#743

push

web-flow
add paramIfNotEmpty method (#318)

* v0.x to master merge

* fix nanoseconds diff (java8 to java11)

* eclipse cleanup and  optimize import

* eclipse format

* optimize Imports

* remove unused annotation

* library version up

* migrate v0.x to master
- update java version 8 to 11
- update junit4 to junit5
- library version update

* fix test failed

* remove unused annotation

* fixed bug

* use var

* fix java8 coding style

* Refactoring TransactionContextManager

* Refactoring SqlAgent

* 途中コミット

* fix testcase

* fix review

* fix javadoc comments

* merge v0.x PR

* cleanup code

* cleanup test code

* change build status badge

* - agent.query, update, proc, batch にそれぞれSupplierを引数にとるメソッドを追加
- SqlQuery.paramとSqlEntityUpdate.setにFunctionを受け取るメソッドを追加

* testcaseの整形

* - SqlFluent と ExtractionCondition の分離
- Arrays.asList -> List.of への変更
- テストの整形

* - v0.x系の不具合対応の追いつき
- ログ出力の整理

* - SqlKindの整理(ENTITY_XXXの追加)
- REPL_LOGの追加
- Deprecatedメソッドの削除(SqlAgent)
- SqlAgent, ExecutionContextでsetterをfluent APIに変更

* DB接続URLの修正

* add and fix testcases.

* add event testcases.

* fix typo

* add paramIfNotEmpty method and StringUtils rename ObjectUtils

* fix review comments.

* remove unused import

1695 of 1958 new or added lines in 97 files covered. (86.57%)

26 existing lines in 10 files now uncovered.

8249 of 9066 relevant lines covered (90.99%)

0.91 hits per line

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

5.56
/src/main/java/jp/co/future/uroborosql/parameter/mapper/JdbcParameterFactory.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.parameter.mapper;
8

9
import java.sql.Array;
10
import java.sql.Blob;
11
import java.sql.Clob;
12
import java.sql.Connection;
13
import java.sql.NClob;
14
import java.sql.SQLException;
15
import java.sql.SQLXML;
16
import java.sql.Struct;
17

18
import jp.co.future.uroborosql.exception.UroborosqlRuntimeException;
19

20
/**
21
 * JDBCパラメータ生成器
22
 *
23
 * @author ota
24
 */
25
public final class JdbcParameterFactory {
26
        /**
27
         * コンストラクタ
28
         */
29
        private JdbcParameterFactory() {
30
        }
31

32
        /**
33
         * {@link java.sql.Connection#createArrayOf(String, Object[])}のラッパー
34
         *
35
         * @param conn コネクション
36
         * @param typeName 配列の要素がマッピングされる型のSQL名。typeNameはデータベース固有の名前で、組込み型、ユーザー定義型、またはこのデータベースでサポートされる標準SQL型の名前のこと。これは、Array.getBaseTypeNameで返される値
37
         * @param elements 返されるオブジェクトを生成する要素
38
         * @return 指定されたSQL型に要素がマッピングされるArrayオブジェクト
39
         *
40
         * @see java.sql.Connection#createArrayOf(String, Object[])
41
         */
42
        public static Array createArrayOf(final Connection conn, final String typeName, final Object[] elements) {
43
                try {
44
                        return conn.createArrayOf(typeName, elements);
1✔
NEW
45
                } catch (SQLException ex) {
×
NEW
46
                        throw new UroborosqlRuntimeException(ex);
×
47
                }
48
        }
49

50
        /**
51
         * {@link java.sql.Connection#createBlob()}のラッパー
52
         *
53
         * @param conn コネクション
54
         * @return Blobインタフェースを実装しているオブジェクト
55
         *
56
         * @see java.sql.Connection#createBlob()
57
         */
58
        public static Blob createBlob(final Connection conn) {
59
                try {
60
                        return conn.createBlob();
×
NEW
61
                } catch (SQLException ex) {
×
NEW
62
                        throw new UroborosqlRuntimeException(ex);
×
63
                }
64
        }
65

66
        /**
67
         * {@link java.sql.Connection#createClob()}のラッパー
68
         *
69
         * @param conn コネクション
70
         * @return Clobインタフェースを実装しているオブジェクト
71
         *
72
         * @see java.sql.Connection#createClob()
73
         */
74
        public static Clob createClob(final Connection conn) {
75
                try {
76
                        return conn.createClob();
×
NEW
77
                } catch (SQLException ex) {
×
NEW
78
                        throw new UroborosqlRuntimeException(ex);
×
79
                }
80
        }
81

82
        /**
83
         * {@link java.sql.Connection#createNClob()}のラッパー
84
         *
85
         * @param conn コネクション
86
         * @return NClobインタフェースを実装しているオブジェクト
87
         *
88
         * @see java.sql.Connection#createNClob()
89
         */
90
        public static NClob createNClob(final Connection conn) {
91
                try {
92
                        return conn.createNClob();
×
NEW
93
                } catch (SQLException ex) {
×
NEW
94
                        throw new UroborosqlRuntimeException(ex);
×
95
                }
96
        }
97

98
        /**
99
         * {@link java.sql.Connection#createSQLXML()}のラッパー
100
         *
101
         * @param conn コネクション
102
         * @return SQLXMLインタフェースを実装しているオブジェクト
103
         *
104
         * @see java.sql.Connection#createSQLXML()
105
         */
106
        public static SQLXML createSQLXML(final Connection conn) {
107
                try {
108
                        return conn.createSQLXML();
×
NEW
109
                } catch (SQLException ex) {
×
NEW
110
                        throw new UroborosqlRuntimeException(ex);
×
111
                }
112
        }
113

114
        /**
115
         * {@link java.sql.Connection#createStruct(String, Object[])}のラッパー
116
         *
117
         * @param conn コネクション
118
         * @param typeName このStructオブジェクトがマッピングされるSQL構造化型のSQL型名。typeNameは、このデータベースに定義されたユーザー定義型の名前。これは、Struct.getSQLTypeNameで返される値。
119
         * @param attributes 返されるオブジェクトを生成する属性
120
         * @return 指定されたSQL型にマッピングされ、かつ指定された属性で生成されるStructオブジェクト
121
         *
122
         * @see java.sql.Connection#createStruct(String, Object[])
123
         */
124
        public static Struct createStruct(final Connection conn, final String typeName, final Object[] attributes) {
125
                try {
126
                        return conn.createStruct(typeName, attributes);
×
NEW
127
                } catch (SQLException ex) {
×
NEW
128
                        throw new UroborosqlRuntimeException(ex);
×
129
                }
130
        }
131
}
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

© 2025 Coveralls, Inc