package org.zarroboogs.weibo.greendao.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 org.zarroboogs.weibo.greendao.bean.Green_TimeLineStatus;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * DAO for table "time_line_status_table".
 */
public class Green_TimeLineStatusDao extends AbstractDao<Green_TimeLineStatus, Void> {

    public static final String TABLENAME = "time_line_status_table";

    /**
     * Properties of entity Green_TimeLineStatus.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property _id = new Property(0, Integer.class, "_id", false, "_ID");
        public final static Property Accountid = new Property(1, String.class, "accountid", false, "ACCOUNTID");
        public final static Property Mblogid = new Property(2, String.class, "mblogid", false, "MBLOGID");
        public final static Property Json = new Property(3, String.class, "json", false, "JSON");
    }


    public Green_TimeLineStatusDao(DaoConfig config) {
        super(config);
    }

    public Green_TimeLineStatusDao(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 + "\"time_line_status_table\" (" + //
                "\"_ID\" INTEGER," + // 0: _id
                "\"ACCOUNTID\" TEXT," + // 1: accountid
                "\"MBLOGID\" TEXT," + // 2: mblogid
                "\"JSON\" TEXT);"); // 3: json
    }

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

    /**
     * @inheritdoc
     */
    @Override
    protected void bindValues(SQLiteStatement stmt, Green_TimeLineStatus entity) {
        stmt.clearBindings();

        Integer _id = entity.get_id();
        if (_id != null) {
            stmt.bindLong(1, _id);
        }

        String accountid = entity.getAccountid();
        if (accountid != null) {
            stmt.bindString(2, accountid);
        }

        String mblogid = entity.getMblogid();
        if (mblogid != null) {
            stmt.bindString(3, mblogid);
        }

        String json = entity.getJson();
        if (json != null) {
            stmt.bindString(4, json);
        }
    }

    /**
     * @inheritdoc
     */
    @Override
    public Void readKey(Cursor cursor, int offset) {
        return null;
    }

    /**
     * @inheritdoc
     */
    @Override
    public Green_TimeLineStatus readEntity(Cursor cursor, int offset) {
        Green_TimeLineStatus entity = new Green_TimeLineStatus( //
                cursor.isNull(offset + 0) ? null : cursor.getInt(offset + 0), // _id
                cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // accountid
                cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // mblogid
                cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3) // json
        );
        return entity;
    }

    /**
     * @inheritdoc
     */
    @Override
    public void readEntity(Cursor cursor, Green_TimeLineStatus entity, int offset) {
        entity.set_id(cursor.isNull(offset + 0) ? null : cursor.getInt(offset + 0));
        entity.setAccountid(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setMblogid(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setJson(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
    }

    /**
     * @inheritdoc
     */
    @Override
    protected Void updateKeyAfterInsert(Green_TimeLineStatus entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }

    /**
     * @inheritdoc
     */
    @Override
    public Void getKey(Green_TimeLineStatus entity) {
        return null;
    }

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

}