Java Code Examples for org.greenrobot.greendao.database.Database#execSQL()
The following examples show how to use
org.greenrobot.greendao.database.Database#execSQL() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CourseV2Dao.java From ClassSchedule with Apache License 2.0 | 6 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"COURSE_V2\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: couId "\"COU_NAME\" TEXT," + // 1: couName "\"COU_LOCATION\" TEXT," + // 2: couLocation "\"COU_TEACHER\" TEXT," + // 3: couTeacher "\"COU_WEEK\" INTEGER," + // 4: couWeek "\"COU_START_NODE\" INTEGER," + // 5: couStartNode "\"COU_NODE_COUNT\" INTEGER," + // 6: couNodeCount "\"COU_ALL_WEEK\" TEXT," + // 7: couAllWeek "\"COU_COLOR\" INTEGER," + // 8: couColor "\"COU_CG_ID\" INTEGER," + // 9: couCgId "\"COU_ONLY_ID\" TEXT," + // 10: couOnlyId "\"COU_DELETED\" INTEGER);"); // 11: couDeleted }
Example 2
Source File: ImageDao.java From ml-authentication with Apache License 2.0 | 6 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"IMAGE\" (" + // "\"_id\" INTEGER PRIMARY KEY ," + // 0: id "\"LOCALE\" TEXT NOT NULL ," + // 1: locale "\"TIME_LAST_UPDATE\" INTEGER," + // 2: timeLastUpdate "\"REVISION_NUMBER\" INTEGER NOT NULL ," + // 3: revisionNumber "\"CONTENT_STATUS\" TEXT NOT NULL ," + // 4: contentStatus "\"CONTENT_TYPE\" TEXT NOT NULL ," + // 5: contentType "\"LITERACY_SKILLS\" TEXT," + // 6: literacySkills "\"NUMERACY_SKILLS\" TEXT," + // 7: numeracySkills "\"TITLE\" TEXT NOT NULL ," + // 8: title "\"IMAGE_FORMAT\" TEXT NOT NULL ," + // 9: imageFormat "\"DOMINANT_COLOR\" TEXT);"); // 10: dominantColor }
Example 3
Source File: UserDao.java From KUtils with Apache License 2.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"USER\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"NAME\" TEXT," + // 1: name "\"AGE\" INTEGER NOT NULL );"); // 2: age }
Example 4
Source File: DeviceDao.java From ml-authentication with Apache License 2.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"DEVICE\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"DEVICE_ID\" TEXT NOT NULL UNIQUE );"); // 1: deviceId }
Example 5
Source File: LikeBeanDao.java From Ency with Apache License 2.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"LIKE_BEAN\" (" + // "\"_id\" INTEGER PRIMARY KEY ," + // 0: id "\"GUID\" TEXT," + // 1: guid "\"IMAGE_URL\" TEXT," + // 2: imageUrl "\"TITLE\" TEXT," + // 3: title "\"URL\" TEXT," + // 4: url "\"TYPE\" INTEGER NOT NULL ," + // 5: type "\"TIME\" INTEGER NOT NULL );"); // 6: time }
Example 6
Source File: WeatherEntityDao.java From easyweather with MIT License | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"WEATHER_ENTITY\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"CITY_NAME\" TEXT," + // 1: cityName "\"WEATHER\" BLOB," + // 2: weather "\"UPDATE_TIME\" INTEGER);"); // 3: updateTime }
Example 7
Source File: JoinLettersWithAllophonesDao.java From ml-authentication with Apache License 2.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"JOIN_LETTERS_WITH_ALLOPHONES\" (" + // "\"_id\" INTEGER PRIMARY KEY ," + // 0: id "\"LETTER_ID\" INTEGER NOT NULL ," + // 1: letterId "\"ALLOPHONE_ID\" INTEGER NOT NULL );"); // 2: allophoneId }
Example 8
Source File: LocalUserDao.java From OpenHub with GNU General Public License v3.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"LOCAL_USER\" (" + // "\"LOGIN\" TEXT PRIMARY KEY NOT NULL ," + // 0: login "\"NAME\" TEXT," + // 1: name "\"AVATAR_URL\" TEXT," + // 2: avatarUrl "\"FOLLOWERS\" INTEGER," + // 3: followers "\"FOLLOWING\" INTEGER);"); // 4: following }
Example 9
Source File: RequestListDao.java From Android-IM with Apache License 2.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"REQUEST_LIST\" (" + // "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id "\"MSG\" TEXT," + // 1: msg "\"USER_NAME\" TEXT," + // 2: userName "\"NAKE_NAME\" TEXT," + // 3: nakeName "\"TIME\" TEXT," + // 4: time "\"IMG\" TEXT);"); // 5: img }
Example 10
Source File: PictureDao.java From Pretty-Zhihu with Apache License 2.0 | 5 votes |
/** Creates the underlying database table. */ public static void createTable(Database db, boolean ifNotExists) { String constraint = ifNotExists? "IF NOT EXISTS ": ""; db.execSQL("CREATE TABLE " + constraint + "\"PICTURE\" (" + // "\"_id\" INTEGER PRIMARY KEY ," + // 0: id "\"QUESTION_ID\" INTEGER NOT NULL ," + // 1: questionId "\"URL\" TEXT NOT NULL );"); // 2: url }
Example 11
Source File: UserDao.java From android-orm-benchmark-updated with Apache License 2.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"USER\""; db.execSQL(sql); }
Example 12
Source File: NumberDao.java From ml-authentication with Apache License 2.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"NUMBER\""; db.execSQL(sql); }
Example 13
Source File: MigrationHelper.java From FriendBook with GNU General Public License v3.0 | 4 votes |
private static void restoreData(Database db, Class<? extends AbstractDao<?, ?>>... daoClasses) { for (int i = 0; i < daoClasses.length; i++) { DaoConfig daoConfig = new DaoConfig(db, daoClasses[i]); String tableName = daoConfig.tablename; String tempTableName = daoConfig.tablename.concat("_TEMP"); if (!isTableExists(db, true, tempTableName)) { continue; } try { // get all columns from tempTable, take careful to use the columns list List<String> columns = getColumns(db, tempTableName); ArrayList<String> properties = new ArrayList<>(columns.size()); for (int j = 0; j < daoConfig.properties.length; j++) { String columnName = daoConfig.properties[j].columnName; if (columns.contains(columnName)) { properties.add(columnName); } } if (properties.size() > 0) { final String columnSQL = TextUtils.join(",", properties); StringBuilder insertTableStringBuilder = new StringBuilder(); insertTableStringBuilder.append("INSERT INTO ").append(tableName).append(" ("); insertTableStringBuilder.append(columnSQL); insertTableStringBuilder.append(") SELECT "); insertTableStringBuilder.append(columnSQL); insertTableStringBuilder.append(" FROM ").append(tempTableName).append(";"); db.execSQL(insertTableStringBuilder.toString()); printLog("【Restore data】 to " + tableName); } StringBuilder dropTableStringBuilder = new StringBuilder(); dropTableStringBuilder.append("DROP TABLE ").append(tempTableName); db.execSQL(dropTableStringBuilder.toString()); printLog("【Drop temp table】" + tempTableName); } catch (SQLException e) { Log.e(TAG, "【Failed to restore data from temp table 】" + tempTableName, e); } } }
Example 14
Source File: SearchHistoryDataDao.java From MaoWanAndoidClient with Apache License 2.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SEARCH_HISTORY_DATA\""; db.execSQL(sql); }
Example 15
Source File: LetterDao.java From ml-authentication with Apache License 2.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LETTER\""; db.execSQL(sql); }
Example 16
Source File: BookMarkUserDao.java From OpenHub with GNU General Public License v3.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"BOOK_MARK_USER\""; db.execSQL(sql); }
Example 17
Source File: TraceRepoDao.java From OpenHub with GNU General Public License v3.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TRACE_REPO\""; db.execSQL(sql); }
Example 18
Source File: WordBeanDao.java From Dictionary with Apache License 2.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"WORD_BEAN\""; db.execSQL(sql); }
Example 19
Source File: DeviceDao.java From ml-authentication with Apache License 2.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"DEVICE\""; db.execSQL(sql); }
Example 20
Source File: BookInfoBeanDao.java From HaoReader with GNU General Public License v3.0 | 4 votes |
/** Drops the underlying database table. */ public static void dropTable(Database db, boolean ifExists) { String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"BOOK_INFO_BEAN\""; db.execSQL(sql); }