本文整理汇总了Java中com.activeandroid.util.SQLiteUtils.execSql方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteUtils.execSql方法的具体用法?Java SQLiteUtils.execSql怎么用?Java SQLiteUtils.execSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.activeandroid.util.SQLiteUtils
的用法示例。
在下文中一共展示了SQLiteUtils.execSql方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
private static void fixUpTable() {
if (patched) return;
String[] patchup = {
"CREATE TABLE PebbleMovement (_id INTEGER PRIMARY KEY AUTOINCREMENT);",
"ALTER TABLE PebbleMovement ADD COLUMN timestamp INTEGER;",
"ALTER TABLE PebbleMovement ADD COLUMN metric INTEGER;",
"CREATE UNIQUE INDEX index_PebbleMovement_timestamp on PebbleMovement(timestamp);"};
for (String patch : patchup) {
try {
SQLiteUtils.execSql(patch);
// UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch);
} catch (Exception e) {
// UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString());
}
}
patched = true;
}
示例2: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
private static void fixUpTable() {
if (patched) return;
String[] patchup = {
"CREATE TABLE HeartRate (_id INTEGER PRIMARY KEY AUTOINCREMENT);",
"ALTER TABLE HeartRate ADD COLUMN timestamp INTEGER;",
"ALTER TABLE HeartRate ADD COLUMN bpm INTEGER;",
"ALTER TABLE HeartRate ADD COLUMN accuracy INTEGER;",
"CREATE UNIQUE INDEX index_HeartRate_timestamp on HeartRate(timestamp);"};
for (String patch : patchup) {
try {
SQLiteUtils.execSql(patch);
// UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch);
} catch (Exception e) {
// UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString());
}
}
patched = true;
}
示例3: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
private static void fixUpTable() {
if (patched) return;
final String[] patchup = {
"CREATE TABLE BloodTest (_id INTEGER PRIMARY KEY AUTOINCREMENT);",
"ALTER TABLE BloodTest ADD COLUMN timestamp INTEGER;",
"ALTER TABLE BloodTest ADD COLUMN created_timestamp INTEGER;",
"ALTER TABLE BloodTest ADD COLUMN state INTEGER;",
"ALTER TABLE BloodTest ADD COLUMN mgdl REAL;",
"ALTER TABLE BloodTest ADD COLUMN source TEXT;",
"ALTER TABLE BloodTest ADD COLUMN uuid TEXT;",
"CREATE UNIQUE INDEX index_Bloodtest_uuid on BloodTest(uuid);",
"CREATE UNIQUE INDEX index_Bloodtest_timestamp on BloodTest(timestamp);",
"CREATE INDEX index_Bloodtest_created_timestamp on BloodTest(created_timestamp);",
"CREATE INDEX index_Bloodtest_state on BloodTest(state);"};
for (String patch : patchup) {
try {
SQLiteUtils.execSql(patch);
// UserError.Log.e(TAG, "Processed patch should not have succeeded!!: " + patch);
} catch (Exception e) {
// UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString());
}
}
patched = true;
}
示例4: execute
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public <T extends Model> List<T> execute() {
if (mQueryBase instanceof Select) {
return SQLiteUtils.rawQuery(mType, toSql(), getArguments());
} else {
SQLiteUtils.execSql(toSql(), getArguments());
Cache.getContext().getContentResolver().notifyChange(ContentProvider.createUri(mType, null), null);
return null;
}
}
示例5: deleteALL
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public static void deleteALL() {
try {
SQLiteUtils.execSql("delete from BgSendQueue");
SQLiteUtils.execSql("delete from BgReadings");
Log.d(TAG, "Deleting all BGReadings");
} catch (Exception e) {
Log.e(TAG, "Got exception running deleteALL " + e.toString());
}
}
示例6: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public static void fixUpTable() {
if (patched) return;
for (String patch : schema) {
try {
SQLiteUtils.execSql(patch);
} catch (Exception e) {
if (d)
UserError.Log.d(TAG, "Patch: " + patch + " generated exception as it should: " + e.toString());
}
}
patched = true;
}
示例7: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
protected synchronized static void fixUpTable(String[] schema) {
if (patched) return;
for (String patch : schema) {
try {
SQLiteUtils.execSql(patch);
} catch (Exception e) {
//
}
}
patched = true;
}
示例8: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
protected synchronized static void fixUpTable(String[] schema) {
if (patched) return;
for (String patch : schema) {
try {
SQLiteUtils.execSql(patch);
} catch (Exception e) {
//
}
}
patched = true;
}
示例9: cleanup
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public static void cleanup(long timestamp) {
try {
SQLiteUtils.execSql("delete from BgSendQueue");
List<BgReading> data = new Select()
.from(BgReading.class)
.where("timestamp < ?", timestamp)
.orderBy("timestamp desc")
.execute();
if (data != null) Log.d(TAG, "cleanup BgReading size=" + data.size());
new Cleanup().execute(data);
} catch (Exception e) {
Log.e(TAG, "Got exception running cleanup " + e.toString());
}
}
示例10: updateDB
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public static void updateDB(){
String[] updates = new String[]{"ALTER TABLE BgReadings ADD COLUMN dg_mgdl REAL;", "ALTER TABLE BgReadings ADD COLUMN dg_slope REAL;", "ALTER TABLE BgReadings ADD COLUMN dg_delta_name TEXT;"};
for (String patch:updates) {
try {
SQLiteUtils.execSql(patch);
} catch (Exception e){
}
}
}
示例11: fixUpTable
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
protected synchronized static boolean fixUpTable(String[] schema, boolean patched) {
if (patched) return true;
for (String patch : schema) {
try {
SQLiteUtils.execSql(patch);
} catch (Exception e) {
//
}
}
return true;
}
示例12: execute
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public <T extends Model> List<T> execute() {
if (mQueryBase instanceof Select) {
return SQLiteUtils.rawQuery(mType, toSql(), getArguments());
}
else {
SQLiteUtils.execSql(toSql(), getArguments());
Cache.getContext().getContentResolver().notifyChange(ContentProvider
.createUri(mType, null), null);
return null;
}
}
示例13: execute
import com.activeandroid.util.SQLiteUtils; //导入方法依赖的package包/类
public void execute() {
SQLiteUtils.execSql(toSql(), getArguments());
}