File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed
src/org/nutz/dao/impl/jdbc/yashan Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -198,6 +198,7 @@ public String getDatabaseType() {
198198 public String evalFieldType (MappingField mf ) {
199199 if (mf .getCustomDbType () != null )
200200 return mf .getCustomDbType ();
201+ int intLen = 4 ;
201202 switch (mf .getColumnType ()) {
202203 case BOOLEAN :
203204 if (mf .hasDefaultValue ())
@@ -208,12 +209,19 @@ public String evalFieldType(MappingField mf) {
208209 case VARCHAR :
209210 // 崖山中 VARCHAR2的宽度单位是字节,加上char才是字符
210211 return "VARCHAR2(" + mf .getWidth () + " char)" ;
212+
211213 case INT :
212- // 用户自定义了宽度
213- if (mf .getWidth () > 0 )
214- return "NUMBER(" + mf .getWidth () + ")" ;
215- // 用数据库的默认宽度
216- return "NUMBER" ;
214+ int width = mf .getWidth ();
215+ if (width <= 0 ) {
216+ return "INT" ;
217+ } else if (width <= 2 ) {
218+ return "TINYINT" ;
219+ } else if (width <= 4 ) {
220+ return "SMALLINT" ;
221+ } else if (width <= 8 ) {
222+ return "INT" ;
223+ }
224+ return "BIGINT" ;
217225
218226 case FLOAT :
219227 // 用户自定义了精度
You can’t perform that action at this time.
0 commit comments