-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample1.java
More file actions
62 lines (49 loc) · 2.15 KB
/
Copy pathExample1.java
File metadata and controls
62 lines (49 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// ====================================================
// EasySQLITE Copyright(C) 2017 EasySQLITE
// This program comes with ABSOLUTELY NO WARRANTY; This is free software,
// and you are welcome to redistribute it under certain conditions; See
// file LICENSE, which is part of this source code package, for details.
// ====================================================
package com.dentrax.easysqlite.examples;
import com.dentrax.easysqlite.source.SQLITE;
import com.dentrax.easysqlite.source.SQLITECreateInfo;
import com.dentrax.easysqlite.source.SQLITESetting;
import com.dentrax.easysqlite.source.SQLITEUpgradeInfo;
import java.util.ArrayList;
import java.util.List;
import static com.dentrax.easysqlite.MainActivity.CONTEXT;
/**
* Created by Furkan on 11/09/2013.
*/
public final class Example1 {
public Example1(){
final List<SQLITECreateInfo> sql_createList = new ArrayList<SQLITECreateInfo>(){{
//Create a new TABLE with these queries
add(new SQLITECreateInfo("TABLE1_NAME", new ArrayList<String>(){{
add("QUERY1");
add("QUERY2");
}}));
//Create a new TABLE with these queries
add(new SQLITECreateInfo("TABLE2_NAME", new ArrayList<String>(){{
add("QUERY1");
add("QUERY2");
}}));
}};
final List<SQLITEUpgradeInfo> sql_upgradeList = new ArrayList<SQLITEUpgradeInfo>(){{
//Run this queries when upgrade version 0 to 1
add(new SQLITEUpgradeInfo(0, 1, new ArrayList<String>(){{
add("QUERY1");
add("QUERY2");
}}));
//Run this queries when upgrade version 1 to 2
add(new SQLITEUpgradeInfo(1, 2, new ArrayList<String>(){{
add("QUERY1");
add("QUERY2");
}}));
}};
//SQLITESetting class. Parameters : (DB_NAME, VERSION, List<SQLITECreateInfo>, List<SQLITEUpgradeInfo>)
final SQLITESetting sql_setting = new SQLITESetting("DB_NAME", 1, sql_createList, sql_upgradeList);
//Main initializer
SQLITE sql = new SQLITE(CONTEXT, sql_setting);
}
}