Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
landawn committed Nov 8, 2021
1 parent 00168cd commit 533ea70
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 77 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.1

* Improvements


## 1.0

* A new start
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Gradle:
```gradle
// JDK 1.8 or above:
compile 'com.landawn:abacus-query:1.0'
compile 'com.landawn:abacus-query:1.1'
```


Expand Down
11 changes: 2 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.landawn</groupId>
<artifactId>abacus-query</artifactId>
<version>1.0</version>
<version>1.1</version>
<packaging>jar</packaging>

<name>abacus-query</name>
Expand All @@ -25,14 +25,7 @@
<artifactId>abacus-common</artifactId>
<version>2.7</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.landawn</groupId>
<artifactId>abacus-jdbc</artifactId>
<version>2.9</version>
<scope>provided</scope>
</dependency>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
Expand Down
67 changes: 0 additions & 67 deletions src/main/java/com/landawn/abacus/util/SQLBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -2480,73 +2480,6 @@ public <E extends Exception> void accept(final Throwables.BiConsumer<? super Str
consumer.accept(sp.sql, sp.parameters);
}

private static final Set<?> namedSQLBuilderClasses = N.asSet(NSB.class, NSC.class, NAC.class, NLC.class);

@SuppressWarnings("rawtypes")
@Beta
public com.landawn.abacus.util.AbstractPreparedQuery toPreparedQuery(final javax.sql.DataSource ds) throws java.sql.SQLException {
final SP sp = this.pair();

if (namedSQLBuilderClasses.contains(this.getClass())) {
return com.landawn.abacus.util.JdbcUtil.prepareNamedQuery(ds, sp.sql).setParameters(sp.parameters);
}
return com.landawn.abacus.util.JdbcUtil.prepareQuery(ds, sp.sql).setParameters(sp.parameters);
}

@SuppressWarnings("rawtypes")
@Beta
public com.landawn.abacus.util.AbstractPreparedQuery toPreparedQuery(final java.sql.Connection conn) throws java.sql.SQLException {
final SP sp = this.pair();

if (namedSQLBuilderClasses.contains(this.getClass())) {
return com.landawn.abacus.util.JdbcUtil.prepareNamedQuery(conn, sp.sql).setParameters(sp.parameters);
}
return com.landawn.abacus.util.JdbcUtil.prepareQuery(conn, sp.sql).setParameters(sp.parameters);
}

@SuppressWarnings("rawtypes")
@Beta
public <Q extends com.landawn.abacus.util.AbstractPreparedQuery> Q toPreparedQuery(final Throwables.Function<SP, Q, java.sql.SQLException> func)
throws java.sql.SQLException {
final SP sp = this.pair();

return func.apply(sp);
}

@SuppressWarnings("rawtypes")
@Beta
public <Q extends com.landawn.abacus.util.AbstractPreparedQuery> Q toPreparedQuery(
final Throwables.BiFunction<? super String, ? super List<Object>, Q, java.sql.SQLException> func) throws java.sql.SQLException {
final SP sp = this.pair();

return func.apply(sp.sql, sp.parameters);
}

@Beta
public com.landawn.abacus.util.NamedQuery toNamedQuery(final javax.sql.DataSource ds) throws java.sql.SQLException {
requiresNamedSQLBuilder();

final SP sp = this.pair();

return com.landawn.abacus.util.JdbcUtil.prepareNamedQuery(ds, sp.sql).setParameters(sp.parameters);
}

@Beta
public com.landawn.abacus.util.NamedQuery toNamedQuery(final java.sql.Connection conn) throws java.sql.SQLException {
requiresNamedSQLBuilder();

final SP sp = this.pair();

return com.landawn.abacus.util.JdbcUtil.prepareNamedQuery(conn, sp.sql).setParameters(sp.parameters);
}

private void requiresNamedSQLBuilder() {
if (!namedSQLBuilderClasses.contains(this.getClass())) {
throw new RuntimeException(
"NamedQuery must be created from named SQLBuilder: NSB/NSC/NAC/NLC. But this SQLBuilder: " + this.getClass() + " is not named SQLBuilder");
}
}

/**
*
* @param setForUpdate
Expand Down

0 comments on commit 533ea70

Please sign in to comment.