當前位置: 首頁>>代碼示例>>Java>>正文


Java Database.execSQL方法代碼示例

本文整理匯總了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
}
 
開發者ID:popo1379,項目名稱:popomusic,代碼行數:18,代碼來源:VideoBeanDao.java

示例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
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:18,代碼來源:AbcdefEntityDao.java

示例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
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:8,代碼來源:ToManyTarget2Dao.java

示例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
}
 
開發者ID:InnoFang,項目名稱:Android-Code-Demos,代碼行數:9,代碼來源:UserDao.java

示例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
}
 
開發者ID:yzzslow0,項目名稱:Ec2m,代碼行數:10,代碼來源:GreenTestDao.java

示例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
}
 
開發者ID:yippeesoft,項目名稱:NotifyTools,代碼行數:13,代碼來源:SongCiDao.java

示例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
}
 
開發者ID:devzwy,項目名稱:NeiHanDuanZiTV,代碼行數:8,代碼來源:UserDao.java

示例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());
        }
    }
}
 
開發者ID:newbiechen1024,項目名稱:NovelReader,代碼行數:32,代碼來源:Update2Helper.java

示例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
}
 
開發者ID:weixianshishen,項目名稱:BeautifulGirls,代碼行數:15,代碼來源:GirlDao.java

示例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
}
 
開發者ID:weixianshishen,項目名稱:LookWeather,代碼行數:10,代碼來源:CityDao.java

示例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
}
 
開發者ID:ymqq,項目名稱:CommonFramework,代碼行數:15,代碼來源:OrderDao.java

示例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
}
 
開發者ID:weixianshishen,項目名稱:LookWeather,代碼行數:9,代碼來源:ProvinceDao.java

示例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);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:6,代碼來源:DateEntityDao.java

示例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);
}
 
開發者ID:weixianshishen,項目名稱:BeautifulGirls,代碼行數:6,代碼來源:GirlDao.java

示例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);
}
 
開發者ID:jenly1314,項目名稱:KingTV,代碼行數:6,代碼來源:LiveInfoDao.java


注:本文中的org.greenrobot.greendao.database.Database.execSQL方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。