HistoryDao.java 12 KB
package com.cnlive.goldenline.dao;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement;

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;

import com.cnlive.goldenline.dao.History;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table HISTORY.
*/
public class HistoryDao extends AbstractDao<History, String> {

    public static final String TABLENAME = "HISTORY";

    /**
     * Properties of entity History.<br/>
     * Can be used for QueryBuilder and for referencing column names.
    */
    public static class Properties {
        public final static Property VdId = new Property(0, String.class, "vdId", true, "VD_ID");
        public final static Property VdCategory = new Property(1, String.class, "vdCategory", false, "VD_CATEGORY");
        public final static Property VdCategoryId = new Property(2, Integer.class, "vdCategoryId", false, "VD_CATEGORY_ID");
        public final static Property VdCover = new Property(3, String.class, "vdCover", false, "VD_COVER");
        public final static Property VdShareUrl = new Property(4, String.class, "vdShareUrl", false, "VD_SHARE_URL");
        public final static Property VdShowDes = new Property(5, String.class, "vdShowDes", false, "VD_SHOW_DES");
        public final static Property VdShowTitle = new Property(6, String.class, "vdShowTitle", false, "VD_SHOW_TITLE");
        public final static Property VdTheatreId = new Property(7, Integer.class, "vdTheatreId", false, "VD_THEATRE_ID");
        public final static Property VdTheatreImg = new Property(8, String.class, "vdTheatreImg", false, "VD_THEATRE_IMG");
        public final static Property VdTheatreName = new Property(9, String.class, "vdTheatreName", false, "VD_THEATRE_NAME");
        public final static Property VdThumbnailImg = new Property(10, String.class, "vdThumbnailImg", false, "VD_THUMBNAIL_IMG");
        public final static Property VdVideoHUrl = new Property(11, String.class, "vdVideoHUrl", false, "VD_VIDEO_HURL");
        public final static Property VdVideoLUrl = new Property(12, String.class, "vdVideoLUrl", false, "VD_VIDEO_LURL");
        public final static Property VdVideoUrl = new Property(13, String.class, "vdVideoUrl", false, "VD_VIDEO_URL");
        public final static Property CreateTime = new Property(14, String.class, "createTime", false, "CREATE_TIME");
        public final static Property VdWatchCount = new Property(15, Integer.class, "vdWatchCount", false, "VD_WATCH_COUNT");
        public final static Property VdDiscussTimes = new Property(16, String.class, "vdDiscussTimes", false, "VD_DISCUSS_TIMES");
        public final static Property VdUUID = new Property(17, String.class, "vdUUID", false, "VD_UUID");
        public final static Property VdVideoUHUrl = new Property(18, String.class, "vdVideoUHUrl", false, "VD_VIDEO_UHURL");
    };


    public HistoryDao(DaoConfig config) {
        super(config);
    }
    
    public HistoryDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "'HISTORY' (" + //
                "'VD_ID' TEXT PRIMARY KEY NOT NULL ," + // 0: vdId
                "'VD_CATEGORY' TEXT," + // 1: vdCategory
                "'VD_CATEGORY_ID' INTEGER," + // 2: vdCategoryId
                "'VD_COVER' TEXT," + // 3: vdCover
                "'VD_SHARE_URL' TEXT," + // 4: vdShareUrl
                "'VD_SHOW_DES' TEXT," + // 5: vdShowDes
                "'VD_SHOW_TITLE' TEXT," + // 6: vdShowTitle
                "'VD_THEATRE_ID' INTEGER," + // 7: vdTheatreId
                "'VD_THEATRE_IMG' TEXT," + // 8: vdTheatreImg
                "'VD_THEATRE_NAME' TEXT," + // 9: vdTheatreName
                "'VD_THUMBNAIL_IMG' TEXT," + // 10: vdThumbnailImg
                "'VD_VIDEO_HURL' TEXT," + // 11: vdVideoHUrl
                "'VD_VIDEO_LURL' TEXT," + // 12: vdVideoLUrl
                "'VD_VIDEO_URL' TEXT," + // 13: vdVideoUrl
                "'CREATE_TIME' TEXT," + // 14: createTime
                "'VD_WATCH_COUNT' INTEGER," + // 15: vdWatchCount
                "'VD_DISCUSS_TIMES' TEXT," + // 16: vdDiscussTimes
                "'VD_UUID' TEXT," + // 17: vdUUID
                "'VD_VIDEO_UHURL' TEXT);"); // 18: vdVideoUHUrl
    }

    /** Drops the underlying database table. */
    public static void dropTable(SQLiteDatabase db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "'HISTORY'";
        db.execSQL(sql);
    }

    /** @inheritdoc */
    @Override
    protected void bindValues(SQLiteStatement stmt, History entity) {
        stmt.clearBindings();
 
        String vdId = entity.getVdId();
        if (vdId != null) {
            stmt.bindString(1, vdId);
        }
 
        String vdCategory = entity.getVdCategory();
        if (vdCategory != null) {
            stmt.bindString(2, vdCategory);
        }
 
        Integer vdCategoryId = entity.getVdCategoryId();
        if (vdCategoryId != null) {
            stmt.bindLong(3, vdCategoryId);
        }
 
        String vdCover = entity.getVdCover();
        if (vdCover != null) {
            stmt.bindString(4, vdCover);
        }
 
        String vdShareUrl = entity.getVdShareUrl();
        if (vdShareUrl != null) {
            stmt.bindString(5, vdShareUrl);
        }
 
        String vdShowDes = entity.getVdShowDes();
        if (vdShowDes != null) {
            stmt.bindString(6, vdShowDes);
        }
 
        String vdShowTitle = entity.getVdShowTitle();
        if (vdShowTitle != null) {
            stmt.bindString(7, vdShowTitle);
        }
 
        Integer vdTheatreId = entity.getVdTheatreId();
        if (vdTheatreId != null) {
            stmt.bindLong(8, vdTheatreId);
        }
 
        String vdTheatreImg = entity.getVdTheatreImg();
        if (vdTheatreImg != null) {
            stmt.bindString(9, vdTheatreImg);
        }
 
        String vdTheatreName = entity.getVdTheatreName();
        if (vdTheatreName != null) {
            stmt.bindString(10, vdTheatreName);
        }
 
        String vdThumbnailImg = entity.getVdThumbnailImg();
        if (vdThumbnailImg != null) {
            stmt.bindString(11, vdThumbnailImg);
        }
 
        String vdVideoHUrl = entity.getVdVideoHUrl();
        if (vdVideoHUrl != null) {
            stmt.bindString(12, vdVideoHUrl);
        }
 
        String vdVideoLUrl = entity.getVdVideoLUrl();
        if (vdVideoLUrl != null) {
            stmt.bindString(13, vdVideoLUrl);
        }
 
        String vdVideoUrl = entity.getVdVideoUrl();
        if (vdVideoUrl != null) {
            stmt.bindString(14, vdVideoUrl);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(15, createTime);
        }
 
        Integer vdWatchCount = entity.getVdWatchCount();
        if (vdWatchCount != null) {
            stmt.bindLong(16, vdWatchCount);
        }
 
        String vdDiscussTimes = entity.getVdDiscussTimes();
        if (vdDiscussTimes != null) {
            stmt.bindString(17, vdDiscussTimes);
        }
 
        String vdUUID = entity.getVdUUID();
        if (vdUUID != null) {
            stmt.bindString(18, vdUUID);
        }
 
        String vdVideoUHUrl = entity.getVdVideoUHUrl();
        if (vdVideoUHUrl != null) {
            stmt.bindString(19, vdVideoUHUrl);
        }
    }

    /** @inheritdoc */
    @Override
    public String readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
    }    

    /** @inheritdoc */
    @Override
    public History readEntity(Cursor cursor, int offset) {
        History entity = new History( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // vdId
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // vdCategory
            cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // vdCategoryId
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // vdCover
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // vdShareUrl
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // vdShowDes
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // vdShowTitle
            cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7), // vdTheatreId
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // vdTheatreImg
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // vdTheatreName
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // vdThumbnailImg
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // vdVideoHUrl
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // vdVideoLUrl
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // vdVideoUrl
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // createTime
            cursor.isNull(offset + 15) ? null : cursor.getInt(offset + 15), // vdWatchCount
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // vdDiscussTimes
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // vdUUID
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18) // vdVideoUHUrl
        );
        return entity;
    }
     
    /** @inheritdoc */
    @Override
    public void readEntity(Cursor cursor, History entity, int offset) {
        entity.setVdId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setVdCategory(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setVdCategoryId(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
        entity.setVdCover(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setVdShareUrl(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setVdShowDes(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setVdShowTitle(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setVdTheatreId(cursor.isNull(offset + 7) ? null : cursor.getInt(offset + 7));
        entity.setVdTheatreImg(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setVdTheatreName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setVdThumbnailImg(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setVdVideoHUrl(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setVdVideoLUrl(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setVdVideoUrl(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setCreateTime(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setVdWatchCount(cursor.isNull(offset + 15) ? null : cursor.getInt(offset + 15));
        entity.setVdDiscussTimes(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setVdUUID(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setVdVideoUHUrl(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
     }
    
    /** @inheritdoc */
    @Override
    protected String updateKeyAfterInsert(History entity, long rowId) {
        return entity.getVdId();
    }
    
    /** @inheritdoc */
    @Override
    public String getKey(History entity) {
        if(entity != null) {
            return entity.getVdId();
        } else {
            return null;
        }
    }

    /** @inheritdoc */
    @Override    
    protected boolean isEntityUpdateable() {
        return true;
    }
    
}