Browse Source

解决部分数据库取 clob 类型字段值时,当内容很多时,字段值后半部分乱码或文本内容变为一堆NULL串的问题

Signed-off-by: 冰雨 <wangyiywc@163.com>
冰雨 1 year ago
parent
commit
96b468d8c0
1 changed files with 3 additions and 2 deletions
  1. 3 2
      src/main/java/com/jfinal/plugin/activerecord/ModelBuilder.java

+ 3 - 2
src/main/java/com/jfinal/plugin/activerecord/ModelBuilder.java

@@ -115,7 +115,8 @@ public class ModelBuilder {
 	}
 	
 	public String handleClob(Clob clob) throws SQLException {
-		if (clob == null)
+		return clob == null ? null : clob.getSubString(1, (int) clob.length());
+		/*if (clob == null)
 			return null;
 		
 		Reader reader = null;
@@ -134,7 +135,7 @@ public class ModelBuilder {
 		finally {
 			if (reader != null)
 				try {reader.close();} catch (IOException e) {throw new RuntimeException(e);}
-		}
+		}*/
 	}
 	
 	/* backup before use columnType