|
@@ -1,14 +1,15 @@
|
|
|
package com.jfinal.plugin.activerecord.dialect;
|
|
package com.jfinal.plugin.activerecord.dialect;
|
|
|
|
|
+import com.jfinal.plugin.activerecord.CPI;
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
import com.jfinal.plugin.activerecord.Table;
|
|
import com.jfinal.plugin.activerecord.Table;
|
|
|
-import com.jfinal.plugin.activerecord.dialect.Dialect;
|
|
|
|
|
-
|
|
|
|
|
import java.sql.PreparedStatement;
|
|
import java.sql.PreparedStatement;
|
|
|
import java.sql.SQLException;
|
|
import java.sql.SQLException;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
import java.util.Set;
|
|
|
|
|
+
|
|
|
public class InformixDialect extends Dialect {
|
|
public class InformixDialect extends Dialect {
|
|
|
|
|
+
|
|
|
public String forTableBuilderDoBuild(String tableName) {
|
|
public String forTableBuilderDoBuild(String tableName) {
|
|
|
return "select * from " + tableName + " where 1 = 2";
|
|
return "select * from " + tableName + " where 1 = 2";
|
|
|
}
|
|
}
|
|
@@ -135,11 +136,14 @@ public class InformixDialect extends Dialect {
|
|
|
public void forDbUpdate(String tableName, String[] pKeys, Object[] ids, Record record, StringBuilder sql, List<Object> paras) {
|
|
public void forDbUpdate(String tableName, String[] pKeys, Object[] ids, Record record, StringBuilder sql, List<Object> paras) {
|
|
|
tableName = tableName.trim();
|
|
tableName = tableName.trim();
|
|
|
trimPrimaryKeys(pKeys);
|
|
trimPrimaryKeys(pKeys);
|
|
|
|
|
+
|
|
|
|
|
+ // Record 新增支持 modifyFlag
|
|
|
|
|
+ Set<String> modifyFlag = CPI.getModifyFlag(record);
|
|
|
|
|
|
|
|
sql.append("update ").append(tableName).append(" set ");
|
|
sql.append("update ").append(tableName).append(" set ");
|
|
|
for (Map.Entry<String, Object> e: record.getColumns().entrySet()) {
|
|
for (Map.Entry<String, Object> e: record.getColumns().entrySet()) {
|
|
|
String colName = e.getKey();
|
|
String colName = e.getKey();
|
|
|
- if (!isPrimaryKey(colName, pKeys)) {
|
|
|
|
|
|
|
+ if (modifyFlag.contains(colName) && !isPrimaryKey(colName, pKeys)) {
|
|
|
if (paras.size() > 0) {
|
|
if (paras.size() > 0) {
|
|
|
sql.append(", ");
|
|
sql.append(", ");
|
|
|
}
|
|
}
|
|
@@ -182,4 +186,7 @@ public class InformixDialect extends Dialect {
|
|
|
public void fillStatement(PreparedStatement pst, Object... paras) throws SQLException {
|
|
public void fillStatement(PreparedStatement pst, Object... paras) throws SQLException {
|
|
|
fillStatementHandleDateType(pst, paras);
|
|
fillStatementHandleDateType(pst, paras);
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|