Skip to content

Commit

Permalink
Insert query moving to variable.
Browse files Browse the repository at this point in the history
Moving the InsertQuery, from building on each insert, into a static
var.
  • Loading branch information
pavlospt committed Feb 1, 2016
1 parent 65e73f9 commit 3dea551
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@
*/
public class CachedFoodPutResolver extends PutResolver<FoodModel> {

private static final InsertQuery CACHED_FOODS_INSERT_QUERY = InsertQuery
.builder()
.table(FoodTable.TABLE_CACHED_FOODS)
.build();

@NonNull
@Override
public PutResult performPut(@NonNull StorIOSQLite storIOSQLite, @NonNull FoodModel object) {
storIOSQLite.internal().beginTransaction();

try {
storIOSQLite.internal().insert(
InsertQuery
.builder()
.table(FoodTable.TABLE_CACHED_FOODS)
.build(),
storIOSQLite.internal().insert(CACHED_FOODS_INSERT_QUERY,
object.asContentValues());
storIOSQLite.internal().setTransactionSuccessful();
} finally {
Expand Down

0 comments on commit 3dea551

Please sign in to comment.
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy