Skip to content

Commit 7721ca8

Browse files
committed
Update SqlBuilder.java
修复FinalDb创建数据的时候,如果是int/long/float/double类型的时候也用text数据保存,造成排序出错的问题。
1 parent b8590a3 commit 7721ca8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/net/tsz/afinal/db/sqlite/SqlBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,13 @@ public static String getCreatTableSQL(Class<?> clazz){
318318
Collection<Property> propertys = table.propertyMap.values();
319319
for(Property property : propertys){
320320
strSQL.append("\"").append(property.getColumn());
321+
if(property.getDataType() == int.class || property.getDataType() == Integer.class
322+
|| property.getDataType() == long.class || property.getDataType() == Long.class){
323+
strSQL.append(" INTEGER");
324+
}else if(property.getDataType() == float.class || property.getDataType() == Float.class
325+
|| property.getDataType() == double.class || property.getDataType() == Double.class){
326+
strSQL.append(" REAL");
327+
}
321328
strSQL.append("\",");
322329
}
323330

0 commit comments

Comments
 (0)