package com.oo.eye.gen;

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.oo.eye.bean.ClassBean;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "CLASS_BEAN".
*/
public class ClassBeanDao extends AbstractDao<ClassBean, Void> {

    public static final String TABLENAME = "CLASS_BEAN";

    /**
     * Properties of entity ClassBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, String.class, "id", false, "ID");
        public final static Property Sid = new Property(1, String.class, "sid", false, "SID");
        public final static Property Grade = new Property(2, String.class, "grade", false, "GRADE");
        public final static Property Classes = new Property(3, String.class, "classes", false, "CLASSES");
        public final static Property Status = new Property(4, String.class, "status", false, "STATUS");
        public final static Property Orderlist = new Property(5, String.class, "orderlist", false, "ORDERLIST");
        public final static Property Password = new Property(6, String.class, "password", false, "PASSWORD");
    }


    public ClassBeanDao(DaoConfig config) {
        super(config);
    }
    
    public ClassBeanDao(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 + "\"CLASS_BEAN\" (" + //
                "\"ID\" TEXT," + // 0: id
                "\"SID\" TEXT," + // 1: sid
                "\"GRADE\" TEXT," + // 2: grade
                "\"CLASSES\" TEXT," + // 3: classes
                "\"STATUS\" TEXT," + // 4: status
                "\"ORDERLIST\" TEXT," + // 5: orderlist
                "\"PASSWORD\" TEXT);"); // 6: password
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, ClassBean entity) {
        stmt.clearBindings();
 
        String id = entity.getId();
        if (id != null) {
            stmt.bindString(1, id);
        }
 
        String sid = entity.getSid();
        if (sid != null) {
            stmt.bindString(2, sid);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(3, grade);
        }
 
        String classes = entity.getClasses();
        if (classes != null) {
            stmt.bindString(4, classes);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(5, status);
        }
 
        String orderlist = entity.getOrderlist();
        if (orderlist != null) {
            stmt.bindString(6, orderlist);
        }
 
        String password = entity.getPassword();
        if (password != null) {
            stmt.bindString(7, password);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, ClassBean entity) {
        stmt.clearBindings();
 
        String id = entity.getId();
        if (id != null) {
            stmt.bindString(1, id);
        }
 
        String sid = entity.getSid();
        if (sid != null) {
            stmt.bindString(2, sid);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(3, grade);
        }
 
        String classes = entity.getClasses();
        if (classes != null) {
            stmt.bindString(4, classes);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(5, status);
        }
 
        String orderlist = entity.getOrderlist();
        if (orderlist != null) {
            stmt.bindString(6, orderlist);
        }
 
        String password = entity.getPassword();
        if (password != null) {
            stmt.bindString(7, password);
        }
    }

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

    @Override
    public ClassBean readEntity(Cursor cursor, int offset) {
        ClassBean entity = new ClassBean( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // sid
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // grade
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // classes
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // status
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // orderlist
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6) // password
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, ClassBean entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setSid(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setGrade(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setClasses(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setStatus(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setOrderlist(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setPassword(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(ClassBean entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(ClassBean entity) {
        return null;
    }

    @Override
    public boolean hasKey(ClassBean entity) {
        // TODO
        return false;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
