Skip to content

Commit

Permalink
3.5.17
Browse files Browse the repository at this point in the history
  • Loading branch information
haiyangl committed Jun 15, 2024
1 parent 403fd38 commit eef962f
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 77 deletions.
3 changes: 2 additions & 1 deletion .classpath
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="jdbc"/>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
Expand All @@ -14,9 +15,9 @@
</attributes>
</classpathentry>
<classpathentry kind="src" path="samples"/>
<classpathentry kind="src" path="jdbc"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.5.17

* Improvements and bug fix.

### 3.5.16

* Improvements and bug fix.
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# abacus-jdbc

[![Maven Central](https://img.shields.io/maven-central/v/com.landawn/abacus-jdbc.svg)](https://maven-badges.herokuapp.com/maven-central/com.landawn/abacus-jdbc/)
[![Javadocs](https://img.shields.io/badge/javadoc-3.5.16-brightgreen.svg)](https://www.javadoc.io/doc/com.landawn/abacus-jdbc/3.5.16/index.html)
[![Javadocs](https://img.shields.io/badge/javadoc-3.5.17-brightgreen.svg)](https://www.javadoc.io/doc/com.landawn/abacus-jdbc/3.5.17/index.html)

Hope it will bring you the programming experiences: coding with SQL/DB is just like coding with Collections.

Expand Down Expand Up @@ -141,15 +141,15 @@ The biggest difference between this library and other data(database) access fram
<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-jdbc</artifactId>
<version>3.5.16</version>
<version>3.5.17</version>
<dependency>
```

* Gradle:

```gradle
// JDK 17 or above:
compile 'com.landawn:abacus-jdbc:3.5.16'
compile 'com.landawn:abacus-jdbc:3.5.17'
```

## User Guide:
Expand Down
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>3.11.7</version>
<version>3.12.0</version>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-query</artifactId>
<version>1.3.21</version>
<version>1.3.22</version>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-cache</artifactId>
<version>0.9.8</version>
<version>1.1</version>
</dependency>
</dependencies>

Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>com.landawn</groupId>
<artifactId>abacus-jdbc</artifactId>
<version>3.5.17</version>
<version>3.5.18</version>
<packaging>jar</packaging>

<name>abacus-jdbc</name>
Expand All @@ -25,28 +25,28 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.30</version>
<version>1.18.32</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-common</artifactId>
<version>3.11.7</version>
<version>3.12.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-query</artifactId>
<version>1.3.21</version>
<version>1.3.22</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-cache</artifactId>
<version>0.9.8</version>
<version>1.1</version>
<scope>provided</scope>
</dependency>

Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/landawn/abacus/jdbc/AbstractQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -3492,13 +3492,13 @@ public <V> Optional<V> queryForUniqueNonNull(final Type<? extends V> targetType)

/**
*
* @param <T>
* @param targetType
* @param rs
* @param targetType
* @param <T>
* @return
* @throws SQLException
*/
private static <T> T getRow(final Class<? extends T> targetType, ResultSet rs) throws SQLException {
private static <T> T getRow(ResultSet rs, final Class<? extends T> targetType) throws SQLException {
final List<String> columnLabels = JdbcUtil.getColumnLabelList(rs);

return Jdbc.BiRowMapper.to(targetType).apply(rs, columnLabels);
Expand Down Expand Up @@ -3972,7 +3972,7 @@ public <T> T findOnlyOneOrNull(final Class<? extends T> targetType) throws Dupli

try (ResultSet rs = executeQuery()) {
if (rs.next()) {
final T result = Objects.requireNonNull(getRow(targetType, rs));
final T result = Objects.requireNonNull(getRow(rs, targetType));

if (rs.next()) {
throw new DuplicatedResultException("More than one record found by the query");
Expand Down Expand Up @@ -4145,7 +4145,7 @@ public <T> T findFirstOrNull(final Class<? extends T> targetType) throws SQLExce

try (ResultSet rs = executeQuery()) {
if (rs.next()) {
return Objects.requireNonNull(getRow(targetType, rs));
return Objects.requireNonNull(getRow(rs, targetType));
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static String generateEntityClass(final String entityName, final ResultSet rs, f

IOUtil.createIfNotExists(file);

IOUtil.write(file, result);
IOUtil.write(result, file);
}

return result;
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/com/landawn/abacus/jdbc/Jdbc.java
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,15 @@ static <T> ResultExtractor<List<T>> toMergedList(final Class<? extends T> target
* @param targetClass
* @param idPropNameForMerge
* @return
* @see DataSet#toMergedEntities(Class, Collection, Collection)
* @see DataSet#toMergedEntities(Collection, Collection, Class)
*/
static <T> ResultExtractor<List<T>> toMergedList(final Class<? extends T> targetClass, final String idPropNameForMerge) {
N.checkArgNotNull(targetClass, "targetClass");

return rs -> {
final RowExtractor rowExtractor = RowExtractor.createBy(targetClass);

return JdbcUtil.extractData(rs, 0, Integer.MAX_VALUE, rowExtractor, false).toMergedEntities(targetClass, idPropNameForMerge);
return JdbcUtil.extractData(rs, 0, Integer.MAX_VALUE, rowExtractor, false).toMergedEntities(idPropNameForMerge, targetClass);
};
}

Expand All @@ -681,15 +681,15 @@ static <T> ResultExtractor<List<T>> toMergedList(final Class<? extends T> target
* @param targetClass
* @param idPropNamesForMerge
* @return
* @see DataSet#toMergedEntities(Class, Collection, Collection)
* @see DataSet#toMergedEntities(Collection, Collection, Class)
*/
static <T> ResultExtractor<List<T>> toMergedList(final Class<? extends T> targetClass, Collection<String> idPropNamesForMerge) {
N.checkArgNotNull(targetClass, "targetClass");

return rs -> {
final RowExtractor rowExtractor = RowExtractor.createBy(targetClass);

return JdbcUtil.extractData(rs, 0, Integer.MAX_VALUE, rowExtractor, false).toMergedEntities(targetClass, idPropNamesForMerge);
return JdbcUtil.extractData(rs, 0, Integer.MAX_VALUE, rowExtractor, false).toMergedEntities(idPropNamesForMerge, targetClass);
};
}

Expand Down Expand Up @@ -4626,7 +4626,7 @@ public static <T> RowMapper<T> get(final Type<? extends T> type) {
* @return
*/
public static <T> RowMapper<T> readJson(final Class<? extends T> targetType) {
return rs -> N.fromJSON(targetType, rs.getString(1));
return rs -> N.fromJSON(rs.getString(1), targetType);
}

/**
Expand All @@ -4637,7 +4637,7 @@ public static <T> RowMapper<T> readJson(final Class<? extends T> targetType) {
* @return
*/
public static <T> RowMapper<T> readXml(final Class<? extends T> targetType) {
return rs -> N.fromXML(targetType, rs.getString(1));
return rs -> N.fromXML(rs.getString(1), targetType);
}

/**
Expand Down
56 changes: 28 additions & 28 deletions src/main/java/com/landawn/abacus/jdbc/JdbcUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -3952,12 +3952,12 @@ public static DataSet extractData(final ResultSet rs, final int offset, final in
}

/**
*
*
* @param rs
* @param filter
* @return
* @throws SQLException
*
* @param rs
* @param filter
* @return
* @throws SQLException
*/
public static DataSet extractData(final ResultSet rs, final RowFilter filter) throws SQLException {
return extractData(rs, 0, Integer.MAX_VALUE, filter, INTERNAL_DUMMY_ROW_EXTRACTOR, false);
Expand Down Expand Up @@ -4227,10 +4227,10 @@ public static CheckedStream<Object[], SQLException> stream(final ResultSet resul
* <br />
* {@code JdbcUtil.stream(resultset).onClose(Fn.closeQuietly(resultSet))...}
*
* @param <T>
* @param resultSet
* @param <T>
* @param resultSet
* @param targetClass Array/List/Map or Entity with getter/setter methods.
* @return
* @return
*/
public static <T> CheckedStream<T, SQLException> stream(final ResultSet resultSet, final Class<? extends T> targetClass) {
N.checkArgNotNull(targetClass, "targetClass");
Expand Down Expand Up @@ -4761,13 +4761,13 @@ public static CheckedStream<DataSet, SQLException> queryByPage(final javax.sql.D
/**
* Runs a {@code Stream} with each element(page) is loaded from database table by running sql {@code query}.
*
* @param <R>
* @param ds
* @param <R>
* @param ds
* @param query this query must be ordered by at least one key/id and has the result size limitation: for example {@code LIMIT pageSize}, {@code ROWS FETCH NEXT pageSize ROWS ONLY}
* @param pageSize
* @param pageSize
* @param paramSetter the second parameter is the result set for previous page. it's {@code null} for first page.
* @param resultExtractor
* @return
* @param resultExtractor
* @return
*/
@SuppressWarnings("rawtypes")
public static <R> CheckedStream<R, SQLException> queryByPage(final javax.sql.DataSource ds, final String query, final int pageSize,
Expand All @@ -4794,13 +4794,13 @@ public static <R> CheckedStream<R, SQLException> queryByPage(final javax.sql.Dat
/**
* Runs a {@code Stream} with each element(page) is loaded from database table by running sql {@code query}.
*
* @param <R>
* @param ds
* @param <R>
* @param ds
* @param query this query must be ordered by at least one key/id and has the result size limitation: for example {@code LIMIT pageSize}, {@code ROWS FETCH NEXT pageSize ROWS ONLY}
* @param pageSize
* @param pageSize
* @param paramSetter the second parameter is the result set for previous page. it's {@code null} for first page.
* @param resultExtractor
* @return
* @param resultExtractor
* @return
*/
@SuppressWarnings("rawtypes")
public static <R> CheckedStream<R, SQLException> queryByPage(final javax.sql.DataSource ds, final String query, final int pageSize,
Expand Down Expand Up @@ -4842,13 +4842,13 @@ public static CheckedStream<DataSet, SQLException> queryByPage(final Connection
/**
* Runs a {@code Stream} with each element(page) is loaded from database table by running sql {@code query}.
*
* @param <R>
* @param conn
* @param <R>
* @param conn
* @param query this query must be ordered by at least one key/id and has the result size limitation: for example {@code LIMIT pageSize}, {@code ROWS FETCH NEXT pageSize ROWS ONLY}
* @param pageSize
* @param pageSize
* @param paramSetter the second parameter is the result set for previous page. it's {@code null} for first page.
* @param resultExtractor the second parameter is the result set for previous page. it's {@code null} for first page.
* @return
* @return
*/
@SuppressWarnings("rawtypes")
public static <R> CheckedStream<R, SQLException> queryByPage(final Connection conn, final String query, final int pageSize,
Expand All @@ -4875,13 +4875,13 @@ public static <R> CheckedStream<R, SQLException> queryByPage(final Connection co
/**
* Runs a {@code Stream} with each element(page) is loaded from database table by running sql {@code query}.
*
* @param <R>
* @param conn
* @param <R>
* @param conn
* @param query this query must be ordered by at least one key/id and has the result size limitation: for example {@code LIMIT pageSize}, {@code ROWS FETCH NEXT pageSize ROWS ONLY}
* @param pageSize
* @param pageSize
* @param paramSetter the second parameter is the result set for previous page. it's {@code null} for first page.
* @param resultExtractor
* @return
* @param resultExtractor
* @return
*/
@SuppressWarnings("rawtypes")
public static <R> CheckedStream<R, SQLException> queryByPage(final Connection conn, final String query, final int pageSize,
Expand Down Expand Up @@ -7208,7 +7208,7 @@ public static String blob2String(final Blob blob, final Charset charset) throws
* @throws IOException
*/
public static long writeBlobToFile(final Blob blob, final File output) throws SQLException, IOException {
return IOUtil.write(output, blob.getBinaryStream());
return IOUtil.write(blob.getBinaryStream(), output);
}

/**
Expand Down
Loading

0 comments on commit eef962f

Please sign in to comment.