From 2fcc901e0a9102b63d5b4fd812a2708e14073c24 Mon Sep 17 00:00:00 2001 From: pybple5kv <1766872402@qq.com> Date: Sun, 10 Jul 2022 22:22:50 +0800 Subject: [PATCH] ADD file via upload --- QuestBeanDao.java | 211 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 QuestBeanDao.java diff --git a/QuestBeanDao.java b/QuestBeanDao.java new file mode 100644 index 0000000..f0e9ae3 --- /dev/null +++ b/QuestBeanDao.java @@ -0,0 +1,211 @@ +package com.example.greendao; + +import android.database.Cursor; +import android.database.sqlite.SQLiteStatement; + +import org.greenrobot.greendao.AbstractDao; +import org.greenrobot.greendao.Property; +import org.greenrobot.greendao.internal.DaoConfig; +import org.greenrobot.greendao.database.Database; +import org.greenrobot.greendao.database.DatabaseStatement; + +import com.example.bean.QuestBean; + +// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. +/** + * DAO for table "QUEST_BEAN". +*/ +public class QuestBeanDao extends AbstractDao { + + public static final String TABLENAME = "QUEST_BEAN"; + + /** + * Properties of entity QuestBean.
+ * Can be used for QueryBuilder and for referencing column names. + */ + public static class Properties { + public final static Property Id = new Property(0, Long.class, "id", true, "_id"); + public final static Property Q_type = new Property(1, String.class, "q_type", false, "Q_TYPE"); + public final static Property Title = new Property(2, String.class, "title", false, "TITLE"); + public final static Property OptionA = new Property(3, String.class, "optionA", false, "OPTION_A"); + public final static Property OptionB = new Property(4, String.class, "optionB", false, "OPTION_B"); + public final static Property OptionC = new Property(5, String.class, "optionC", false, "OPTION_C"); + public final static Property OptionD = new Property(6, String.class, "optionD", false, "OPTION_D"); + public final static Property Answer = new Property(7, String.class, "answer", false, "ANSWER"); + public final static Property Myanswer = new Property(8, String.class, "myanswer", false, "MYANSWER"); + } + + + public QuestBeanDao(DaoConfig config) { + super(config); + } + + public QuestBeanDao(DaoConfig config, DaoSession daoSession) { + super(config, daoSession); + } + + /** Creates the underlying database table. */ + public static void createTable(Database db, boolean ifNotExists) { + String constraint = ifNotExists? "IF NOT EXISTS ": ""; + db.execSQL("CREATE TABLE " + constraint + "\"QUEST_BEAN\" (" + // + "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id + "\"Q_TYPE\" TEXT NOT NULL ," + // 1: q_type + "\"TITLE\" TEXT NOT NULL ," + // 2: title + "\"OPTION_A\" TEXT," + // 3: optionA + "\"OPTION_B\" TEXT," + // 4: optionB + "\"OPTION_C\" TEXT," + // 5: optionC + "\"OPTION_D\" TEXT," + // 6: optionD + "\"ANSWER\" TEXT," + // 7: answer + "\"MYANSWER\" TEXT);"); // 8: myanswer + } + + /** Drops the underlying database table. */ + public static void dropTable(Database db, boolean ifExists) { + String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"QUEST_BEAN\""; + db.execSQL(sql); + } + + @Override + protected final void bindValues(DatabaseStatement stmt, QuestBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + stmt.bindString(2, entity.getQ_type()); + stmt.bindString(3, entity.getTitle()); + + String optionA = entity.getOptionA(); + if (optionA != null) { + stmt.bindString(4, optionA); + } + + String optionB = entity.getOptionB(); + if (optionB != null) { + stmt.bindString(5, optionB); + } + + String optionC = entity.getOptionC(); + if (optionC != null) { + stmt.bindString(6, optionC); + } + + String optionD = entity.getOptionD(); + if (optionD != null) { + stmt.bindString(7, optionD); + } + + String answer = entity.getAnswer(); + if (answer != null) { + stmt.bindString(8, answer); + } + + String myanswer = entity.getMyanswer(); + if (myanswer != null) { + stmt.bindString(9, myanswer); + } + } + + @Override + protected final void bindValues(SQLiteStatement stmt, QuestBean entity) { + stmt.clearBindings(); + + Long id = entity.getId(); + if (id != null) { + stmt.bindLong(1, id); + } + stmt.bindString(2, entity.getQ_type()); + stmt.bindString(3, entity.getTitle()); + + String optionA = entity.getOptionA(); + if (optionA != null) { + stmt.bindString(4, optionA); + } + + String optionB = entity.getOptionB(); + if (optionB != null) { + stmt.bindString(5, optionB); + } + + String optionC = entity.getOptionC(); + if (optionC != null) { + stmt.bindString(6, optionC); + } + + String optionD = entity.getOptionD(); + if (optionD != null) { + stmt.bindString(7, optionD); + } + + String answer = entity.getAnswer(); + if (answer != null) { + stmt.bindString(8, answer); + } + + String myanswer = entity.getMyanswer(); + if (myanswer != null) { + stmt.bindString(9, myanswer); + } + } + + @Override + public Long readKey(Cursor cursor, int offset) { + return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0); + } + + @Override + public QuestBean readEntity(Cursor cursor, int offset) { + QuestBean entity = new QuestBean( // + cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id + cursor.getString(offset + 1), // q_type + cursor.getString(offset + 2), // title + cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // optionA + cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // optionB + cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // optionC + cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // optionD + cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // answer + cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8) // myanswer + ); + return entity; + } + + @Override + public void readEntity(Cursor cursor, QuestBean entity, int offset) { + entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0)); + entity.setQ_type(cursor.getString(offset + 1)); + entity.setTitle(cursor.getString(offset + 2)); + entity.setOptionA(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3)); + entity.setOptionB(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4)); + entity.setOptionC(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5)); + entity.setOptionD(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6)); + entity.setAnswer(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7)); + entity.setMyanswer(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8)); + } + + @Override + protected final Long updateKeyAfterInsert(QuestBean entity, long rowId) { + entity.setId(rowId); + return rowId; + } + + @Override + public Long getKey(QuestBean entity) { + if(entity != null) { + return entity.getId(); + } else { + return null; + } + } + + @Override + public boolean hasKey(QuestBean entity) { + return entity.getId() != null; + } + + @Override + protected final boolean isEntityUpdateable() { + return true; + } + +}