Android Open Source - android-orm-benchmark Dao Master






From Project

Back to project page android-orm-benchmark.

License

The source code is released under:

Apache License

If you think the Android project android-orm-benchmark listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.littleinc.orm_benchmark.greendao;
// w w  w . jav  a  2 s  .c  o m
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import de.greenrobot.dao.AbstractDaoMaster;
import de.greenrobot.dao.identityscope.IdentityScopeType;

import com.littleinc.orm_benchmark.greendao.UserDao;
import com.littleinc.orm_benchmark.greendao.MessageDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * Master of DAO (schema version 2): knows all DAOs.
*/
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 2;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {
        UserDao.createTable(db, ifNotExists);
        MessageDao.createTable(db, ifNotExists);
    }
    
    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(SQLiteDatabase db, boolean ifExists) {
        UserDao.dropTable(db, ifExists);
        MessageDao.dropTable(db, ifExists);
    }
    
    public static abstract class OpenHelper extends SQLiteOpenHelper {

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(SQLiteDatabase db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }
    
    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

    public DaoMaster(SQLiteDatabase db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(UserDao.class);
        registerDaoClass(MessageDao.class);
    }
    
    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }
    
    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }
    
}




Java Source Code List

com.littleinc.orm_benchmark.Application.java
com.littleinc.orm_benchmark.BenchmarkExecutable.java
com.littleinc.orm_benchmark.MainActivity.java
com.littleinc.orm_benchmark.greendao.DaoMaster.java
com.littleinc.orm_benchmark.greendao.DaoSession.java
com.littleinc.orm_benchmark.greendao.DataBaseHelper.java
com.littleinc.orm_benchmark.greendao.Generator.java
com.littleinc.orm_benchmark.greendao.GreenDaoExecutor.java
com.littleinc.orm_benchmark.greendao.MessageDao.java
com.littleinc.orm_benchmark.greendao.Message.java
com.littleinc.orm_benchmark.greendao.UserDao.java
com.littleinc.orm_benchmark.greendao.User.java
com.littleinc.orm_benchmark.ormlite.Contact.java
com.littleinc.orm_benchmark.ormlite.DataBaseHelper.java
com.littleinc.orm_benchmark.ormlite.Message.java
com.littleinc.orm_benchmark.ormlite.ORMLiteExecutor.java
com.littleinc.orm_benchmark.ormlite.User.java
com.littleinc.orm_benchmark.ormlite.config.DBConfigUtil.java
com.littleinc.orm_benchmark.sqlite.DataBaseHelper.java
com.littleinc.orm_benchmark.sqlite.Message.java
com.littleinc.orm_benchmark.sqlite.SQLiteExecutor.java
com.littleinc.orm_benchmark.sqlite.User.java
com.littleinc.orm_benchmark.util.Util.java