Back to project page android-mvc-framework.
The source code is released under:
Apache License
If you think the Android project android-mvc-framework listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.android_mvc.framework.db.schema; /* ww w.ja v a2s . c o m*/ /** * SQLite???????????????????????? * @author id:language_and_engineering * */ public class RDBColumn { private String column_name; private String type_name; private boolean primary_key_flag = false; private boolean not_null_flag = false; /** * ?????????? */ public RDBColumn nameIs(String column_name) { this.column_name = column_name; return this; } /** * ?????????????? */ public RDBColumn typeIs(String type_name) { // TODO: type????typo?????????????????????????????????????????????????????????????? this.type_name = type_name; return this; } /** * ?????????????????not null?????????? */ public RDBColumn primaryKey() { this.primary_key_flag = true; this.type_name = "integer"; return this; } /** * not null???????? */ public RDBColumn notNull() { this.not_null_flag = true; return this; } /** * ??????SQL???????????????DDL??????? */ protected String toSQLString() { // SAMPLE: // "id integer primary key autoincrement" // "hoge text not null" String sql = ""; sql += column_name + " " + type_name; // ?????????? if( primary_key_flag ) { sql += " primary key autoincrement"; // http://www.dbonline.jp/sqlite/table/index6.html } else { if( not_null_flag ) { sql += " not null"; } } return sql; } }