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.StudentBean;

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

    public static final String TABLENAME = "STUDENT_BEAN";

    /**
     * Properties of entity StudentBean.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Sid = new Property(0, String.class, "sid", false, "SID");
        public final static Property Uid = new Property(1, String.class, "uid", false, "UID");
        public final static Property School = new Property(2, String.class, "school", false, "SCHOOL");
        public final static Property Grade = new Property(3, String.class, "grade", false, "GRADE");
        public final static Property Classes = new Property(4, String.class, "classes", false, "CLASSES");
        public final static Property Status = new Property(5, String.class, "status", false, "STATUS");
        public final static Property Realname = new Property(6, String.class, "realname", false, "REALNAME");
        public final static Property Number = new Property(7, String.class, "number", false, "NUMBER");
        public final static Property Left_eye = new Property(8, double.class, "left_eye", false, "LEFT_EYE");
        public final static Property Right_eye = new Property(9, double.class, "right_eye", false, "RIGHT_EYE");
        public final static Property Url = new Property(10, String.class, "url", false, "URL");
        public final static Property Pid = new Property(11, String.class, "pid", false, "PID");
        public final static Property Distance = new Property(12, int.class, "distance", false, "DISTANCE");
        public final static Property IsChick = new Property(13, boolean.class, "isChick", false, "IS_CHICK");
        public final static Property Birthday = new Property(14, String.class, "birthday", false, "BIRTHDAY");
        public final static Property Classname = new Property(15, String.class, "classname", false, "CLASSNAME");
    }


    public StudentBeanDao(DaoConfig config) {
        super(config);
    }
    
    public StudentBeanDao(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 + "\"STUDENT_BEAN\" (" + //
                "\"SID\" TEXT," + // 0: sid
                "\"UID\" TEXT," + // 1: uid
                "\"SCHOOL\" TEXT," + // 2: school
                "\"GRADE\" TEXT," + // 3: grade
                "\"CLASSES\" TEXT," + // 4: classes
                "\"STATUS\" TEXT," + // 5: status
                "\"REALNAME\" TEXT," + // 6: realname
                "\"NUMBER\" TEXT," + // 7: number
                "\"LEFT_EYE\" REAL NOT NULL ," + // 8: left_eye
                "\"RIGHT_EYE\" REAL NOT NULL ," + // 9: right_eye
                "\"URL\" TEXT," + // 10: url
                "\"PID\" TEXT," + // 11: pid
                "\"DISTANCE\" INTEGER NOT NULL ," + // 12: distance
                "\"IS_CHICK\" INTEGER NOT NULL ," + // 13: isChick
                "\"BIRTHDAY\" TEXT," + // 14: birthday
                "\"CLASSNAME\" TEXT);"); // 15: classname
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, StudentBean entity) {
        stmt.clearBindings();
 
        String sid = entity.getSid();
        if (sid != null) {
            stmt.bindString(1, sid);
        }
 
        String uid = entity.getUid();
        if (uid != null) {
            stmt.bindString(2, uid);
        }
 
        String school = entity.getSchool();
        if (school != null) {
            stmt.bindString(3, school);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(4, grade);
        }
 
        String classes = entity.getClasses();
        if (classes != null) {
            stmt.bindString(5, classes);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(6, status);
        }
 
        String realname = entity.getRealname();
        if (realname != null) {
            stmt.bindString(7, realname);
        }
 
        String number = entity.getNumber();
        if (number != null) {
            stmt.bindString(8, number);
        }
        stmt.bindDouble(9, entity.getLeft_eye());
        stmt.bindDouble(10, entity.getRight_eye());
 
        String url = entity.getUrl();
        if (url != null) {
            stmt.bindString(11, url);
        }
 
        String pid = entity.getPid();
        if (pid != null) {
            stmt.bindString(12, pid);
        }
        stmt.bindLong(13, entity.getDistance());
        stmt.bindLong(14, entity.getIsChick() ? 1L: 0L);
 
        String birthday = entity.getBirthday();
        if (birthday != null) {
            stmt.bindString(15, birthday);
        }
 
        String classname = entity.getClassname();
        if (classname != null) {
            stmt.bindString(16, classname);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, StudentBean entity) {
        stmt.clearBindings();
 
        String sid = entity.getSid();
        if (sid != null) {
            stmt.bindString(1, sid);
        }
 
        String uid = entity.getUid();
        if (uid != null) {
            stmt.bindString(2, uid);
        }
 
        String school = entity.getSchool();
        if (school != null) {
            stmt.bindString(3, school);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(4, grade);
        }
 
        String classes = entity.getClasses();
        if (classes != null) {
            stmt.bindString(5, classes);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(6, status);
        }
 
        String realname = entity.getRealname();
        if (realname != null) {
            stmt.bindString(7, realname);
        }
 
        String number = entity.getNumber();
        if (number != null) {
            stmt.bindString(8, number);
        }
        stmt.bindDouble(9, entity.getLeft_eye());
        stmt.bindDouble(10, entity.getRight_eye());
 
        String url = entity.getUrl();
        if (url != null) {
            stmt.bindString(11, url);
        }
 
        String pid = entity.getPid();
        if (pid != null) {
            stmt.bindString(12, pid);
        }
        stmt.bindLong(13, entity.getDistance());
        stmt.bindLong(14, entity.getIsChick() ? 1L: 0L);
 
        String birthday = entity.getBirthday();
        if (birthday != null) {
            stmt.bindString(15, birthday);
        }
 
        String classname = entity.getClassname();
        if (classname != null) {
            stmt.bindString(16, classname);
        }
    }

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

    @Override
    public StudentBean readEntity(Cursor cursor, int offset) {
        StudentBean entity = new StudentBean( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // sid
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // uid
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // school
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // grade
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // classes
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // status
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // realname
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // number
            cursor.getDouble(offset + 8), // left_eye
            cursor.getDouble(offset + 9), // right_eye
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // url
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // pid
            cursor.getInt(offset + 12), // distance
            cursor.getShort(offset + 13) != 0, // isChick
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // birthday
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15) // classname
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, StudentBean entity, int offset) {
        entity.setSid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setUid(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setSchool(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setGrade(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setClasses(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setStatus(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setRealname(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setNumber(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setLeft_eye(cursor.getDouble(offset + 8));
        entity.setRight_eye(cursor.getDouble(offset + 9));
        entity.setUrl(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setPid(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setDistance(cursor.getInt(offset + 12));
        entity.setIsChick(cursor.getShort(offset + 13) != 0);
        entity.setBirthday(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setClassname(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(StudentBean entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(StudentBean entity) {
        return null;
    }

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

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