- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
// used SQL statements
private static final String UNIQUE = " UNIQUE ";
private static final String INTEGER = " INTEGER ";
private static final String TEXT = " TEXT ";
private static final String INTEGERC = " INTEGER, ";
private static final String TEXTC = " TEXT, ";
private static final String PARENTHSE_LEFT = " ( ";
private static final String PARENTHSE_RIGHT = " ) ";
private static final String CREATE_TABLE_IF_NOT_EXISTS = "CREATE TABLE IF NOT EXISTS ";
private static final String INTEGER_PRIMARY_KEY = " INTEGER PRIMARY KEY, ";
private static final String DROP_TABLE_IF_EXISTS = "DROP TABLE IF EXISTS ";
...
private void createLanguageTable(SQLiteDatabase db) {
final StringBuilder sql = new StringBuilder();
sql.append(CREATE_TABLE_IF_NOT_EXISTS);
sql.append(LANGUAGE);
sql.append(PARENTHSE_LEFT);
sql.append(LANGUAGE_ID);
sql.append(INTEGER_PRIMARY_KEY);
sql.append(LANGUAGE_NAME);
sql.append(TEXTC);
sql.append(UNIQUE); // ensures uniqueness for languages
sql.append(PARENTHSE_LEFT);
sql.append(LANGUAGE_NAME);
sql.append(PARENTHSE_RIGHT);
sql.append(PARENTHSE_RIGHT);
Log.d("CREATE_TABLE_LANGUAGE", sql.toString());
db.execSQL(sql.toString());
}
Случайно найдено на просторах интернета здесь: http://cleancodedevelopment-qualityseal.blogspot.com/2014/07/how-to-import-export-or-backup-sqlite.html
Кто подскажет, может, есть какой-нибудь сакральный смысл писать так по-индусски?