本文整理汇总了Java中com.almworks.sqlite4java.SQLiteStatement.step方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteStatement.step方法的具体用法?Java SQLiteStatement.step怎么用?Java SQLiteStatement.step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.almworks.sqlite4java.SQLiteStatement
的用法示例。
在下文中一共展示了SQLiteStatement.step方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processTuple
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
@Override
public void processTuple(int tableNum, HashMap<String, Object> tuple)
{
InputSchema inputSchema = inputSchemas.get(tableNum);
SQLiteStatement insertStatement = insertStatements.get(tableNum);
try {
for (Map.Entry<String, Object> entry : tuple.entrySet()) {
ColumnInfo t = inputSchema.columnInfoMap.get(entry.getKey());
if (t != null && t.bindIndex != 0) {
insertStatement.bind(t.bindIndex, entry.getValue().toString());
}
}
insertStatement.step();
insertStatement.reset();
} catch (SQLiteException ex) {
throw new RuntimeException(ex);
}
}
示例2: CardsManager
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
private CardsManager() throws SQLiteException {
SQLiteConnection db = new SQLiteConnection(new File(YGOCoreMain.getConfigurator().getDataBasePath()));
db.open(true);
SQLiteStatement st = db.prepare("SELECT id, ot, alias, type, level, race, attribute, atk, def FROM datas");
try {
while(st.step()) {
int id = st.columnInt(0);
Card c = new Card(id, st.columnInt(1));
c.alias = st.columnInt(2);
c.setcode = st.columnInt(3);
int levelinfo = st.columnInt(4);
c.level = levelinfo & 0xff;
c.lscale = (levelinfo >> 24) & 0xff;
c.rscale = (levelinfo >> 16) & 0xff;
c.race = st.columnInt(6);
c.attr = st.columnInt(7);
c.attack = st.columnInt(8);
c.defense = st.columnInt(9);
mCards.put(id, c);
}
} finally {
st.dispose();
}
db.dispose();
}
示例3: longForQuery
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Utility method to run the query on the db and return the value in the
* first column of the first row.
*/
public static Long longForQuery(SQLiteConnection conn, String query, Object[] bindArgs)
throws SQLiteException {
SQLiteStatement stmt = null;
try {
stmt = conn.prepare(query);
if (bindArgs != null && bindArgs.length > 0) {
stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs);
}
if (stmt.step()) {
return stmt.columnLong(0);
} else {
throw new IllegalStateException("query failed to return any result: " + query);
}
} finally {
SQLiteWrapperUtils.disposeQuietly(stmt);
}
}
示例4: buildSQLiteCursor
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public static SQLiteCursor buildSQLiteCursor(SQLiteConnection conn, String sql, Object[] bindArgs)
throws SQLiteException {
SQLiteStatement stmt = null;
try {
stmt = bindArguments(conn.prepare(sql), bindArgs);
List<String> columnNames = null;
List<Tuple> resultSet = new ArrayList<Tuple>();
while (!stmt.hasStepped() || stmt.hasRow()) {
if (!stmt.step()) {
break;
}
if (columnNames == null) {
columnNames = getColumnNames(stmt);
}
Tuple t = getDataRow(stmt);
logger.finest("Tuple: "+ t.toString());
resultSet.add(t);
}
return new SQLiteCursor(columnNames, resultSet);
} finally {
SQLiteWrapperUtils.disposeQuietly(stmt);
}
}
示例5: deleteIaAddr
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public void deleteIaAddr(final IaAddress iaAddr)
{
SQLiteConnection connection = null;
SQLiteStatement statement = null;
try {
connection = getSQLiteConnection();
statement = connection.prepare("delete from dhcplease" +
" where ipaddress = ?");
statement.bind(1, iaAddr.getIpAddress().getAddress());
while(statement.step()) {
log.debug("deleteIaAddr: step=true");
}
}
catch (SQLiteException ex) {
log.error("deleteIaAddr failed", ex);
throw new RuntimeException(ex);
}
finally {
closeStatement(statement);
closeConnection(connection);
}
}
示例6: loadStockSymbolsFromDB
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public Map<String, String> loadStockSymbolsFromDB() {
Map<String, String> symbolsMap = new HashMap<String, String>();
// Read symbols from database
try {
String command = "SELECT symbol,name FROM Symbols WHERE source=" + this.stockExchangeNumber + ";";
String symbolStr;
String nameStr;
logger.logDB(command);
SQLiteStatement st = db.prepare(command);
while (st.step()) {
symbolStr = st.columnString(0);
nameStr = st.columnString(1);
logger.log(symbolStr);
symbolsMap.put(symbolStr, nameStr);
}
} catch (Exception e) {
logger.logException(e);
}
return symbolsMap;
}
示例7: deleteDhcpLease
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Delete dhcp lease.
*
* @param lease the lease
*/
protected void deleteDhcpLease(final DhcpLease lease)
{
SQLiteConnection connection = null;
SQLiteStatement statement = null;
try {
connection = getSQLiteConnection();
statement = connection.prepare("delete from dhcplease" +
" where ipaddress=?");
statement.bind(1, lease.getIpAddress().getAddress());
while (statement.step()) {
log.debug("deleteDhcpLease: step=true");
}
}
catch (SQLiteException ex) {
log.error("deleteDhcpLease failed", ex);
throw new RuntimeException(ex);
}
finally {
closeStatement(statement);
closeConnection(connection);
}
}
示例8: queryOneString
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public String queryOneString(String sql, List<Object> parameters){
SQLiteStatement st = null;
try {
st = db.prepare(sql);
bindParameters(st, parameters);
if (st.step()) {
return st.columnString(0);
}
return null;
} catch (SQLiteException e) {
e.printStackTrace();
return null;
} finally {
if (st != null) {
st.dispose();
}
}
}
示例9: exists
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public boolean exists(String sql, List<Object> parameters) {
SQLiteStatement st = null;
try {
st = db.prepare(sql);
bindParameters(st, parameters);
if (st.step()) {
return true;
}
return false;
} catch (SQLiteException e) {
e.printStackTrace();
return false;
} finally {
if (st != null) {
st.dispose();
}
}
}
示例10: queryOneString
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public String queryOneString(SQLiteConnection db,String sql, List<Object> parameters){
SQLiteStatement st = null;
try {
st = db.prepare(sql);
bindParameters(st, parameters);
if (st.step()) {
return st.columnString(0);
}
return null;
} catch (SQLiteException e) {
e.printStackTrace();
return null;
} finally {
if (st != null) {
st.dispose();
}
}
}
示例11: exists
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public boolean exists(SQLiteConnection db,String sql, List<Object> parameters) {
SQLiteStatement st = null;
try {
st = db.prepare(sql);
bindParameters(st, parameters);
if (st.step()) {
return true;
}
return false;
} catch (SQLiteException e) {
e.printStackTrace();
return false;
} finally {
if (st != null) {
st.dispose();
}
}
}
示例12: endWindow
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
@Override
public void endWindow()
{
try {
commitStatement.step();
commitStatement.reset();
if (bindings != null) {
for (int i = 0; i < bindings.size(); i++) {
execStatement.bind(i, bindings.get(i).toString());
}
}
int columnCount = execStatement.columnCount();
while (execStatement.step()) {
HashMap<String, Object> resultRow = new HashMap<String, Object>();
for (int i = 0; i < columnCount; i++) {
resultRow.put(execStatement.getColumnName(i), execStatement.columnValue(i));
}
this.result.emit(resultRow);
}
execStatement.reset();
for (SQLiteStatement st : deleteStatements) {
st.step();
st.reset();
}
} catch (SQLiteException ex) {
throw new RuntimeException(ex);
}
bindings = null;
}
示例13: fillWith
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public void fillWith(SQLiteStatement stmt) throws SQLiteException {
//Android caches results in the WindowedCursor to allow moveToPrevious() to function.
//Robolectric will have to cache the results too. In the rows list.
while (stmt.step()) {
rows.add(fillRowValues(stmt));
}
}
示例14: execSQL
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
@Override
public void execSQL(String sql, Object[] bindArgs) throws SQLException {
Misc.checkNotNullOrEmpty(sql.trim(), "Input SQL");
SQLiteStatement stmt = null;
try {
stmt = this.getConnection().prepare(sql);
stmt = SQLiteWrapperUtils.bindArguments(stmt, bindArgs);
while (stmt.step()) {
}
} catch (SQLiteException e) {
throw new SQLException(e);
} finally {
SQLiteWrapperUtils.disposeQuietly(stmt);
}
}
示例15: intForQuery
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Utility method to run the query on the db and return the value in the
* first column of the first row.
*/
public static int intForQuery(SQLiteConnection conn, String query, Object[] bindArgs) throws SQLiteException {
SQLiteStatement stmt = null;
try {
stmt = bindArguments(conn.prepare(query), bindArgs);
if (stmt.step()) {
return stmt.columnInt(0);
} else {
throw new IllegalStateException("query failed to return any result: " + query);
}
} finally {
SQLiteWrapperUtils.disposeQuietly(stmt);
}
}