mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-04-19 03:01:48 +08:00
add dm dialect
This commit is contained in:
parent
6cd11eeb9a
commit
fdd5d914bb
@ -17,13 +17,12 @@ import org.dromara.hutool.db.Entity;
|
||||
import org.dromara.hutool.db.Page;
|
||||
import org.dromara.hutool.db.sql.Order;
|
||||
import org.dromara.hutool.db.sql.Query;
|
||||
import org.dromara.hutool.db.sql.SqlBuilder;
|
||||
import org.dromara.hutool.db.sql.QuoteWrapper;
|
||||
import org.dromara.hutool.db.sql.SqlBuilder;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* SQL方言,不同的数据库由于在某些SQL上有所区别,故为每种数据库配置不同的方言。<br>
|
||||
@ -173,7 +172,7 @@ public interface Dialect extends Serializable {
|
||||
|
||||
/**
|
||||
* 构建用于upsert的{@link PreparedStatement}<br>
|
||||
* 方言实现需实现此默认方法,如果没有实现,抛出{@link SQLException}
|
||||
* 方言实现需实现此默认方法,如果没有实现,抛出{@link DbException}
|
||||
*
|
||||
* @param conn 数据库连接对象
|
||||
* @param entity 数据实体类(包含表名)
|
||||
|
@ -49,6 +49,16 @@ public class DmDialect extends AnsiSqlDialect {
|
||||
return DialectName.DM.name();
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建用于upsert的{@link PreparedStatement}<br>
|
||||
* 达梦使用 MERGE INTO 语法可合并 UPDATE 和 INSERT 语句<br>
|
||||
* 参考文档:https://eco.dameng.com/document/dm/zh-cn/pm/insertion-deletion-modification#5.4%20MERGE%20INTO%20%E8%AF%AD%E5%8F%A5
|
||||
*
|
||||
* @param conn 数据库连接对象
|
||||
* @param entity 数据实体类(包含表名)
|
||||
* @param keys 查找字段,某些数据库此字段必须,如H2,某些数据库无需此字段,如MySQL(通过主键)
|
||||
* @return {@link PreparedStatement}
|
||||
*/
|
||||
@Override
|
||||
public PreparedStatement psForUpsert(final Connection conn, final Entity entity, final String... keys) {
|
||||
Assert.notEmpty(keys, "Keys must be not empty for DM MERGE SQL.");
|
||||
|
Loading…
x
Reference in New Issue
Block a user