|
@@ -0,0 +1,174 @@
|
|
1
|
+package com.kuxuan.sqlite.dao;
|
|
2
|
+
|
|
3
|
+import android.database.Cursor;
|
|
4
|
+import android.database.sqlite.SQLiteStatement;
|
|
5
|
+
|
|
6
|
+import org.greenrobot.greendao.AbstractDao;
|
|
7
|
+import org.greenrobot.greendao.Property;
|
|
8
|
+import org.greenrobot.greendao.internal.DaoConfig;
|
|
9
|
+import org.greenrobot.greendao.database.Database;
|
|
10
|
+import org.greenrobot.greendao.database.DatabaseStatement;
|
|
11
|
+
|
|
12
|
+import com.kuxuan.sqlite.db.CategoryDB;
|
|
13
|
+
|
|
14
|
+// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
|
15
|
+/**
|
|
16
|
+ * DAO for table "CATEGORY_DB".
|
|
17
|
+*/
|
|
18
|
+public class CategoryDBDao extends AbstractDao<CategoryDB, Void> {
|
|
19
|
+
|
|
20
|
+ public static final String TABLENAME = "CATEGORY_DB";
|
|
21
|
+
|
|
22
|
+ /**
|
|
23
|
+ * Properties of entity CategoryDB.<br/>
|
|
24
|
+ * Can be used for QueryBuilder and for referencing column names.
|
|
25
|
+ */
|
|
26
|
+ public static class Properties {
|
|
27
|
+ public final static Property Bill_id = new Property(0, long.class, "bill_id", false, "BILL_ID");
|
|
28
|
+ public final static Property Demo = new Property(1, String.class, "demo", false, "DEMO");
|
|
29
|
+ public final static Property Name = new Property(2, String.class, "name", false, "NAME");
|
|
30
|
+ public final static Property Type = new Property(3, int.class, "type", false, "TYPE");
|
|
31
|
+ public final static Property Account = new Property(4, long.class, "account", false, "ACCOUNT");
|
|
32
|
+ public final static Property Category_id = new Property(5, int.class, "category_id", false, "CATEGORY_ID");
|
|
33
|
+ public final static Property Year = new Property(6, int.class, "year", false, "YEAR");
|
|
34
|
+ public final static Property Month = new Property(7, int.class, "month", false, "MONTH");
|
|
35
|
+ public final static Property Day = new Property(8, int.class, "day", false, "DAY");
|
|
36
|
+ public final static Property User_id = new Property(9, int.class, "user_id", false, "USER_ID");
|
|
37
|
+ }
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+ public CategoryDBDao(DaoConfig config) {
|
|
41
|
+ super(config);
|
|
42
|
+ }
|
|
43
|
+
|
|
44
|
+ public CategoryDBDao(DaoConfig config, DaoSession daoSession) {
|
|
45
|
+ super(config, daoSession);
|
|
46
|
+ }
|
|
47
|
+
|
|
48
|
+ /** Creates the underlying database table. */
|
|
49
|
+ public static void createTable(Database db, boolean ifNotExists) {
|
|
50
|
+ String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
|
51
|
+ db.execSQL("CREATE TABLE " + constraint + "\"CATEGORY_DB\" (" + //
|
|
52
|
+ "\"BILL_ID\" INTEGER NOT NULL UNIQUE ," + // 0: bill_id
|
|
53
|
+ "\"DEMO\" TEXT," + // 1: demo
|
|
54
|
+ "\"NAME\" TEXT," + // 2: name
|
|
55
|
+ "\"TYPE\" INTEGER NOT NULL ," + // 3: type
|
|
56
|
+ "\"ACCOUNT\" INTEGER NOT NULL ," + // 4: account
|
|
57
|
+ "\"CATEGORY_ID\" INTEGER NOT NULL ," + // 5: category_id
|
|
58
|
+ "\"YEAR\" INTEGER NOT NULL ," + // 6: year
|
|
59
|
+ "\"MONTH\" INTEGER NOT NULL ," + // 7: month
|
|
60
|
+ "\"DAY\" INTEGER NOT NULL ," + // 8: day
|
|
61
|
+ "\"USER_ID\" INTEGER NOT NULL );"); // 9: user_id
|
|
62
|
+ }
|
|
63
|
+
|
|
64
|
+ /** Drops the underlying database table. */
|
|
65
|
+ public static void dropTable(Database db, boolean ifExists) {
|
|
66
|
+ String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"CATEGORY_DB\"";
|
|
67
|
+ db.execSQL(sql);
|
|
68
|
+ }
|
|
69
|
+
|
|
70
|
+ @Override
|
|
71
|
+ protected final void bindValues(DatabaseStatement stmt, CategoryDB entity) {
|
|
72
|
+ stmt.clearBindings();
|
|
73
|
+ stmt.bindLong(1, entity.getBill_id());
|
|
74
|
+
|
|
75
|
+ String demo = entity.getDemo();
|
|
76
|
+ if (demo != null) {
|
|
77
|
+ stmt.bindString(2, demo);
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ String name = entity.getName();
|
|
81
|
+ if (name != null) {
|
|
82
|
+ stmt.bindString(3, name);
|
|
83
|
+ }
|
|
84
|
+ stmt.bindLong(4, entity.getType());
|
|
85
|
+ stmt.bindLong(5, entity.getAccount());
|
|
86
|
+ stmt.bindLong(6, entity.getCategory_id());
|
|
87
|
+ stmt.bindLong(7, entity.getYear());
|
|
88
|
+ stmt.bindLong(8, entity.getMonth());
|
|
89
|
+ stmt.bindLong(9, entity.getDay());
|
|
90
|
+ stmt.bindLong(10, entity.getUser_id());
|
|
91
|
+ }
|
|
92
|
+
|
|
93
|
+ @Override
|
|
94
|
+ protected final void bindValues(SQLiteStatement stmt, CategoryDB entity) {
|
|
95
|
+ stmt.clearBindings();
|
|
96
|
+ stmt.bindLong(1, entity.getBill_id());
|
|
97
|
+
|
|
98
|
+ String demo = entity.getDemo();
|
|
99
|
+ if (demo != null) {
|
|
100
|
+ stmt.bindString(2, demo);
|
|
101
|
+ }
|
|
102
|
+
|
|
103
|
+ String name = entity.getName();
|
|
104
|
+ if (name != null) {
|
|
105
|
+ stmt.bindString(3, name);
|
|
106
|
+ }
|
|
107
|
+ stmt.bindLong(4, entity.getType());
|
|
108
|
+ stmt.bindLong(5, entity.getAccount());
|
|
109
|
+ stmt.bindLong(6, entity.getCategory_id());
|
|
110
|
+ stmt.bindLong(7, entity.getYear());
|
|
111
|
+ stmt.bindLong(8, entity.getMonth());
|
|
112
|
+ stmt.bindLong(9, entity.getDay());
|
|
113
|
+ stmt.bindLong(10, entity.getUser_id());
|
|
114
|
+ }
|
|
115
|
+
|
|
116
|
+ @Override
|
|
117
|
+ public Void readKey(Cursor cursor, int offset) {
|
|
118
|
+ return null;
|
|
119
|
+ }
|
|
120
|
+
|
|
121
|
+ @Override
|
|
122
|
+ public CategoryDB readEntity(Cursor cursor, int offset) {
|
|
123
|
+ CategoryDB entity = new CategoryDB( //
|
|
124
|
+ cursor.getLong(offset + 0), // bill_id
|
|
125
|
+ cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // demo
|
|
126
|
+ cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // name
|
|
127
|
+ cursor.getInt(offset + 3), // type
|
|
128
|
+ cursor.getLong(offset + 4), // account
|
|
129
|
+ cursor.getInt(offset + 5), // category_id
|
|
130
|
+ cursor.getInt(offset + 6), // year
|
|
131
|
+ cursor.getInt(offset + 7), // month
|
|
132
|
+ cursor.getInt(offset + 8), // day
|
|
133
|
+ cursor.getInt(offset + 9) // user_id
|
|
134
|
+ );
|
|
135
|
+ return entity;
|
|
136
|
+ }
|
|
137
|
+
|
|
138
|
+ @Override
|
|
139
|
+ public void readEntity(Cursor cursor, CategoryDB entity, int offset) {
|
|
140
|
+ entity.setBill_id(cursor.getLong(offset + 0));
|
|
141
|
+ entity.setDemo(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
|
142
|
+ entity.setName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
|
143
|
+ entity.setType(cursor.getInt(offset + 3));
|
|
144
|
+ entity.setAccount(cursor.getLong(offset + 4));
|
|
145
|
+ entity.setCategory_id(cursor.getInt(offset + 5));
|
|
146
|
+ entity.setYear(cursor.getInt(offset + 6));
|
|
147
|
+ entity.setMonth(cursor.getInt(offset + 7));
|
|
148
|
+ entity.setDay(cursor.getInt(offset + 8));
|
|
149
|
+ entity.setUser_id(cursor.getInt(offset + 9));
|
|
150
|
+ }
|
|
151
|
+
|
|
152
|
+ @Override
|
|
153
|
+ protected final Void updateKeyAfterInsert(CategoryDB entity, long rowId) {
|
|
154
|
+ // Unsupported or missing PK type
|
|
155
|
+ return null;
|
|
156
|
+ }
|
|
157
|
+
|
|
158
|
+ @Override
|
|
159
|
+ public Void getKey(CategoryDB entity) {
|
|
160
|
+ return null;
|
|
161
|
+ }
|
|
162
|
+
|
|
163
|
+ @Override
|
|
164
|
+ public boolean hasKey(CategoryDB entity) {
|
|
165
|
+ // TODO
|
|
166
|
+ return false;
|
|
167
|
+ }
|
|
168
|
+
|
|
169
|
+ @Override
|
|
170
|
+ protected final boolean isEntityUpdateable() {
|
|
171
|
+ return true;
|
|
172
|
+ }
|
|
173
|
+
|
|
174
|
+}
|