@@ -320,7 +320,8 @@ public SqlCommand insertFor(@NonNull ModelSchema modelSchema) {
320320 stringBuilder .append (")" );
321321 final String preparedInsertStatement = stringBuilder .toString ();
322322 final SQLiteStatement compiledInsertStatement =
323- databaseConnectionHandle .compileStatement (preparedInsertStatement );
323+ databaseConnectionHandle == null ?
324+ null : databaseConnectionHandle .compileStatement (preparedInsertStatement );
324325 return new SqlCommand (table .getName (), preparedInsertStatement , columns ,
325326 Collections .emptyList (), compiledInsertStatement );
326327 }
@@ -334,9 +335,8 @@ public SqlCommand insertFor(@NonNull ModelSchema modelSchema) {
334335 @ NonNull
335336 @ WorkerThread
336337 @ Override
337- public <T extends Model > SqlCommand updateFor (@ NonNull ModelSchema modelSchema ,
338- @ NonNull T item ,
339- @ NonNull QueryPredicate predicate ) throws DataStoreException {
338+ public SqlCommand updateFor (@ NonNull ModelSchema modelSchema ,
339+ @ NonNull QueryPredicate predicate ) throws DataStoreException {
340340 final SQLiteTable table = SQLiteTable .fromSchema (modelSchema );
341341 final StringBuilder stringBuilder = new StringBuilder ();
342342 stringBuilder .append ("UPDATE" )
@@ -373,7 +373,8 @@ public <T extends Model> SqlCommand updateFor(@NonNull ModelSchema modelSchema,
373373
374374 final String preparedUpdateStatement = stringBuilder .toString ();
375375 final SQLiteStatement compiledUpdateStatement =
376- databaseConnectionHandle .compileStatement (preparedUpdateStatement );
376+ databaseConnectionHandle == null ?
377+ null : databaseConnectionHandle .compileStatement (preparedUpdateStatement );
377378 return new SqlCommand (table .getName (),
378379 preparedUpdateStatement ,
379380 columns ,
@@ -387,24 +388,23 @@ public <T extends Model> SqlCommand updateFor(@NonNull ModelSchema modelSchema,
387388 */
388389 @ NonNull
389390 @ Override
390- public <T extends Model > SqlCommand deleteFor (@ NonNull ModelSchema modelSchema ,
391- @ NonNull T item ,
392- @ NonNull QueryPredicate predicate ) throws DataStoreException {
391+ public SqlCommand deleteFor (@ NonNull ModelSchema modelSchema ,
392+ @ NonNull QueryPredicate predicate ) throws DataStoreException {
393393 final SQLiteTable table = SQLiteTable .fromSchema (modelSchema );
394- final StringBuilder stringBuilder = new StringBuilder ();
395394 final SQLPredicate sqlPredicate = new SQLPredicate (predicate );
396- stringBuilder .append ("DELETE FROM" )
397- .append (SqlKeyword .DELIMITER )
398- .append (Wrap .inBackticks (table .getName ()))
399- .append (SqlKeyword .DELIMITER )
400- .append (SqlKeyword .WHERE )
401- .append (SqlKeyword .DELIMITER )
402- .append (sqlPredicate )
403- .append (";" );
404395
405- final String preparedDeleteStatement = stringBuilder .toString ();
396+ final String preparedDeleteStatement =
397+ "DELETE FROM" +
398+ SqlKeyword .DELIMITER +
399+ Wrap .inBackticks (table .getName ()) +
400+ SqlKeyword .DELIMITER +
401+ SqlKeyword .WHERE +
402+ SqlKeyword .DELIMITER +
403+ sqlPredicate +
404+ ";" ;
406405 final SQLiteStatement compiledDeleteStatement =
407- databaseConnectionHandle .compileStatement (preparedDeleteStatement );
406+ databaseConnectionHandle == null ?
407+ null : databaseConnectionHandle .compileStatement (preparedDeleteStatement );
408408 return new SqlCommand (table .getName (),
409409 preparedDeleteStatement ,
410410 Collections .emptyList (),
0 commit comments