当前位置: 首页>>代码示例>>Java>>正文


Java SQLiteStatement.step方法代码示例

本文整理汇总了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);
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:21,代码来源:SqliteStreamOperator.java

示例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();
	
}
 
开发者ID:garymabin,项目名称:JYGOServer,代码行数:27,代码来源:CardsManager.java

示例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);
    }
}
 
开发者ID:cloudant,项目名称:sync-android,代码行数:22,代码来源:SQLiteWrapperUtils.java

示例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);
    }
}
 
开发者ID:cloudant,项目名称:sync-android,代码行数:25,代码来源:SQLiteWrapperUtils.java

示例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);
	}
}
 
开发者ID:jagornet,项目名称:dhcp,代码行数:24,代码来源:SqliteLeaseManager.java

示例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;
}
 
开发者ID:rrodrigoa,项目名称:SmartStocks,代码行数:22,代码来源:Controller.java

示例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);
	}
}
 
开发者ID:jagornet,项目名称:dhcp,代码行数:29,代码来源:SqliteLeaseManager.java

示例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();
		}
	}
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:19,代码来源:SqliteDB.java

示例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();
		}
	}
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:19,代码来源:SqliteDB.java

示例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();
		}
	}
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:19,代码来源:SqliteSafeDBWithPool.java

示例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();
		}
	}
}
 
开发者ID:houdejun214,项目名称:lakeside-java,代码行数:19,代码来源:SqliteSafeDBWithPool.java

示例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;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:31,代码来源:SqliteStreamOperator.java

示例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));
  }
}
 
开发者ID:qx,项目名称:FullRobolectricTestSample,代码行数:8,代码来源:ShadowCursorWindow.java

示例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);
    }
}
 
开发者ID:cloudant,项目名称:sync-android,代码行数:16,代码来源:SQLiteWrapper.java

示例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);
    }
}
 
开发者ID:cloudant,项目名称:sync-android,代码行数:18,代码来源:SQLiteWrapperUtils.java


注:本文中的com.almworks.sqlite4java.SQLiteStatement.step方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。