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


Java SQLiteStatement.simpleQueryForLong方法代碼示例

本文整理匯總了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();
        }
    }
}
 
開發者ID:amap-demo,項目名稱:weex-3d-map,代碼行數:21,代碼來源:DefaultWXStorage.java

示例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 "";
    }
}
 
開發者ID:marcelohanel,項目名稱:Cash,代碼行數:20,代碼來源:tblProdutos.java

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

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

示例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;
    }
}
 
開發者ID:snoozinsquatch,項目名稱:unity-obb-downloader,代碼行數:11,代碼來源:DownloadsDB.java

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

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

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

示例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;
}
 
開發者ID:marcelohanel,項目名稱:PokerBankroll,代碼行數:5,代碼來源:tblTorneios.java

示例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;
}
 
開發者ID:marcelohanel,項目名稱:PokerBankroll,代碼行數:5,代碼來源:tblMovimentos.java

示例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;
}
 
開發者ID:marcelohanel,項目名稱:Cash,代碼行數:5,代碼來源:tblRecebimentos.java

示例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;
}
 
開發者ID:marcelohanel,項目名稱:Cash,代碼行數:5,代碼來源:tblCompraItens.java

示例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;
}
 
開發者ID:marcelohanel,項目名稱:Cash,代碼行數:5,代碼來源:tblVendaRecebimentos.java

示例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;
}
 
開發者ID:marcelohanel,項目名稱:Cash,代碼行數:5,代碼來源:tblGruposProduto.java

示例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;
}
 
開發者ID:marcelohanel,項目名稱:Cash,代碼行數:5,代碼來源:tblFornecedores.java


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