本文整理汇总了Java中org.greenrobot.greendao.database.Database.execSQL方法的典型用法代码示例。如果您正苦于以下问题:Java Database.execSQL方法的具体用法?Java Database.execSQL怎么用?Java Database.execSQL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.greenrobot.greendao.database.Database
的用法示例。
在下文中一共展示了Database.execSQL方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"VIDEO_BEAN\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"DATA_TYPE\" TEXT," + // 1: dataType
"\"TITLE\" TEXT," + // 2: title
"\"TEXT\" TEXT," + // 3: text
"\"DESCRIPTION\" TEXT," + // 4: description
"\"IMAGE\" TEXT," + // 5: image
"\"ACTION_URL\" TEXT," + // 6: actionUrl
"\"SHADE\" INTEGER NOT NULL ," + // 7: shade
"\"PLAY_URL\" TEXT," + // 8: playUrl
"\"CATEGORY\" TEXT," + // 9: category
"\"DURATION\" INTEGER NOT NULL ," + // 10: duration
"\"ICON\" TEXT);"); // 11: icon
}
示例2: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"ABCDEF_ENTITY\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"A\" INTEGER," + // 1: a
"\"B\" INTEGER," + // 2: b
"\"C\" INTEGER," + // 3: c
"\"D\" INTEGER," + // 4: d
"\"E\" INTEGER," + // 5: e
"\"F\" INTEGER," + // 6: f
"\"G\" INTEGER," + // 7: g
"\"H\" INTEGER," + // 8: h
"\"J\" INTEGER," + // 9: j
"\"I\" INTEGER," + // 10: i
"\"K\" INTEGER);"); // 11: k
}
示例3: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"TO_MANY_TARGET2\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"FK_ID\" INTEGER);"); // 1: fkId
}
示例4: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** 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
}
示例5: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"GREEN_TEST\" (" + //
"\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
"\"NAME\" TEXT," + // 1: name
"\"PASSWORD\" TEXT," + // 2: password
"\"COMMENT\" TEXT);"); // 3: comment
}
示例6: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"ci\" (" + //
"\"value\" INTEGER PRIMARY KEY ," + // 0: id
"\"AUTHOR\" TEXT," + // 1: author
"\"RHYTHMIC\" TEXT," + // 2: rhythmic
"\"CONTENT\" TEXT," + // 3: content
"\"PYQUAN\" TEXT," + // 4: pyquan
"\"PYQUANY\" TEXT," + // 5: pyquany
"\"PYJIAN\" TEXT);"); // 6: pyjian
}
示例7: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** 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
"\"USER_NAME\" TEXT);"); // 1: userName
}
示例8: updateCollBook
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
private void updateCollBook(Database db) {
Class<? extends AbstractDao<?, ?>> collBookClass = CollBookBeanDao.class;
// 遍历查找本地文件,然后修改本地文件的数据
DaoConfig daoConfig = new DaoConfig(db, collBookClass);
String tableName = daoConfig.tablename;
Cursor cursor = db.rawQuery("select _ID,IS_LOCAL from " + tableName, null);
String id = null;
String cover = null;
String isLocal = null;
StringBuilder updateSb = new StringBuilder();
while (cursor.moveToNext()) {
cover = cursor.getString(0);
id = MD5Utils.strToMd5By16(cover);
isLocal = cursor.getString(1);
//如果是本地文件
if (isLocal.equals("1")) {
// 数据更新
updateSb.append("UPDATE " + tableName + " SET ");
updateSb.append("_ID=").append(String.format(QUOTE, id)).append(DIVIDER);
updateSb.append("COVER=").append(String.format(QUOTE, cover)).append(" ");
updateSb.append("WHERE _ID=").append(String.format(QUOTE,cover)).append(";");
db.execSQL(updateSb.toString());
updateSb.delete(0, updateSb.length());
}
}
}
示例9: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"GIRL\" (" + //
"\"_ID\" TEXT," + // 0: _id
"\"CREATED_AT\" TEXT," + // 1: createdAt
"\"desc\" TEXT," + // 2: desc
"\"publishedAt\" INTEGER," + // 3: publishedAt
"\"SOURCE\" TEXT," + // 4: source
"\"TYPE\" TEXT," + // 5: type
"\"url\" TEXT," + // 6: url
"\"USED\" INTEGER NOT NULL ," + // 7: used
"\"WHO\" TEXT);"); // 8: who
}
示例10: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"CITY\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"cityName\" TEXT," + // 1: cityName
"\"cityCode\" INTEGER NOT NULL ," + // 2: cityCode
"\"provinceId\" INTEGER NOT NULL );"); // 3: provinceId
}
示例11: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"ORDER\" (" + //
"\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 0: id
"\"TYPE\" TEXT," + // 1: type
"\"TIME\" INTEGER," + // 2: time
"\"STATUS\" INTEGER NOT NULL ," + // 3: status
"\"DESC\" TEXT," + // 4: desc
"\"EARNING\" INTEGER NOT NULL ," + // 5: earning
"\"MEID\" TEXT," + // 6: meid
"\"SCENE\" TEXT," + // 7: scene
"\"PHONE\" TEXT);"); // 8: phone
}
示例12: createTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Creates the underlying database table. */
public static void createTable(Database db, boolean ifNotExists) {
String constraint = ifNotExists? "IF NOT EXISTS ": "";
db.execSQL("CREATE TABLE " + constraint + "\"PROVINCE\" (" + //
"\"_id\" INTEGER PRIMARY KEY ," + // 0: id
"\"PROVINCENAME\" TEXT," + // 1: provinceName
"\"PROVINCECODE\" INTEGER NOT NULL );"); // 2: provinceCode
}
示例13: dropTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"DATE_ENTITY\"";
db.execSQL(sql);
}
示例14: dropTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"GIRL\"";
db.execSQL(sql);
}
示例15: dropTable
import org.greenrobot.greendao.database.Database; //导入方法依赖的package包/类
/** Drops the underlying database table. */
public static void dropTable(Database db, boolean ifExists) {
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"LIVE_INFO\"";
db.execSQL(sql);
}