本文整理汇总了Java中com.almworks.sqlite4java.SQLiteStatement.dispose方法的典型用法代码示例。如果您正苦于以下问题:Java SQLiteStatement.dispose方法的具体用法?Java SQLiteStatement.dispose怎么用?Java SQLiteStatement.dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.almworks.sqlite4java.SQLiteStatement
的用法示例。
在下文中一共展示了SQLiteStatement.dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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();
}
示例2: 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();
}
}
}
示例3: 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();
}
}
}
示例4: execute
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public int execute(String sql, List<Object> parameters) {
SQLiteStatement st = null;
try {
st = db.prepare(sql);
bindParameters(st, parameters);
st.stepThrough();
return SUCESS;
} catch (SQLiteException e) {
e.printStackTrace();
return FAILD;
} finally {
if (st != null) {
st.dispose();
}
}
}
示例5: 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();
}
}
}
示例6: 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();
}
}
}
示例7: execute
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
public int execute(SQLiteConnection db,String sql, List<Object> parameters) {
SQLiteStatement st = null;
try {
st = db.prepare(sql);
bindParameters(st, parameters);
st.stepThrough();
return SUCESS;
} catch (SQLiteException e) {
e.printStackTrace();
return FAILD;
} finally {
if (st != null) {
st.dispose();
}
}
}
示例8: disposeQuietly
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
static void disposeQuietly(SQLiteStatement stmt) {
if (stmt != null && !stmt.isDisposed()) {
try {
stmt.dispose();
} catch (Throwable e) {}
}
}
示例9: getLcMsnRunSliceIterator
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Gets a DIA data RunSlice iterator
*
* @param minParentMz
* @param maxParentMz
* @return the RunSlice iterator
* @throws SQLiteException
* @throws StreamCorruptedException
*/
public Iterator<RunSlice> getLcMsnRunSliceIterator(double minParentMz, double maxParentMz) throws SQLiteException, StreamCorruptedException {
// First pass to load the index
final SQLiteStatement fakeStmt = this.connection.prepare("SELECT data FROM bounding_box", false);
while (fakeStmt.step()) {
}
fakeStmt.dispose();
return new LcMsnRunSliceIterator(this, connection, minParentMz, maxParentMz);
}
示例10: getMzRange
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Gets the mz range.
*
* @param msLevel
* the ms level
* @return runSlice min mz and runSlice max mz
* @throws SQLiteException
* the sQ lite exception
*/
public static int[] getMzRange(int msLevel, SQLiteConnection connection) throws SQLiteException {
final SQLiteStatement stmt = connection.prepare("SELECT min(begin_mz), max(end_mz) FROM run_slice WHERE ms_level=?");
stmt.bind(1, msLevel);
stmt.step();
final int minMz = stmt.columnInt(0);
final int maxMz = stmt.columnInt(1);
stmt.dispose();
final int[] mzRange = { minMz, maxMz };
return mzRange;
}
示例11: getColumnsInTable
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Returns all columns in the table and their type
*
* @param db
* @param tablename
* @return
* @throws SQLiteException
*/
private static Map<String, String> getColumnsInTable(SQLiteConnection db, String tablename) throws SQLiteException
{
Map<String, String> columnsInTable = Maps.newHashMap();
SQLiteStatement sColumns = db.prepare("pragma table_info(" + tablename + ");");
while (sColumns.step())
{
columnsInTable.put(sColumns.columnString(1).toLowerCase(), sColumns.columnString(2).toUpperCase());
}
sColumns.dispose();
return columnsInTable;
}
示例12: getRecordCount
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
protected long getRecordCount(Configuration conf) throws IOException
{
String countQuery = "SELECT COUNT(*) FROM tiles WHERE zoom_level=?";
// Run the count query and grab the result.
SQLiteConnection conn = null;
try {
conn = MbVectorTilesDataProvider.getDbConnection(dbSettings, conf);
SQLiteStatement stmt = null;
try {
stmt = conn.prepare(countQuery, false);
stmt.bind(1, zoomLevel);
if (stmt.step()) {
return stmt.columnLong(0);
}
else {
throw new IOException("Unable to count tiles for zoom " + zoomLevel + " in " + dbSettings.getFilename());
}
}
finally {
if (stmt != null) {
stmt.dispose();
}
}
}
catch (SQLiteException e)
{
String msg = "Unable to get the count of records using query: " + countQuery;
log.error(msg, e);
throw new IOException(msg, e);
}
finally {
if (conn != null) {
conn.dispose();
}
}
}
示例13: getFavorites
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Gets favorite servers from the local database.
*
* @return a {@link Vector} of the {@link ChivServer}
* @see ChivServer
* @see SQLiteConnection
* @see SQLiteStatement
* @see SQLiteException
*/
public Vector<ChivServer> getFavorites() {
Vector<ChivServer> serversFav = new Vector<ChivServer>();
SQLiteConnection db = new SQLiteConnection(new File("browserdb"));
try {
db.open(true);
SQLiteStatement st = db.prepare("CREATE TABLE IF NOT EXISTS favorite_servers" +
"(" +
"id INTEGER PRIMARY KEY AUTOINCREMENT," +
"name varchar(255) not null default ''," +
"ip varchar(255) not null default ''," +
"port varchar(255) not null default '' )");
try {
st.step();
} finally {
st.dispose();
}
st = db.prepare("SELECT * FROM favorite_servers");
try {
while (st.step()) {
String name = st.columnString(1);
String ip = st.columnString(2);
String queryport = st.columnString(3);
serversFav.add(new ChivServer(name, ip, queryport));
}
} finally {
st.dispose();
}
} catch (SQLiteException e) {
e.printStackTrace();
}
db.dispose();
return serversFav;
}
示例14: getServerFromDB
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Searches the database for a server matching the ip address and gameport to find the
* associated queryport.
*
* @param ip the ip address of the server
* @param gameport the gameport of the server
* @return returns the {@link ChivServer}; or null if not found
* @see SQLiteConnection
* @see SQLiteStatement
* @see SQLiteException
*/
public ChivServer getServerFromDB(String ip, String gameport) {
String queryport = "";
SQLiteConnection db = new SQLiteConnection(new File("browserdb"));
try {
db.open(true);
SQLiteStatement st = db.prepare("CREATE TABLE IF NOT EXISTS servers" +
"(" +
"id INTEGER PRIMARY KEY AUTOINCREMENT," +
"ip varchar(255) not null default ''," +
"queryport varchar(255) not null default ''," +
"gameport varchar(255) not null default ''" +
")");
try {
st.step();
} finally {
st.dispose();
}
st = db.prepare("SELECT queryport FROM servers WHERE ip = '" + ip + "' AND gameport = '" + gameport + "'");
try {
st.step();
if ( st.hasRow() ) {
queryport = st.columnString(0);
}
} finally {
st.dispose();
}
} catch (SQLiteException e) {
e.printStackTrace();
}
db.dispose();
if ( !queryport.equals("") ) {
return ChivServer.createChivServer(mw, ip, Integer.parseInt(queryport));
}
return null;
}
示例15: getHistory
import com.almworks.sqlite4java.SQLiteStatement; //导入方法依赖的package包/类
/**
* Gets server history from the local database.
*
* @return a {@link Vector} of the {@link ChivServer}
* @see ChivServer
* @see SQLiteConnection
* @see SQLiteStatement
* @see SQLiteException
*/
public Vector<ChivServer> getHistory() {
Vector<ChivServer> serversHist = new Vector<ChivServer>();
SQLiteConnection db = new SQLiteConnection(new File("browserdb"));
try {
db.open(true);
SQLiteStatement st = db.prepare("CREATE TABLE IF NOT EXISTS server_history" +
"(" +
"id INTEGER PRIMARY KEY AUTOINCREMENT," +
"name varchar(255) not null default ''," +
"ip varchar(255) not null default ''," +
"port varchar(255) not null default '' )");
try {
st.step();
} finally {
st.dispose();
}
st = db.prepare("SELECT * FROM server_history");
try {
while (st.step()) {
String name = st.columnString(1);
String ip = st.columnString(2);
String queryport = st.columnString(3);
serversHist.add(new ChivServer(name, ip, queryport));
}
} finally {
st.dispose();
}
} catch (SQLiteException e) {
e.printStackTrace();
}
db.dispose();
return serversHist;
}