2 * Copyright 2014 Gustavo Martin Morcuende
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package name.gumartinm.weather.information.model;
18 import android.content.Context;
20 public class DatabaseQueries {
21 private final Context localContext;
23 public DatabaseQueries(final Context context) {
24 this.localContext = context;
27 public WeatherLocation queryDataBase() {
29 final WeatherLocationDbHelper dbHelper = new WeatherLocationDbHelper(this.localContext);
31 final WeatherLocationDbQueries queryDb = new WeatherLocationDbQueries(dbHelper);
32 return queryDb.queryDataBase();
38 public long insertIntoDataBase(final WeatherLocation weatherLocation) {
40 final WeatherLocationDbHelper dbHelper = new WeatherLocationDbHelper(this.localContext);
42 final WeatherLocationDbQueries queryDb = new WeatherLocationDbQueries(dbHelper);
43 return queryDb.insertIntoDataBase(weatherLocation);
49 public void updateDataBase(final WeatherLocation weatherLocation) {
51 final WeatherLocationDbHelper dbHelper = new WeatherLocationDbHelper(this.localContext);
53 final WeatherLocationDbQueries queryDb = new WeatherLocationDbQueries(dbHelper);
54 queryDb.updateDataBase(weatherLocation);