Skip to content

Commit

Permalink
inspect code by Intellij
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyangl committed Dec 17, 2024
1 parent a250930 commit 855efa2
Show file tree
Hide file tree
Showing 42 changed files with 370 additions and 388 deletions.
1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions .idea/findbugs-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 19 additions & 10 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions maven/0.0.1-SNAPSHOT/abacus-jdbc-0.0.1-SNAPSHOT.pom
Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@
<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-common</artifactId>
<version>5.6.5</version>
<version>5.6.8</version>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-query</artifactId>
<version>2.1.6</version>
<version>2.1.7</version>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-cache</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
</dependency>
</dependencies>

Expand Down
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,28 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
<version>1.18.36</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-common</artifactId>
<version>5.6.5</version>
<version>5.6.8</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-query</artifactId>
<version>2.1.6</version>
<version>2.1.7</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-cache</artifactId>
<version>1.2.7</version>
<version>1.2.8</version>
<scope>provided</scope>
</dependency>

Expand Down
42 changes: 23 additions & 19 deletions src/main/java/com/landawn/abacus/jdbc/AbstractQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,7 @@ public <T> This addBatchParameters(final Collection<? extends T> batchParameters
public This addBatchParameters(final Iterator<?> batchParameters) throws IllegalArgumentException, SQLException {
checkArgNotNull(batchParameters, s.batchParameters);

@SuppressWarnings("UnnecessaryLocalVariable")
final Iterator<?> iter = batchParameters;
boolean noException = false;

Expand Down Expand Up @@ -2840,6 +2841,7 @@ public <T> This addBatchParameters(final Iterator<? extends T> batchParameters,
checkArgNotNull(batchParameters, s.batchParameters);
checkArgNotNull(type, s.type);

@SuppressWarnings("UnnecessaryLocalVariable")
final Iterator<? extends T> iter = batchParameters;
final Type<T> setter = N.typeOf(type);
boolean noException = false;
Expand Down Expand Up @@ -2949,6 +2951,7 @@ public <T> This addBatchParameters(final Iterator<? extends T> batchParameters,
boolean noException = false;

try {
@SuppressWarnings("UnnecessaryLocalVariable")
final Iterator<? extends T> iter = batchParameters;

while (iter.hasNext()) {
Expand Down Expand Up @@ -3055,6 +3058,7 @@ public <T> This addBatchParameters(final Iterator<? extends T> batchParameters,
boolean noException = false;

try {
@SuppressWarnings("UnnecessaryLocalVariable")
final Iterator<? extends T> iter = batchParameters;

while (iter.hasNext()) {
Expand Down Expand Up @@ -3106,7 +3110,7 @@ public <T> This addBatchParameters(final Iterator<? extends T> batchParameters,
*
* @return this instance for method chaining
* @throws SQLException if a database access error occurs or this method is called on a closed statement
* @see java.sql.Statement#addBatch()
* @see java.sql.PreparedStatement#addBatch()
*/
public This addBatch() throws SQLException {
addBatchAction.accept((This) this, stmt);
Expand Down Expand Up @@ -3463,7 +3467,7 @@ public Nullable<String> queryForString() throws IllegalStateException, SQLExcept
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(rs.getString(1)) : Nullable.<String> empty();
return rs.next() ? Nullable.of(rs.getString(1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand All @@ -3483,7 +3487,7 @@ public Nullable<BigInteger> queryForBigInteger() throws IllegalStateException, S
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(BIG_INTEGER_TYPE.get(rs, 1)) : Nullable.<BigInteger> empty();
return rs.next() ? Nullable.of(BIG_INTEGER_TYPE.get(rs, 1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand All @@ -3501,7 +3505,7 @@ public Nullable<BigDecimal> queryForBigDecimal() throws IllegalStateException, S
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(rs.getBigDecimal(1)) : Nullable.<BigDecimal> empty();
return rs.next() ? Nullable.of(rs.getBigDecimal(1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand All @@ -3518,7 +3522,7 @@ public Nullable<java.sql.Date> queryForDate() throws IllegalStateException, SQLE
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(rs.getDate(1)) : Nullable.<java.sql.Date> empty();
return rs.next() ? Nullable.of(rs.getDate(1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand All @@ -3535,7 +3539,7 @@ public Nullable<java.sql.Time> queryForTime() throws IllegalStateException, SQLE
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(rs.getTime(1)) : Nullable.<java.sql.Time> empty();
return rs.next() ? Nullable.of(rs.getTime(1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand All @@ -3552,7 +3556,7 @@ public Nullable<java.sql.Timestamp> queryForTimestamp() throws IllegalStateExcep
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(rs.getTimestamp(1)) : Nullable.<java.sql.Timestamp> empty();
return rs.next() ? Nullable.of(rs.getTimestamp(1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand All @@ -3569,7 +3573,7 @@ public Nullable<byte[]> queryForBytes() throws IllegalStateException, SQLExcepti
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(rs.getBytes(1)) : Nullable.<byte[]> empty();
return rs.next() ? Nullable.of(rs.getBytes(1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand Down Expand Up @@ -3607,7 +3611,7 @@ public <V> Nullable<V> queryForSingleResult(final Type<? extends V> targetType)
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Nullable.of(targetType.get(rs, 1)) : Nullable.<V> empty();
return rs.next() ? Nullable.of(targetType.get(rs, 1)) : Nullable.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand Down Expand Up @@ -3645,7 +3649,7 @@ public <V> Optional<V> queryForSingleNonNull(final Type<? extends V> targetType)
assertNotClosed();

try (ResultSet rs = executeQuery()) {
return rs.next() ? Optional.of(targetType.get(rs, 1)) : Optional.<V> empty();
return rs.next() ? Optional.of(targetType.get(rs, 1)) : Optional.empty();
} finally {
closeAfterExecutionIfAllowed();
}
Expand Down Expand Up @@ -3687,7 +3691,7 @@ public <V> Nullable<V> queryForUniqueResult(final Type<? extends V> targetType)
assertNotClosed();

try (ResultSet rs = executeQuery()) {
final Nullable<V> result = rs.next() ? Nullable.of(targetType.get(rs, 1)) : Nullable.<V> empty();
final Nullable<V> result = rs.next() ? Nullable.of(targetType.get(rs, 1)) : Nullable.empty();

if (result.isPresent() && rs.next()) {
throw new DuplicatedResultException(
Expand Down Expand Up @@ -3736,7 +3740,7 @@ public <V> Optional<V> queryForUniqueNonNull(final Type<? extends V> targetType)
assertNotClosed();

try (ResultSet rs = executeQuery()) {
final Optional<V> result = rs.next() ? Optional.of(targetType.get(rs, 1)) : Optional.<V> empty();
final Optional<V> result = rs.next() ? Optional.of(targetType.get(rs, 1)) : Optional.empty();

if (result.isPresent() && rs.next()) {
throw new DuplicatedResultException(
Expand Down Expand Up @@ -3941,7 +3945,7 @@ public <R1, R2, R3> Tuple3<R1, R2, R3> query3Resultsets(final Jdbc.BiResultExtra
* @return a list of {@code DataSet} extracted from all {@code ResultSets} returned by the executed procedure.
* @throws SQLException If a database access error occurs.
* @see #queryAllResultsets(ResultExtractor)
* @see #streamAllResults()
* @see #streamAllResultsets()
*/
public List<DataSet> queryAllResultsets() throws SQLException {
return queryAllResultsets(ResultExtractor.TO_DATA_SET);
Expand All @@ -3956,7 +3960,7 @@ public List<DataSet> queryAllResultsets() throws SQLException {
* @throws IllegalArgumentException If the provided {@code resultExtractor} is {@code null}.
* @throws IllegalStateException If the query is executed on a closed statement.
* @throws SQLException If a database access error occurs.
* @see #streamAllResults(ResultExtractor)
* @see #streamAllResultsets(ResultExtractor)
*/
public <R> List<R> queryAllResultsets(final Jdbc.ResultExtractor<? extends R> resultExtractor)
throws IllegalArgumentException, IllegalStateException, SQLException {
Expand Down Expand Up @@ -3997,7 +4001,7 @@ public <R> List<R> queryAllResultsets(final Jdbc.ResultExtractor<? extends R> re
* @throws IllegalArgumentException If the provided {@code resultExtractor} is {@code null}.
* @throws IllegalStateException If the query is executed on a closed statement.
* @throws SQLException If a database access error occurs.
* @see #streamAllResults(BiResultExtractor)
* @see #streamAllResultsets(BiResultExtractor)
*/
public <R> List<R> queryAllResultsets(final Jdbc.BiResultExtractor<? extends R> resultExtractor)
throws IllegalArgumentException, IllegalStateException, SQLException {
Expand Down Expand Up @@ -5027,7 +5031,7 @@ public Stream<Map<String, Object>> stream() {
* Note: The opened {@code Connection} and {@code Statement} will be held till {@code @TerminalOp} or {@code @TerminalOpTriggered} stream operation is called.
*
* @param <T> The type of the elements in the stream.
* @param rowMapper The {@code RowMapper} to map rows of the {@code ResultSet} to the target type.
* @param targetType The class of the result object.
* @return A {@code Stream} of the specified type representing the rows in the first {@code ResultSet}.
* @throws IllegalArgumentException If the provided {@code targetType} is {@code null}.
* @throws IllegalStateException If this is closed.
Expand Down Expand Up @@ -5979,7 +5983,7 @@ <ID> Optional<ID> insert(final Jdbc.RowMapper<? extends ID> autoGeneratedKeyExtr

try (ResultSet rs = stmt.getGeneratedKeys()) {
final ID id = rs.next() ? autoGeneratedKeyExtractor.apply(rs) : null;
return isDefaultIdTester.test(id) ? Optional.<ID> empty() : Optional.of(id);
return isDefaultIdTester.test(id) ? Optional.empty() : Optional.of(id);
}
} finally {
closeAfterExecutionIfAllowed();
Expand Down Expand Up @@ -6007,9 +6011,9 @@ <ID> Optional<ID> insert(final Jdbc.BiRowMapper<? extends ID> autoGeneratedKeyEx
if (rs.next()) {
final List<String> columnLabels = JdbcUtil.getColumnLabelList(rs);
final ID id = autoGeneratedKeyExtractor.apply(rs, columnLabels);
return isDefaultIdTester.test(id) ? Optional.<ID> empty() : Optional.of(id);
return isDefaultIdTester.test(id) ? Optional.empty() : Optional.of(id);
} else {
return Optional.<ID> empty();
return Optional.empty();
}
}
} finally {
Expand Down
Loading

0 comments on commit 855efa2

Please sign in to comment.