本文整理匯總了Java中android.database.sqlite.SQLiteStatement.simpleQueryForLong方法的典型用法代碼示例。如果您正苦於以下問題:Java SQLiteStatement.simpleQueryForLong方法的具體用法?Java SQLiteStatement.simpleQueryForLong怎麽用?Java SQLiteStatement.simpleQueryForLong使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.database.sqlite.SQLiteStatement
的用法示例。
在下文中一共展示了SQLiteStatement.simpleQueryForLong方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performGetLength
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private long performGetLength() {
SQLiteDatabase database = mDatabaseSupplier.getDatabase();
if (database == null) {
return 0;
}
String sql = "SELECT count(" + WXSQLiteOpenHelper.COLUMN_KEY + ") FROM " + WXSQLiteOpenHelper.TABLE_STORAGE;
SQLiteStatement statement = null;
try {
statement = database.compileStatement(sql);
return statement.simpleQueryForLong();
} catch (Exception e) {
WXLogUtils.e(WXSQLiteOpenHelper.TAG_STORAGE, "DefaultWXStorage occurred an exception when execute getLength:" + e.getMessage());
return 0;
} finally {
if(statement != null) {
statement.close();
}
}
}
示例2: getCalcFornecedor
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public String getCalcFornecedor() {
try {
Long lAux;
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement(
"SELECT id_compra FROM compra_itens WHERE" +
" id_produto = " + String.valueOf(getIdProduto()) +
" ORDER BY dt_compra_inv DESC LIMIT 1"
);
lAux = sStatement.simpleQueryForLong();
tblCompras record = new tblCompras();
record.getRecord(lAux.intValue());
return record.getCalcNomeFornecedor();
} catch (Exception e) {
return "";
}
}
示例3: countItemsInList
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private int countItemsInList(SQLiteDatabase db, int listId)
{
SQLiteStatement stmt = db.compileStatement("select count(*) from items where list_id=?");
stmt.bindLong(1, listId);
int rv = (int)stmt.simpleQueryForLong();
stmt.close();
return rv;
}
示例4: countInactiveItemsInList
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private int countInactiveItemsInList(SQLiteDatabase db, int listId)
{
SQLiteStatement stmt = db.compileStatement("select count(*) from items where list_id=? and active=1");
stmt.bindLong(1, listId);
int rv = (int)stmt.simpleQueryForLong();
stmt.close();
return rv;
}
示例5: getIDByIndex
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public long getIDByIndex(int index) {
SQLiteStatement downloadByIndex = getDownloadByIndexStatement();
downloadByIndex.clearBindings();
downloadByIndex.bindLong(1, index);
try {
return downloadByIndex.simpleQueryForLong();
} catch (SQLiteDoneException e) {
return -1;
}
}
示例6: getCalcQtdeItensVenda
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public int getCalcQtdeItensVenda() {
try {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT COUNT(id_venda_item) FROM venda_itens WHERE id_venda = " + String.valueOf(getIdVenda()));
return (int) sStatement.simpleQueryForLong();
} catch (Exception e) {
return 0;
}
}
示例7: getCalcQtdeItensCompra
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
public int getCalcQtdeItensCompra() {
try {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT COUNT(id_compra_item) FROM compra_itens WHERE id_compra = " + String.valueOf(getIdCompra()));
return (int) sStatement.simpleQueryForLong();
} catch (Exception e) {
return 0;
}
}
示例8: longForQuery
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
/**
* Utility method to run the pre-compiled query and return the value in the
* first column of the first row.
*/
public static long longForQuery(SQLiteStatement prog, String[] selectionArgs) {
prog.bindAllArgsAsStrings(selectionArgs);
return prog.simpleQueryForLong();
}
示例9: setIdTorneio
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setIdTorneio() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_torneio) FROM " + mTable);
this.idTorneio = (int) sStatement.simpleQueryForLong() + 1;
}
示例10: setIdMovimento
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setIdMovimento() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_movimento) FROM " + mTable);
this.idMovimento = (int) sStatement.simpleQueryForLong() + 1;
}
示例11: setIdRecebimento
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setIdRecebimento() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_recebimento) FROM " + mTable);
this.idRecebimento = (int) sStatement.simpleQueryForLong() + 1;
}
示例12: setIdItem
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setIdItem() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_compra_item) FROM " + mTable);
this.idCompraItem = (int) sStatement.simpleQueryForLong() + 1;
}
示例13: setIdRecebimento
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setIdRecebimento() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_venda_recebimento) FROM " + mTable);
this.idVendaRecebimento = (int) sStatement.simpleQueryForLong() + 1;
}
示例14: setIdGrupoProduto
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setIdGrupoProduto() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_grupo_produto) FROM " + mTable);
this.idGrupoProduto = (int) sStatement.simpleQueryForLong() + 1;
}
示例15: setidFornecedor
import android.database.sqlite.SQLiteStatement; //導入方法依賴的package包/類
private void setidFornecedor() {
SQLiteStatement sStatement = Funcoes.mDataBase.compileStatement("SELECT MAX(id_fornecedor) FROM " + mTable);
this.idFornecedor = (int) sStatement.simpleQueryForLong() + 1;
}