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


Java ICursor類代碼示例

本文整理匯總了Java中net.bither.bitherj.db.imp.base.ICursor的典型用法代碼示例。如果您正苦於以下問題:Java ICursor類的具體用法?Java ICursor怎麽用?Java ICursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ICursor類屬於net.bither.bitherj.db.imp.base包,在下文中一共展示了ICursor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execQueryOneRecord

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public void execQueryOneRecord(String sql, Object[] params,
		Function<ICursor, Void> func) {
       try {
           PreparedStatement stmt = conn.prepareStatement(sql);
           setStatementParams(stmt, params);

           ResultSet c = stmt.executeQuery();
           SqliteCursor cursor = new SqliteCursor(c);
           if (cursor.moveToNext()) {
           	func.apply(cursor);
           }
           cursor.close();
           stmt.close();
       } catch (SQLException e) {
		throw new RuntimeException(e);
       }
}
 
開發者ID:michaelchz,項目名稱:bither-shell,代碼行數:19,代碼來源:SqliteDb.java

示例2: execQueryLoop

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public void execQueryLoop(String sql, Object[] params,
		Function<ICursor, Void> func) {
       try {
           PreparedStatement stmt = conn.prepareStatement(sql);
           setStatementParams(stmt, params);

           ResultSet c = stmt.executeQuery();
           SqliteCursor cursor = new SqliteCursor(c);
           while (cursor.moveToNext()) {
           	func.apply(cursor);
           }
           cursor.close();
           stmt.close();
       } catch (SQLException e) {
		throw new RuntimeException(e);
       }
}
 
開發者ID:michaelchz,項目名稱:bither-shell,代碼行數:19,代碼來源:SqliteDb.java

示例3: hasPasswordSeed

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
protected boolean hasPasswordSeed(IDb db) {
	String sql = "select count(0) cnt from password_seed where password_seed is not null";
	final int[] count = {0};
	this.execQueryOneRecord(db, sql, null, new Function<ICursor, Void>() {
		@Nullable
		@Override
		public Void apply(@Nullable ICursor c) {
			int idColumn = c.getColumnIndex("cnt");
			if (idColumn != -1) {
				count[0] = c.getInt(idColumn);
			}
			return null;
		}
	});
	return count[0] > 0;
}
 
開發者ID:michaelchz,項目名稱:bither-shell,代碼行數:18,代碼來源:HDAccountProviderImpl.java

示例4: hasPasswordSeed

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
public boolean hasPasswordSeed(IDb db) {
    String sql = "select count(0) cnt from password_seed where password_seed is not null";
    final int[] count = {0};
    this.execQueryOneRecord(db, sql, null, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex("cnt");
            if (idColumn != -1) {
                count[0] = c.getInt(idColumn);
            }
            return null;
        }
    });
    return count[0] > 0;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:17,代碼來源:AbstractAddressProvider.java

示例5: getHDSeeds

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public List<Integer> getHDSeeds() {
    final List<Integer> hdSeedIds = new ArrayList<Integer>();
    String sql = "select hd_seed_id from hd_seeds";
    this.execQueryLoop(sql, null, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex(AbstractDb.HDSeedsColumns.HD_SEED_ID);
            if (idColumn != -1) {
                hdSeedIds.add(c.getInt(idColumn));
            }
            return null;
        }
    });
    return hdSeedIds;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:AbstractAddressProvider.java

示例6: isHDSeedFromXRandom

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public boolean isHDSeedFromXRandom(int hdSeedId) {
    String sql = "select is_xrandom from hd_seeds where hd_seed_id=?";
    final boolean[] isXRandom = {false};
    this.execQueryOneRecord(sql, new String[]{Integer.toString(hdSeedId)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex("is_xrandom");
            if (idColumn != -1) {
                isXRandom[0] = c.getInt(idColumn) == 1;
            }
            return null;
        }
    });
    return isXRandom[0];
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:AbstractAddressProvider.java

示例7: getHDMFristAddress

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public String getHDMFristAddress(int hdSeedId) {
    String sql = "select hdm_address from hd_seeds where hd_seed_id=?";
    final String[] address = {null};
    this.execQueryOneRecord(sql, new String[]{Integer.toString(hdSeedId)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex(AbstractDb.HDSeedsColumns.HDM_ADDRESS);
            if (idColumn != -1) {
                address[0] = c.getString(idColumn);
            }
            return null;
        }
    });
    return address[0];
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:AbstractAddressProvider.java

示例8: getHDMAddressInUse

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public List<HDMAddress> getHDMAddressInUse(HDMKeychain keychain) {
    String sql = "select hd_seed_index,pub_key_hot,pub_key_cold,pub_key_remote,address,is_synced " +
            " from hdm_addresses " +
            " where hd_seed_id=? and address is not null order by hd_seed_index";
    final List<HDMAddress> addresses = new ArrayList<HDMAddress>();
    final HDMKeychain hdmKeychain = keychain;
    this.execQueryLoop(sql, new String[]{Integer.toString(keychain.getHdSeedId())}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            HDMAddress hdmAddress = applyHDMAddress(c, hdmKeychain);
            if (hdmAddress != null) {
                addresses.add(hdmAddress);
            }
            return null;
        }
    });
    return addresses;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:21,代碼來源:AbstractAddressProvider.java

示例9: getUncompletedHDMAddressPubs

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public List<HDMAddress.Pubs> getUncompletedHDMAddressPubs(int hdSeedId, int count) {
    String sql = "select * from hdm_addresses where hd_seed_id=? and pub_key_remote is null limit ? ";
    final List<HDMAddress.Pubs> pubsList = new ArrayList<HDMAddress.Pubs>();

    this.execQueryLoop(sql, new String[]{Integer.toString(hdSeedId), Integer.toString(count)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            HDMAddress.Pubs pubs = applyPubs(c);
            if (pubs != null) {
                pubsList.add(pubs);
            }
            return null;
        }
    });
    return pubsList;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:19,代碼來源:AbstractAddressProvider.java

示例10: maxHDMAddressPubIndex

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public int maxHDMAddressPubIndex(int hdSeedId) {
    String sql = "select ifnull(max(hd_seed_index),-1)  hd_seed_index from hdm_addresses where hd_seed_id=?  ";
    final int[] maxIndex = {-1};
    this.execQueryOneRecord(sql, new String[]{Integer.toString(hdSeedId)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex(AbstractDb.HDMAddressesColumns.HD_SEED_INDEX);
            if (idColumn != -1) {
                maxIndex[0] = c.getInt(idColumn);
            }
            return null;
        }
    });
    return maxIndex[0];
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:AbstractAddressProvider.java

示例11: uncompletedHDMAddressCount

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public int uncompletedHDMAddressCount(int hdSeedId) {
    String sql = "select count(0) cnt from hdm_addresses where hd_seed_id=?  and pub_key_remote is null ";
    final int[] count = {0};
    this.execQueryOneRecord(sql, new String[]{Integer.toString(hdSeedId)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex("cnt");
            if (idColumn != -1) {
                count[0] = c.getInt(idColumn);
            }
            return null;
        }
    });
    return count[0];
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:AbstractAddressProvider.java

示例12: setHDMPubsRemote

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
public void setHDMPubsRemote(int hdSeedId, int index, byte[] remote) {
    String sql = "select count(0) from hdm_addresses " +
            "where hd_seed_id=? and hd_seed_index=? and pub_key_remote is null";
    final boolean[] isExist = {true};
    this.execQueryOneRecord(sql, new String[]{Integer.toString(hdSeedId), Integer.toString(index)}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            isExist[0] = c.getInt(0) > 0;
            return null;
        }
    });
    if (isExist[0]) {
        sql = "update hdm_addresses set pub_key_remote=? where hd_seed_id=? and hd_seed_index=?";
        this.execUpdate(sql, new String[]{Base58.encode(remote), Integer.toString(hdSeedId), Integer.toString(index)});
    }
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:18,代碼來源:AbstractAddressProvider.java

示例13: getAddresses

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public List<Address> getAddresses() {
    String sql = "select address,encrypt_private_key,pub_key,is_xrandom,is_trash,is_synced,sort_time " +
            "from addresses  order by sort_time desc";
    final List<Address> addressList = new ArrayList<Address>();
    this.execQueryLoop(sql, null, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            Address address = null;
            try {
                address = applyAddressCursor(c);
            } catch (AddressFormatException e) {
                e.printStackTrace();
            }
            if (address != null) {
                addressList.add(address);
            }
            return null;
        }
    });
    return addressList;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:24,代碼來源:AbstractAddressProvider.java

示例14: getEncryptPrivateKey

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
public String getEncryptPrivateKey(String address) {
    String sql = "select encrypt_private_key from addresses where address=?";
    final String[] encryptPrivateKey = {null};
    this.execQueryOneRecord(sql, new String[]{address}, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex(AbstractDb.AddressesColumns.ENCRYPT_PRIVATE_KEY);
            if (idColumn != -1) {
                encryptPrivateKey[0] = c.getString(idColumn);
            }
            return null;
        }
    });
    return encryptPrivateKey[0];
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:17,代碼來源:AbstractAddressProvider.java

示例15: getAliases

import net.bither.bitherj.db.imp.base.ICursor; //導入依賴的package包/類
@Override
public Map<String, String> getAliases() {
    String sql = "select * from aliases";
    final Map<String, String> aliasList = new HashMap<String, String>();

    this.execQueryLoop(sql, null, new Function<ICursor, Void>() {
        @Nullable
        @Override
        public Void apply(@Nullable ICursor c) {
            int idColumn = c.getColumnIndex(AbstractDb.AliasColumns.ADDRESS);
            String address = null;
            String alias = null;
            if (idColumn > -1) {
                address = c.getString(idColumn);
            }
            idColumn = c.getColumnIndex(AbstractDb.AliasColumns.ALIAS);
            if (idColumn > -1) {
                alias = c.getString(idColumn);
            }
            aliasList.put(address, alias);
            return null;
        }
    });
    return aliasList;
}
 
開發者ID:bither,項目名稱:bitherj,代碼行數:26,代碼來源:AbstractAddressProvider.java


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