您可以添加功能SugarRecord.java永遠
public static String Scaler(String Query) {
String Result = "";
SugarDb db = getSugarContext().getSugarDb();
SQLiteDatabase sqLiteDatabase = db.getDB();
SQLiteStatement sqLiteStatament = sqLiteDatabase
.compileStatement(Query);
try {
Result = sqLiteStatament.simpleQueryForString();
} catch (Exception e) {
e.printStackTrace();
} finally {
sqLiteStatament.close();
}
return Result;
}
或
public static String Scaler(String Query) {
String Result = "";
SQLiteDatabase sqLiteDatabase = SugarContext.getSugarContext().getSugarDb().getDB();
SQLiteStatement sqLiteStatament = sqLiteDatabase
.compileStatement(Query);
try {
Result = sqLiteStatament.simpleQueryForString();
} catch (Exception e) {
e.printStackTrace();
} finally {
sqLiteStatament.close();
}
return Result;
}
的縮放(「從記下的名字='阿里SELECT名字'limit 1「);
是的,但只是這個查詢執行正確...這個查詢返回所有數據從數據庫,每一行數據和每列數據...... 但我只想要字段數據......你能幫忙嗎? –
我覺得這個功能還沒有準備好,我發現這個問題https://github.com/satyan/sugar/issues/270 – mcatta
非常感謝你@mcatta,我也是這樣... –