mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
21c759ae4f
commit
262c3b7e11
@ -37,6 +37,14 @@ import java.sql.PreparedStatement;
|
|||||||
*/
|
*/
|
||||||
public interface Dialect extends Serializable {
|
public interface Dialect extends Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 方言名
|
||||||
|
*
|
||||||
|
* @return 方言名
|
||||||
|
* @since 5.5.3
|
||||||
|
*/
|
||||||
|
String dialectName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return 包装器
|
* @return 包装器
|
||||||
*/
|
*/
|
||||||
@ -99,6 +107,19 @@ public interface Dialect extends Serializable {
|
|||||||
*/
|
*/
|
||||||
PreparedStatement psForUpdate(Connection conn, Entity entity, Query query) throws DbException;
|
PreparedStatement psForUpdate(Connection conn, Entity entity, Query query) throws DbException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构建用于upsert的{@link PreparedStatement}<br>
|
||||||
|
* 方言实现需实现此默认方法,如果没有实现,抛出{@link DbException}
|
||||||
|
*
|
||||||
|
* @param conn 数据库连接对象
|
||||||
|
* @param entity 数据实体类(包含表名)
|
||||||
|
* @param keys 查找字段,某些数据库此字段必须,如H2,某些数据库无需此字段,如MySQL(通过主键)
|
||||||
|
* @return PreparedStatement
|
||||||
|
* @throws DbException SQL执行异常,或方言数据不支持此操作
|
||||||
|
* @since 5.7.20
|
||||||
|
*/
|
||||||
|
PreparedStatement psForUpsert(final Connection conn, final Entity entity, final String... keys) throws DbException;
|
||||||
|
|
||||||
// -------------------------------------------- Query
|
// -------------------------------------------- Query
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -173,28 +194,4 @@ public interface Dialect extends Serializable {
|
|||||||
.append(") hutool_alias_count_");
|
.append(") hutool_alias_count_");
|
||||||
return psForPage(conn, sqlBuilder, null);
|
return psForPage(conn, sqlBuilder, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建用于upsert的{@link PreparedStatement}<br>
|
|
||||||
* 方言实现需实现此默认方法,如果没有实现,抛出{@link DbException}
|
|
||||||
*
|
|
||||||
* @param conn 数据库连接对象
|
|
||||||
* @param entity 数据实体类(包含表名)
|
|
||||||
* @param keys 查找字段,某些数据库此字段必须,如H2,某些数据库无需此字段,如MySQL(通过主键)
|
|
||||||
* @return PreparedStatement
|
|
||||||
* @throws DbException SQL执行异常,或方言数据不支持此操作
|
|
||||||
* @since 5.7.20
|
|
||||||
*/
|
|
||||||
default PreparedStatement psForUpsert(final Connection conn, final Entity entity, final String... keys) throws DbException {
|
|
||||||
throw new DbException("Unsupported upsert operation of " + dialectName());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 方言名
|
|
||||||
*
|
|
||||||
* @return 方言名
|
|
||||||
* @since 5.5.3
|
|
||||||
*/
|
|
||||||
String dialectName();
|
|
||||||
}
|
}
|
||||||
|
@ -108,6 +108,11 @@ public class AnsiSqlDialect implements Dialect {
|
|||||||
return StatementUtil.prepareStatement(false, this.dbConfig, conn, update.build(), update.getParamValueArray());
|
return StatementUtil.prepareStatement(false, this.dbConfig, conn, update.build(), update.getParamValueArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PreparedStatement psForUpsert(final Connection conn, final Entity entity, final String... keys) throws DbException {
|
||||||
|
throw new DbException("Unsupported upsert operation of " + dialectName());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PreparedStatement psForFind(final Connection conn, final Query query) {
|
public PreparedStatement psForFind(final Connection conn, final Query query) {
|
||||||
return psForPage(conn, query);
|
return psForPage(conn, query);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user