1d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee/*
2d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * Copyright (C) 2014 The Android Open Source Project
3d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee *
4d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * Licensed under the Apache License, Version 2.0 (the "License");
5d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * you may not use this file except in compliance with the License.
6d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * You may obtain a copy of the License at
7d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee *
8d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee *      http://www.apache.org/licenses/LICENSE-2.0
9d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee *
10d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * Unless required by applicable law or agreed to in writing, software
11d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * distributed under the License is distributed on an "AS IS" BASIS,
12d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * See the License for the specific language governing permissions and
14d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee * limitations under the License.
15d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee */
16d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
17d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Leepackage com.android.providers.tv.util;
18d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
19d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Leeimport android.database.DatabaseUtils;
20d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
21d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Leepublic class SqlParams {
22d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    private String mTables;
23d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    private String mSelection;
24d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    private String[] mSelectionArgs;
25d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
26d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public SqlParams(String tables, String selection, String... selectionArgs) {
27d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        setTables(tables);
28d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        setWhere(selection, selectionArgs);
29d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
30d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
31d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public String getTables() {
32d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        return mTables;
33d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
34d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
35d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public String getSelection() {
36d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        return mSelection;
37d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
38d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
39d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public String[] getSelectionArgs() {
40d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        return mSelectionArgs;
41d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
42d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
43d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public void setTables(String tables) {
44d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        mTables = tables;
45d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
46d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
47d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public void setWhere(String selection, String... selectionArgs) {
48d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        mSelection = selection;
49d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        mSelectionArgs = selectionArgs;
50d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
51d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee
52d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    public void appendWhere(String selection, String... selectionArgs) {
53d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        mSelection = DatabaseUtils.concatenateWhere(mSelection, selection);
54d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        if (selectionArgs != null) {
55d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee            mSelectionArgs = DatabaseUtils.appendSelectionArgs(mSelectionArgs, selectionArgs);
56d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee        }
57d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee    }
58d9f937e4769668da59d614600ea3405ee0353ef6Ji-Hwan Lee}
59