@@ -310,27 +310,36 @@ public static String getCreatTableSQL(Class<?> clazz){
310
310
strSQL .append (" ( " );
311
311
312
312
Class <?> primaryClazz = id .getDataType ();
313
- if ( primaryClazz == int .class || primaryClazz ==Integer .class )
314
- strSQL .append ("\" " ).append (id .getColumn ()).append ("\" " ).append ("INTEGER PRIMARY KEY AUTOINCREMENT," );
315
- else
316
- strSQL .append ("\" " ).append (id .getColumn ()).append ("\" " ).append ("TEXT PRIMARY KEY," );
313
+ if ( primaryClazz == int .class || primaryClazz ==Integer .class
314
+ || primaryClazz == long .class || primaryClazz == Long .class ){
315
+ strSQL .append (id .getColumn ()).append (" INTEGER PRIMARY KEY AUTOINCREMENT," );
316
+ }else {
317
+ strSQL .append (id .getColumn ()).append (" TEXT PRIMARY KEY," );
318
+ }
319
+
320
+
317
321
318
322
Collection <Property > propertys = table .propertyMap .values ();
319
323
for (Property property : propertys ){
320
- strSQL .append ("\" " ).append (property .getColumn ());
321
- if (property .getDataType () == int .class || property .getDataType () == Integer .class
322
- || property .getDataType () == long .class || property .getDataType () == Long .class ){
324
+ strSQL .append (property .getColumn ());
325
+ Class <?> dataType = property .getDataType ();
326
+ if ( dataType == int .class || dataType == Integer .class
327
+ || dataType == long .class || dataType == Long .class ){
323
328
strSQL .append (" INTEGER" );
324
- }else if (property . getDataType () == float .class || property . getDataType () == Float .class
325
- || property . getDataType () == double .class || property . getDataType () == Double .class ){
329
+ }else if (dataType == float .class ||dataType == Float .class
330
+ ||dataType == double .class || dataType == Double .class ){
326
331
strSQL .append (" REAL" );
332
+ }else if (dataType == boolean .class || dataType == Boolean .class ) {
333
+ strSQL .append (" NUMERIC" );
327
334
}
328
- strSQL .append ("\" ," );
335
+ strSQL .append ("," );
329
336
}
330
337
331
338
Collection <ManyToOne > manyToOnes = table .manyToOneMap .values ();
332
339
for (ManyToOne manyToOne : manyToOnes ){
333
- strSQL .append ("\" " ).append (manyToOne .getColumn ()).append ("\" ," );
340
+ strSQL .append (manyToOne .getColumn ())
341
+ .append (" INTEGER" )
342
+ .append ("," );
334
343
}
335
344
strSQL .deleteCharAt (strSQL .length () - 1 );
336
345
strSQL .append (" )" );
0 commit comments