Android Open Source - android-orm-benchmark User






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.sqlite;
//from  w w w  .j  a  v  a 2s.c om
import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;
import android.provider.BaseColumns;

public class User {

    public static final String TABLE_NAME = "user";

    public static final String LAST_NAME_COLUMN = "last_name";

    public static final String FIRST_NAME_COLUMN = "first_name";

    private long mId;

    private String mLastName;

    private String mFirstName;

    public static void createTable(DataBaseHelper helper) {
        helper.getWritableDatabase().execSQL(
                new StringBuilder("CREATE TABLE '").append(TABLE_NAME)
                        .append("' ('").append(BaseColumns._ID)
                        .append("' INTEGER PRIMARY KEY AUTOINCREMENT, '")
                        .append(LAST_NAME_COLUMN).append("' TEXT, '")
                        .append(FIRST_NAME_COLUMN).append("' TEXT);")
                        .toString());
    }

    public static void dropTable(DataBaseHelper helper) {
        SQLiteDatabase db = helper.getWritableDatabase();

        db.execSQL(new StringBuilder("DROP TABLE '").append(TABLE_NAME)
                .append("';").toString());
    }

    public long getId() {
        return mId;
    }

    public void setId(long id) {
        this.mId = id;
    }

    public String getLastName() {
        return mLastName;
    }

    public void setLastName(String lastName) {
        this.mLastName = lastName;
    }

    public String getFirstName() {
        return mFirstName;
    }

    public void setFirstName(String firstName) {
        this.mFirstName = firstName;
    }

    public ContentValues prepareForInsert() {
        ContentValues contentValues = new ContentValues();
        contentValues.put(LAST_NAME_COLUMN, mLastName);
        contentValues.put(FIRST_NAME_COLUMN, mFirstName);
        return contentValues;
    }
}




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