Skip to content

Commit

Permalink
3.4.10
Browse files Browse the repository at this point in the history
  • Loading branch information
noear committed Dec 3, 2021
1 parent b92a652 commit 0a257e4
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 65 deletions.
3 changes: 3 additions & 0 deletions LOG_java_update.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### 3.4.10
* 修复 cmd.toSqlString() 在批处理时,会出错的问题

#### 3.4.9
* 增加 IPage 分页查询
* 增加 SqlTypeDesc 类型,做为类型描述
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,14 @@ db.table(logger)
<dependency>
<groupId>org.noear</groupId>
<artifactId>weed3</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</dependency>

<!-- 可选:maven 插件,用于生成Xml sql mapper接口 -->
<plugin>
<groupId>org.noear</groupId>
<artifactId>weed3-maven-plugin</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</plugin>
```

Expand Down
4 changes: 2 additions & 2 deletions _demo/_demo.weed3_solon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<dependency>
<groupId>org.noear</groupId>
<artifactId>weed3.cache.memcached</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</dependency>


Expand Down Expand Up @@ -65,7 +65,7 @@
<plugin>
<groupId>org.noear</groupId>
<artifactId>weed3-maven-plugin</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</plugin>

<plugin>
Expand Down
4 changes: 2 additions & 2 deletions _demo/_demo.weed3_springboot/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>org.noear</groupId>
<artifactId>weed3</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -71,7 +71,7 @@
<plugin>
<groupId>org.noear</groupId>
<artifactId>weed3-maven-plugin</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</plugin>

<plugin>
Expand Down
2 changes: 1 addition & 1 deletion _extend/weed3-springboot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion _extend/weed3.cache.ehcache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion _extend/weed3.cache.j2cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion _extend/weed3.cache.memcached/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion _extend/weed3.cache.redis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions _test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -177,7 +177,7 @@
<plugin>
<groupId>org.noear</groupId>
<artifactId>weed3-maven-plugin</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<dependencies>
<dependency>
<groupId>mysql</groupId>
Expand Down
2 changes: 1 addition & 1 deletion weed3-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../weed3-parent/pom.xml</relativePath>
</parent>

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

<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<packaging>pom</packaging>

<name>${project.artifactId}</name>
Expand Down Expand Up @@ -40,7 +40,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>

<weed3.ver>3.4.9</weed3.ver>
<weed3.ver>3.4.10</weed3.ver>
</properties>

<dependencyManagement>
Expand Down
2 changes: 1 addition & 1 deletion weed3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>org.noear</groupId>
<artifactId>weed3-parent</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
<relativePath>../weed3-parent/pom.xml</relativePath>
</parent>

Expand Down
111 changes: 65 additions & 46 deletions weed3/src/main/java/org/noear/weed/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,45 @@
* 命令
*/
public class Command {
/** 命令tag(用于寄存一些数据)*/
public String tag;
/** 是否进行日志 */
public int isLog; //def:0 no:-1 yes:1
/**
* 命令tag(用于寄存一些数据)
*/
public String tag;
/**
* 是否进行日志
*/
public int isLog; //def:0 no:-1 yes:1


/** 命令id */
public String key;
/** 命令文本 */
public String text;
/** 命令参数 */
/**
* 命令id
*/
public String key;
/**
* 命令文本
*/
public String text;
/**
* 命令参数
*/
public List<Variate> paramS;
/** 数据库上下文(肯定且必须有) */
/**
* 数据库上下文(肯定且必须有)
*/
public DbContext context;
/** 缓存服务对象(可能有,可能没有) */
/**
* 缓存服务对象(可能有,可能没有)
*/
public ICacheServiceEx cache;

/** 数据处理事务 */
/**
* 数据处理事务
*/
public DbTran tran;

/** 是否为批处理 */
/**
* 是否为批处理
*/
public boolean isBatch = false;

//计时变量
Expand All @@ -46,25 +64,25 @@ public Command(DbContext context) {
this.context.lastCommand = this;
this.tran = tran;

if(tran == null){
if (tran == null) {
this.tran = DbTranUtil.current();
}
}

private Map<String,Object> _paramMap;
private Map<String, Object> _paramMap;

/**
* 参数字典
* */
public Map<String,Object> paramMap() {
*/
public Map<String, Object> paramMap() {
if (_paramMap == null) {
_paramMap = new LinkedHashMap<>();

int idx = 0;
for (Variate v : paramS) {
if (StringUtils.isEmpty(v._name)) {
_paramMap.put("v" + idx, v.getValue());
}else{
} else {
_paramMap.put("v" + idx + "-" + v._name, v.getValue());
}
idx++;
Expand All @@ -75,54 +93,55 @@ public Map<String,Object> paramMap() {
}

@Deprecated
public String text2(){
public String text2() {
return toSqlString();
}

/**
* 转为SQL字符串
* */
public String toSqlString(){
*/
public String toSqlString() {
StringBuilder sb = new StringBuilder();

String[] ss = text.split("\\?");
for(int i=0,len=ss.length; i<len; i++){
sb.append(ss[i]);

if(i< len-1) {
Variate val = paramS.get(i);

if (val.isNull()) {
sb.append("NULL");
} else if (val.getValue() instanceof String) {
sb.append("'").append(val.getString()).append("'");
} else if (val.getValue() instanceof Boolean) {
sb.append(val.getBoolean());
} else if (val.getValue() instanceof Date) {
sb.append("'").append(val.getDate()).append("'");
} else {
sb.append(val.getValue());
if (isBatch) {
sb.append(text);
sb.append(" --:batch");
} else {
String[] ss = text.split("\\?");
for (int i = 0, len = ss.length; i < len; i++) {
sb.append(ss[i]);

if (i < len - 1) {
Variate val = paramS.get(i);

if (val.isNull()) {
sb.append("NULL");
} else if (val.getValue() instanceof String) {
sb.append("'").append(val.getString()).append("'");
} else if (val.getValue() instanceof Boolean) {
sb.append(val.getBoolean());
} else if (val.getValue() instanceof Date) {
sb.append("'").append(val.getDate()).append("'");
} else {
sb.append(val.getValue());
}
}
}
}

if(isBatch){
sb.append(" --:batch");
}

return sb.toString();
}

/**
* 执行时长
* */
public long timespan(){
return timestop -timestart;
*/
public long timespan() {
return timestop - timestart;
}

/**
* 完整的命令文本
* */
*/
public String fullText() {
if (context.codeHint() == null)
return context.getDialect().preReview(text);
Expand Down
4 changes: 2 additions & 2 deletions 文章_Weed3 for java 新的微型ORM框架.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ Weed3,微型ORM框架(支持:java sql,xml sql,annotation sql;templat
<dependency>
<groupId>org.noear</groupId>
<artifactId>weed3</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</dependency>

<!-- maven 插件,用于生成Xml sql mapper接口 -->
<plugin>
<groupId>org.noear</groupId>
<artifactId>weed3-maven-plugin</artifactId>
<version>3.4.9</version>
<version>3.4.10</version>
</plugin>
```

Expand Down

0 comments on commit 0a257e4

Please sign in to comment.