package com.casic.detector.greendao;

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

import com.casic.detector.bean.LabelBean;

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 "LABEL_BEAN".
*/
public class LabelBeanDao extends AbstractDao<LabelBean, Long> {

    public static final String TABLENAME = "LABEL_BEAN";

    /**
     * Properties of entity LabelBean.<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 ObjectType = new Property(1, String.class, "objectType", false, "OBJECT_TYPE");
        public final static Property PipelineType = new Property(2, String.class, "pipelineType", false, "PIPELINE_TYPE");
        public final static Property PipelineMaterial = new Property(3, String.class, "pipelineMaterial", false, "PIPELINE_MATERIAL");
        public final static Property PipelineDiameter = new Property(4, String.class, "pipelineDiameter", false, "PIPELINE_DIAMETER");
        public final static Property BuryDeep = new Property(5, String.class, "buryDeep", false, "BURY_DEEP");
        public final static Property LowerType = new Property(6, String.class, "lowerType", false, "LOWER_TYPE");
        public final static Property LowerMaterial = new Property(7, String.class, "lowerMaterial", false, "LOWER_MATERIAL");
        public final static Property LowerDiameter = new Property(8, String.class, "lowerDiameter", false, "LOWER_DIAMETER");
        public final static Property LowerDeep = new Property(9, String.class, "lowerDeep", false, "LOWER_DEEP");
        public final static Property BuryMethod = new Property(10, String.class, "buryMethod", false, "BURY_METHOD");
        public final static Property Area = new Property(11, String.class, "area", false, "AREA");
        public final static Property Line = new Property(12, String.class, "line", false, "LINE");
        public final static Property Road = new Property(13, String.class, "road", false, "ROAD");
        public final static Property ConstructTime = new Property(14, String.class, "constructTime", false, "CONSTRUCT_TIME");
        public final static Property Owner = new Property(15, String.class, "owner", false, "OWNER");
        public final static Property ObjectId = new Property(16, String.class, "objectId", false, "OBJECT_ID");
        public final static Property IdentifierId = new Property(17, String.class, "identifierId", false, "IDENTIFIER_ID");
        public final static Property IdentifierType = new Property(18, String.class, "identifierType", false, "IDENTIFIER_TYPE");
        public final static Property IdentifierDeep = new Property(19, String.class, "identifierDeep", false, "IDENTIFIER_DEEP");
        public final static Property Person = new Property(20, String.class, "person", false, "PERSON");
        public final static Property InstallTime = new Property(21, String.class, "installTime", false, "INSTALL_TIME");
        public final static Property Lng = new Property(22, String.class, "lng", false, "LNG");
        public final static Property Lat = new Property(23, String.class, "lat", false, "LAT");
        public final static Property Color = new Property(24, String.class, "color", false, "COLOR");
        public final static Property Remark = new Property(25, String.class, "remark", false, "REMARK");
        public final static Property ImagePath = new Property(26, String.class, "imagePath", false, "IMAGE_PATH");
    }


    public LabelBeanDao(DaoConfig config) {
        super(config);
    }
    
    public LabelBeanDao(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 + "\"LABEL_BEAN\" (" + //
                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
                "\"OBJECT_TYPE\" TEXT," + // 1: objectType
                "\"PIPELINE_TYPE\" TEXT," + // 2: pipelineType
                "\"PIPELINE_MATERIAL\" TEXT," + // 3: pipelineMaterial
                "\"PIPELINE_DIAMETER\" TEXT," + // 4: pipelineDiameter
                "\"BURY_DEEP\" TEXT," + // 5: buryDeep
                "\"LOWER_TYPE\" TEXT," + // 6: lowerType
                "\"LOWER_MATERIAL\" TEXT," + // 7: lowerMaterial
                "\"LOWER_DIAMETER\" TEXT," + // 8: lowerDiameter
                "\"LOWER_DEEP\" TEXT," + // 9: lowerDeep
                "\"BURY_METHOD\" TEXT," + // 10: buryMethod
                "\"AREA\" TEXT," + // 11: area
                "\"LINE\" TEXT," + // 12: line
                "\"ROAD\" TEXT," + // 13: road
                "\"CONSTRUCT_TIME\" TEXT," + // 14: constructTime
                "\"OWNER\" TEXT," + // 15: owner
                "\"OBJECT_ID\" TEXT," + // 16: objectId
                "\"IDENTIFIER_ID\" TEXT," + // 17: identifierId
                "\"IDENTIFIER_TYPE\" TEXT," + // 18: identifierType
                "\"IDENTIFIER_DEEP\" TEXT," + // 19: identifierDeep
                "\"PERSON\" TEXT," + // 20: person
                "\"INSTALL_TIME\" TEXT," + // 21: installTime
                "\"LNG\" TEXT," + // 22: lng
                "\"LAT\" TEXT," + // 23: lat
                "\"COLOR\" TEXT," + // 24: color
                "\"REMARK\" TEXT," + // 25: remark
                "\"IMAGE_PATH\" TEXT);"); // 26: imagePath
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, LabelBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String objectType = entity.getObjectType();
        if (objectType != null) {
            stmt.bindString(2, objectType);
        }
 
        String pipelineType = entity.getPipelineType();
        if (pipelineType != null) {
            stmt.bindString(3, pipelineType);
        }
 
        String pipelineMaterial = entity.getPipelineMaterial();
        if (pipelineMaterial != null) {
            stmt.bindString(4, pipelineMaterial);
        }
 
        String pipelineDiameter = entity.getPipelineDiameter();
        if (pipelineDiameter != null) {
            stmt.bindString(5, pipelineDiameter);
        }
 
        String buryDeep = entity.getBuryDeep();
        if (buryDeep != null) {
            stmt.bindString(6, buryDeep);
        }
 
        String lowerType = entity.getLowerType();
        if (lowerType != null) {
            stmt.bindString(7, lowerType);
        }
 
        String lowerMaterial = entity.getLowerMaterial();
        if (lowerMaterial != null) {
            stmt.bindString(8, lowerMaterial);
        }
 
        String lowerDiameter = entity.getLowerDiameter();
        if (lowerDiameter != null) {
            stmt.bindString(9, lowerDiameter);
        }
 
        String lowerDeep = entity.getLowerDeep();
        if (lowerDeep != null) {
            stmt.bindString(10, lowerDeep);
        }
 
        String buryMethod = entity.getBuryMethod();
        if (buryMethod != null) {
            stmt.bindString(11, buryMethod);
        }
 
        String area = entity.getArea();
        if (area != null) {
            stmt.bindString(12, area);
        }
 
        String line = entity.getLine();
        if (line != null) {
            stmt.bindString(13, line);
        }
 
        String road = entity.getRoad();
        if (road != null) {
            stmt.bindString(14, road);
        }
 
        String constructTime = entity.getConstructTime();
        if (constructTime != null) {
            stmt.bindString(15, constructTime);
        }
 
        String owner = entity.getOwner();
        if (owner != null) {
            stmt.bindString(16, owner);
        }
 
        String objectId = entity.getObjectId();
        if (objectId != null) {
            stmt.bindString(17, objectId);
        }
 
        String identifierId = entity.getIdentifierId();
        if (identifierId != null) {
            stmt.bindString(18, identifierId);
        }
 
        String identifierType = entity.getIdentifierType();
        if (identifierType != null) {
            stmt.bindString(19, identifierType);
        }
 
        String identifierDeep = entity.getIdentifierDeep();
        if (identifierDeep != null) {
            stmt.bindString(20, identifierDeep);
        }
 
        String person = entity.getPerson();
        if (person != null) {
            stmt.bindString(21, person);
        }
 
        String installTime = entity.getInstallTime();
        if (installTime != null) {
            stmt.bindString(22, installTime);
        }
 
        String lng = entity.getLng();
        if (lng != null) {
            stmt.bindString(23, lng);
        }
 
        String lat = entity.getLat();
        if (lat != null) {
            stmt.bindString(24, lat);
        }
 
        String color = entity.getColor();
        if (color != null) {
            stmt.bindString(25, color);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(26, remark);
        }
 
        String imagePath = entity.getImagePath();
        if (imagePath != null) {
            stmt.bindString(27, imagePath);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, LabelBean entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        String objectType = entity.getObjectType();
        if (objectType != null) {
            stmt.bindString(2, objectType);
        }
 
        String pipelineType = entity.getPipelineType();
        if (pipelineType != null) {
            stmt.bindString(3, pipelineType);
        }
 
        String pipelineMaterial = entity.getPipelineMaterial();
        if (pipelineMaterial != null) {
            stmt.bindString(4, pipelineMaterial);
        }
 
        String pipelineDiameter = entity.getPipelineDiameter();
        if (pipelineDiameter != null) {
            stmt.bindString(5, pipelineDiameter);
        }
 
        String buryDeep = entity.getBuryDeep();
        if (buryDeep != null) {
            stmt.bindString(6, buryDeep);
        }
 
        String lowerType = entity.getLowerType();
        if (lowerType != null) {
            stmt.bindString(7, lowerType);
        }
 
        String lowerMaterial = entity.getLowerMaterial();
        if (lowerMaterial != null) {
            stmt.bindString(8, lowerMaterial);
        }
 
        String lowerDiameter = entity.getLowerDiameter();
        if (lowerDiameter != null) {
            stmt.bindString(9, lowerDiameter);
        }
 
        String lowerDeep = entity.getLowerDeep();
        if (lowerDeep != null) {
            stmt.bindString(10, lowerDeep);
        }
 
        String buryMethod = entity.getBuryMethod();
        if (buryMethod != null) {
            stmt.bindString(11, buryMethod);
        }
 
        String area = entity.getArea();
        if (area != null) {
            stmt.bindString(12, area);
        }
 
        String line = entity.getLine();
        if (line != null) {
            stmt.bindString(13, line);
        }
 
        String road = entity.getRoad();
        if (road != null) {
            stmt.bindString(14, road);
        }
 
        String constructTime = entity.getConstructTime();
        if (constructTime != null) {
            stmt.bindString(15, constructTime);
        }
 
        String owner = entity.getOwner();
        if (owner != null) {
            stmt.bindString(16, owner);
        }
 
        String objectId = entity.getObjectId();
        if (objectId != null) {
            stmt.bindString(17, objectId);
        }
 
        String identifierId = entity.getIdentifierId();
        if (identifierId != null) {
            stmt.bindString(18, identifierId);
        }
 
        String identifierType = entity.getIdentifierType();
        if (identifierType != null) {
            stmt.bindString(19, identifierType);
        }
 
        String identifierDeep = entity.getIdentifierDeep();
        if (identifierDeep != null) {
            stmt.bindString(20, identifierDeep);
        }
 
        String person = entity.getPerson();
        if (person != null) {
            stmt.bindString(21, person);
        }
 
        String installTime = entity.getInstallTime();
        if (installTime != null) {
            stmt.bindString(22, installTime);
        }
 
        String lng = entity.getLng();
        if (lng != null) {
            stmt.bindString(23, lng);
        }
 
        String lat = entity.getLat();
        if (lat != null) {
            stmt.bindString(24, lat);
        }
 
        String color = entity.getColor();
        if (color != null) {
            stmt.bindString(25, color);
        }
 
        String remark = entity.getRemark();
        if (remark != null) {
            stmt.bindString(26, remark);
        }
 
        String imagePath = entity.getImagePath();
        if (imagePath != null) {
            stmt.bindString(27, imagePath);
        }
    }

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

    @Override
    public LabelBean readEntity(Cursor cursor, int offset) {
        LabelBean entity = new LabelBean( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // objectType
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // pipelineType
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // pipelineMaterial
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // pipelineDiameter
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // buryDeep
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // lowerType
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // lowerMaterial
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lowerDiameter
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // lowerDeep
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // buryMethod
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // area
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // line
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // road
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // constructTime
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // owner
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // objectId
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // identifierId
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // identifierType
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // identifierDeep
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // person
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // installTime
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // lng
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // lat
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // color
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // remark
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26) // imagePath
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, LabelBean entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setObjectType(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setPipelineType(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setPipelineMaterial(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setPipelineDiameter(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setBuryDeep(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setLowerType(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setLowerMaterial(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setLowerDiameter(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setLowerDeep(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setBuryMethod(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setArea(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setLine(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setRoad(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setConstructTime(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setOwner(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setObjectId(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setIdentifierId(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setIdentifierType(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setIdentifierDeep(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setPerson(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setInstallTime(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setLng(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setLat(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setColor(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setRemark(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setImagePath(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(LabelBean entity, long rowId) {
        entity.setId(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(LabelBean entity) {
        if(entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

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

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