Skip to content

Commit

Permalink
Merge branch 'dev' into 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Oct 31, 2024
2 parents e0d3cbf + 43ecae6 commit 6b4bdb5
Show file tree
Hide file tree
Showing 45 changed files with 846 additions and 1,558 deletions.
2 changes: 1 addition & 1 deletion trunk/sqltoy-orm-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.sagframe</groupId>
<version>5.6.29</version>
<version>5.6.30</version>
<name>sagacity-sqltoy</name>
<description>sqltoy core code</description>
<artifactId>sagacity-sqltoy</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,8 @@ public void setDialect(String dialect) {
this.dialect = Dialect.OSCAR;
} else if (tmp.startsWith(Dialect.VASTBASE)) {
this.dialect = Dialect.VASTBASE;
} else if (tmp.startsWith(Dialect.OPENGAUSS)) {
this.dialect = Dialect.OPENGAUSS;
} else {
this.dialect = dialect;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ public static boolean isDynamicSql(String sql, String startMark, String endMark)
}
return false;
}

/**
* @todo 找到@elseif 或@else 对应的@if位置
* @param preSql
Expand Down Expand Up @@ -1411,13 +1411,20 @@ public static String processIfLogic(String contentSql, String startMark, String
logicType = 2;
} else if ((ifStart = StringUtil.matchIndex(sqlPart, START_ELSE_PATTERN)) >= 0) {
logicType = 3;
} else if ((ifStart = StringUtil.matchIndex(sqlPart, IF_PATTERN)) >= 0 && ifLogicCnt == 1) {
logicType = 1;
}
ifLogicModel.setType(logicType);
// @if() 和@elseif()
if (logicType == 1 || logicType == 2) {
ifEnd = StringUtil.getSymMarkIndex("(", ")", sqlPart, ifStart);
ifLogicModel.setLogicExpression(sqlPart.substring(sqlPart.indexOf("(", ifStart) + 1, ifEnd));
sqlPart = sqlPart.substring(ifEnd + 1);
// 兼容老版本只有@if的逻辑
if (ifLogicCnt == 1 && logicType == 1) {
sqlPart = sqlPart.substring(0, ifStart).concat(sqlPart.substring(ifEnd + 1));
} else {
sqlPart = sqlPart.substring(ifEnd + 1);
}
ifLogicModel.setLogicParamsCnt(
StringUtil.matchCnt(ifLogicModel.getLogicExpression(), namedPattern, offset));
} else if (logicType == 3) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,17 @@
import org.sagacity.sqltoy.dialect.impl.MogDBDialect;
import org.sagacity.sqltoy.dialect.impl.MySqlDialect;
import org.sagacity.sqltoy.dialect.impl.OceanBaseDialect;
import org.sagacity.sqltoy.dialect.impl.OpenGaussDialect;
import org.sagacity.sqltoy.dialect.impl.Oracle11gDialect;
import org.sagacity.sqltoy.dialect.impl.OracleDialect;
import org.sagacity.sqltoy.dialect.impl.OscarDialect;
import org.sagacity.sqltoy.dialect.impl.PostgreSqlDialect;
import org.sagacity.sqltoy.dialect.impl.SqlServerDialect;
import org.sagacity.sqltoy.dialect.impl.SqliteDialect;
import org.sagacity.sqltoy.dialect.impl.StarDBDialect;
import org.sagacity.sqltoy.dialect.impl.TDengineDialect;
import org.sagacity.sqltoy.dialect.impl.TidbDialect;
import org.sagacity.sqltoy.dialect.impl.VastbaseDialect;
import org.sagacity.sqltoy.dialect.utils.ClickHouseDialectUtils;
import org.sagacity.sqltoy.dialect.utils.DialectUtils;
import org.sagacity.sqltoy.dialect.utils.PageOptimizeUtils;
Expand Down Expand Up @@ -203,11 +207,30 @@ private Dialect getDialectSqlWrapper(Integer dbType) throws Exception {
dialectSqlWrapper = new GaussDBDialect();
break;
}
// 华为guassdb(postgresql 为蓝本的)
case DBType.OPENGAUSS: {
dialectSqlWrapper = new OpenGaussDialect();
break;
}
// mogdb
case DBType.MOGDB: {
dialectSqlWrapper = new MogDBDialect();
break;
}
// starDB(京东)
case DBType.STARDB: {
dialectSqlWrapper = new StarDBDialect();
break;
} // 神通数据库
case DBType.OSCAR: {
dialectSqlWrapper = new OscarDialect();
break;
}
// vastbase 海量数据库
case DBType.VASTBASE: {
dialectSqlWrapper = new VastbaseDialect();
break;
}
case DBType.IMPALA: {
dialectSqlWrapper = new ImpalaDialect();
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@ private String getLockSql(String sql, Integer dbType, LockMode lockMode) {
return " for update ";
}

/**
* 指的是在identity、sequence主键场景下,是否允许手工给主键赋值
* @param pkStrategy
* @return
*/
private static boolean isAssignPKValue(PKStrategy pkStrategy) {
if (pkStrategy == null) {
return true;
Expand Down
Loading

0 comments on commit 6b4bdb5

Please sign in to comment.