package com.casic.detector.greendao;

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

import com.casic.detector.bean.SmallLabelBean;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;
import org.greenrobot.greendao.internal.DaoConfig;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "SMALL_LABEL_BEAN".
*/
public class SmallLabelBeanDao extends AbstractDao<SmallLabelBean, Long> {

    public static final String TABLENAME = "SMALL_LABEL_BEAN";

    /**
     * Properties of entity SmallLabelBean.<br/>
     * 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 MarkerId = new Property(1, String.class, "markerId", false, "MARKER_ID");
        public final static Property LocationNo = new Property(2, String.class, "locationNo", false, "LOCATION_NO");
        public final static Property LocationName = new Property(3, String.class, "locationName", false, "LOCATION_NAME");
        public final static Property SmallMarkerId = new Property(4, String.class, "smallMarkerId", false, "SMALL_MARKER_ID");
        public final static Property CableName = new Property(5, String.class, "cableName", false, "CABLE_NAME");
        public final static Property CableNo = new Property(6, String.class, "cableNo", false, "CABLE_NO");
        public final static Property Line = new Property(7, String.class, "line", false, "LINE");
        public final static Property PressLevel = new Property(8, String.class, "pressLevel", false, "PRESS_LEVEL");
        public final static Property CableType = new Property(9, String.class, "cableType", false, "CABLE_TYPE");
        public final static Property CableSpec = new Property(10, String.class, "cableSpec", false, "CABLE_SPEC");
        public final static Property CableBrand = new Property(11, String.class, "cableBrand", false, "CABLE_BRAND");
        public final static Property CableStart = new Property(12, String.class, "cableStart", false, "CABLE_START");
        public final static Property CableEnd = new Property(13, String.class, "cableEnd", false, "CABLE_END");
        public final static Property HasJoint = new Property(14, String.class, "hasJoint", false, "HAS_JOINT");
        public final static Property JointCreator = new Property(15, String.class, "jointCreator", false, "JOINT_CREATOR");
        public final static Property CreateTime = new Property(16, String.class, "createTime", false, "CREATE_TIME");
        public final static Property Path = new Property(17, String.class, "path", false, "PATH");
        public final static Property Memo1 = new Property(18, String.class, "memo1", false, "MEMO1");
        public final static Property Memo2 = new Property(19, String.class, "memo2", false, "MEMO2");
        public final static Property Memo3 = new Property(20, String.class, "memo3", false, "MEMO3");
    }


    public SmallLabelBeanDao(DaoConfig config) {
        super(config);
    }
    
    public SmallLabelBeanDao(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 + "\"SMALL_LABEL_BEAN\" (" + //
                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
                "\"MARKER_ID\" TEXT," + // 1: markerId
                "\"LOCATION_NO\" TEXT," + // 2: locationNo
                "\"LOCATION_NAME\" TEXT," + // 3: locationName
                "\"SMALL_MARKER_ID\" TEXT," + // 4: smallMarkerId
                "\"CABLE_NAME\" TEXT," + // 5: cableName
                "\"CABLE_NO\" TEXT," + // 6: cableNo
                "\"LINE\" TEXT," + // 7: line
                "\"PRESS_LEVEL\" TEXT," + // 8: pressLevel
                "\"CABLE_TYPE\" TEXT," + // 9: cableType
                "\"CABLE_SPEC\" TEXT," + // 10: cableSpec
                "\"CABLE_BRAND\" TEXT," + // 11: cableBrand
                "\"CABLE_START\" TEXT," + // 12: cableStart
                "\"CABLE_END\" TEXT," + // 13: cableEnd
                "\"HAS_JOINT\" TEXT," + // 14: hasJoint
                "\"JOINT_CREATOR\" TEXT," + // 15: jointCreator
                "\"CREATE_TIME\" TEXT," + // 16: createTime
                "\"PATH\" TEXT," + // 17: path
                "\"MEMO1\" TEXT," + // 18: memo1
                "\"MEMO2\" TEXT," + // 19: memo2
                "\"MEMO3\" TEXT);"); // 20: memo3
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, SmallLabelBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String markerId = entity.getMarkerId();
        if (markerId != null) {
            stmt.bindString(2, markerId);
        }
 
        String locationNo = entity.getLocationNo();
        if (locationNo != null) {
            stmt.bindString(3, locationNo);
        }
 
        String locationName = entity.getLocationName();
        if (locationName != null) {
            stmt.bindString(4, locationName);
        }
 
        String smallMarkerId = entity.getSmallMarkerId();
        if (smallMarkerId != null) {
            stmt.bindString(5, smallMarkerId);
        }
 
        String cableName = entity.getCableName();
        if (cableName != null) {
            stmt.bindString(6, cableName);
        }
 
        String cableNo = entity.getCableNo();
        if (cableNo != null) {
            stmt.bindString(7, cableNo);
        }
 
        String line = entity.getLine();
        if (line != null) {
            stmt.bindString(8, line);
        }
 
        String pressLevel = entity.getPressLevel();
        if (pressLevel != null) {
            stmt.bindString(9, pressLevel);
        }
 
        String cableType = entity.getCableType();
        if (cableType != null) {
            stmt.bindString(10, cableType);
        }
 
        String cableSpec = entity.getCableSpec();
        if (cableSpec != null) {
            stmt.bindString(11, cableSpec);
        }
 
        String cableBrand = entity.getCableBrand();
        if (cableBrand != null) {
            stmt.bindString(12, cableBrand);
        }
 
        String cableStart = entity.getCableStart();
        if (cableStart != null) {
            stmt.bindString(13, cableStart);
        }
 
        String cableEnd = entity.getCableEnd();
        if (cableEnd != null) {
            stmt.bindString(14, cableEnd);
        }
 
        String hasJoint = entity.getHasJoint();
        if (hasJoint != null) {
            stmt.bindString(15, hasJoint);
        }
 
        String jointCreator = entity.getJointCreator();
        if (jointCreator != null) {
            stmt.bindString(16, jointCreator);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(17, createTime);
        }
 
        String path = entity.getPath();
        if (path != null) {
            stmt.bindString(18, path);
        }
 
        String memo1 = entity.getMemo1();
        if (memo1 != null) {
            stmt.bindString(19, memo1);
        }
 
        String memo2 = entity.getMemo2();
        if (memo2 != null) {
            stmt.bindString(20, memo2);
        }
 
        String memo3 = entity.getMemo3();
        if (memo3 != null) {
            stmt.bindString(21, memo3);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, SmallLabelBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String markerId = entity.getMarkerId();
        if (markerId != null) {
            stmt.bindString(2, markerId);
        }
 
        String locationNo = entity.getLocationNo();
        if (locationNo != null) {
            stmt.bindString(3, locationNo);
        }
 
        String locationName = entity.getLocationName();
        if (locationName != null) {
            stmt.bindString(4, locationName);
        }
 
        String smallMarkerId = entity.getSmallMarkerId();
        if (smallMarkerId != null) {
            stmt.bindString(5, smallMarkerId);
        }
 
        String cableName = entity.getCableName();
        if (cableName != null) {
            stmt.bindString(6, cableName);
        }
 
        String cableNo = entity.getCableNo();
        if (cableNo != null) {
            stmt.bindString(7, cableNo);
        }
 
        String line = entity.getLine();
        if (line != null) {
            stmt.bindString(8, line);
        }
 
        String pressLevel = entity.getPressLevel();
        if (pressLevel != null) {
            stmt.bindString(9, pressLevel);
        }
 
        String cableType = entity.getCableType();
        if (cableType != null) {
            stmt.bindString(10, cableType);
        }
 
        String cableSpec = entity.getCableSpec();
        if (cableSpec != null) {
            stmt.bindString(11, cableSpec);
        }
 
        String cableBrand = entity.getCableBrand();
        if (cableBrand != null) {
            stmt.bindString(12, cableBrand);
        }
 
        String cableStart = entity.getCableStart();
        if (cableStart != null) {
            stmt.bindString(13, cableStart);
        }
 
        String cableEnd = entity.getCableEnd();
        if (cableEnd != null) {
            stmt.bindString(14, cableEnd);
        }
 
        String hasJoint = entity.getHasJoint();
        if (hasJoint != null) {
            stmt.bindString(15, hasJoint);
        }
 
        String jointCreator = entity.getJointCreator();
        if (jointCreator != null) {
            stmt.bindString(16, jointCreator);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(17, createTime);
        }
 
        String path = entity.getPath();
        if (path != null) {
            stmt.bindString(18, path);
        }
 
        String memo1 = entity.getMemo1();
        if (memo1 != null) {
            stmt.bindString(19, memo1);
        }
 
        String memo2 = entity.getMemo2();
        if (memo2 != null) {
            stmt.bindString(20, memo2);
        }
 
        String memo3 = entity.getMemo3();
        if (memo3 != null) {
            stmt.bindString(21, memo3);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
    }    

    @Override
    public SmallLabelBean readEntity(Cursor cursor, int offset) {
        SmallLabelBean entity = new SmallLabelBean( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // markerId
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // locationNo
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // locationName
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // smallMarkerId
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // cableName
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // cableNo
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // line
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // pressLevel
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // cableType
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // cableSpec
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // cableBrand
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // cableStart
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // cableEnd
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // hasJoint
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // jointCreator
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // createTime
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // path
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // memo1
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // memo2
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20) // memo3
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, SmallLabelBean entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setMarkerId(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setLocationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setLocationName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setSmallMarkerId(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setCableName(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setCableNo(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setLine(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setPressLevel(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setCableType(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setCableSpec(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setCableBrand(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setCableStart(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setCableEnd(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setHasJoint(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setJointCreator(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setCreateTime(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setPath(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setMemo1(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setMemo2(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setMemo3(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(SmallLabelBean entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(SmallLabelBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(SmallLabelBean entity) {
        return entity.getId() != null;
    }

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