@@ -33,6 +33,7 @@ public class SQLiteSimple {
33
33
private SQLiteSimpleHelper sqLiteSimpleHelper ;
34
34
private SimplePreferencesUtil sharedPreferencesUtil ;
35
35
private int databaseVersion ;
36
+ private boolean isAddedSQLDivider ;
36
37
37
38
@ SuppressWarnings ("unused" )
38
39
public SQLiteSimple (Context context , int databaseVersion ) {
@@ -129,13 +130,15 @@ public void create(Class<?>... classes) {
129
130
sqlQueryBuilder .append (String .format (SimpleConstants .FORMAT_TWINS ,
130
131
String .format (SimpleConstants .FORMAT_OBJECT_BRACKET , column ),
131
132
fieldEntityAnnotation .type ()));
133
+ isAddedSQLDivider = false ;
132
134
133
135
if (fieldEntityAnnotation .isAutoincrement ()) {
134
136
sqlQueryBuilder .append (SimpleConstants .SPACE );
135
137
sqlQueryBuilder .append (SimpleConstants .AUTOINCREMENT );
136
138
}
137
139
138
140
if (annotatedFieldsIndex != tableFieldsCount - 1 ) {
141
+ isAddedSQLDivider = true ;
139
142
sqlQueryBuilder .append (SimpleConstants .DIVIDER );
140
143
sqlQueryBuilder .append (SimpleConstants .SPACE );
141
144
}
@@ -184,13 +187,20 @@ private void makeKeyForTable(StringBuilder sqlQueryBuilder, List<Field> primaryK
184
187
185
188
} else if (primaryKeys .size () == 1 ) {
186
189
190
+ if (!isAddedSQLDivider ) {
191
+ sqlQueryBuilder .append (SimpleConstants .DIVIDER );
192
+ sqlQueryBuilder .append (SimpleConstants .SPACE );
193
+ }
194
+
187
195
Field fieldEntity = primaryKeys .get (0 );
188
196
String column = SimpleDatabaseUtil .getColumnName (fieldEntity );
189
197
Column fieldEntityAnnotation = fieldEntity .getAnnotation (Column .class );
190
198
sqlQueryBuilder .append (String .format (SimpleConstants .FORMAT_TWINS ,
191
199
column , fieldEntityAnnotation .type ()));
200
+
192
201
sqlQueryBuilder .append (SimpleConstants .SPACE );
193
202
sqlQueryBuilder .append (SimpleConstants .PRIMARY_KEY );
203
+
194
204
if (fieldEntityAnnotation .isAutoincrement ()) {
195
205
sqlQueryBuilder .append (SimpleConstants .SPACE );
196
206
sqlQueryBuilder .append (SimpleConstants .AUTOINCREMENT );
0 commit comments