本文整理汇总了Java中com.almworks.sqlite4java.SQLiteException类的典型用法代码示例。如果您正苦于以下问题:Java SQLiteException类的具体用法?Java SQLiteException怎么用?Java SQLiteException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLiteException类属于com.almworks.sqlite4java包,在下文中一共展示了SQLiteException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processTuple
import com.almworks.sqlite4java.SQLiteException; //导入依赖的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.SQLiteException; //导入依赖的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: getRunSliceIdsForMzRange
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
/**
* Gets the run slice ids for mz range.
*
* @param minMz
* the min mz
* @param maxMz
* the max mz
* @param msLevel
* the ms level
* @param connection
* the connection
* @return the run slice ids for mz range
* @throws SQLiteException
* the sQ lite exception
*/
protected int[] getRunSliceIdsForMzRange(double minMz, double maxMz, int msLevel, SQLiteConnection connection) throws SQLiteException {
RunSliceHeader firstRunSlice = this.getRunSliceForMz(minMz, msLevel, connection);
RunSliceHeader lastRunSlice = this.getRunSliceForMz(maxMz, msLevel, connection);
double mzHeight = (msLevel == 1) ? this.getMzDbReader().getBBSizes().BB_MZ_HEIGHT_MS1 : this.getMzDbReader().getBBSizes().BB_MZ_HEIGHT_MSn;
int bufferLength = 1 + (int) ((maxMz - minMz) / mzHeight);
String queryStr = "SELECT id FROM run_slice WHERE ms_level = ? AND begin_mz >= ? AND end_mz <= ?";
return new SQLiteQuery(connection, queryStr)
.bind(1, msLevel)
.bind(2, firstRunSlice.getBeginMz())
.bind(3, lastRunSlice.getEndMz())
.extractInts(bufferLength);
}
示例4: findExpiredLeases
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
protected List<DhcpLease> findExpiredLeases(final byte iatype) {
SQLiteConnection connection = null;
SQLiteStatement statement = null;
try {
connection = getSQLiteConnection();
statement = connection.prepare(
"select * from dhcplease" +
" where iatype = ?" +
" and state != " + IaAddress.STATIC +
" and validendtime < ? order by validendtime");
statement.bind(1, iatype);
statement.bind(2, new Date().getTime());
return mapLeases(statement);
}
catch (SQLiteException ex) {
log.error("findExpiredLeases failed", ex);
throw new RuntimeException(ex);
}
finally {
closeStatement(statement);
closeConnection(connection);
}
}
示例5: SQLiteQuery
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
public SQLiteQuery(SQLiteConnection connection, String sqlQuery, boolean cacheStmt)
throws SQLiteException {
super();
this.queryString = sqlQuery;
this.stmt = connection.prepare(sqlQuery, cacheStmt);
HashMap<String, Integer> colIdxByColName = new HashMap<String, Integer>();
int nbCols = stmt.columnCount();
for (int colIdx = 0; colIdx < nbCols; colIdx++) {
String colName = stmt.getColumnName(colIdx);
colIdxByColName.put(colName, colIdx);
}
this.resultDesc = new SQLiteResultDescriptor(colIdxByColName);
}
示例6: deleteAllIAs
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
/**
* For unit tests only
*/
public void deleteAllIAs() {
SQLiteConnection connection = null;
SQLiteStatement statement = null;
try {
connection = getSQLiteConnection();
connection.exec("delete from dhcplease");
}
catch (SQLiteException ex) {
log.error("deleteAllIAs failed", ex);
throw new RuntimeException(ex);
}
finally {
closeStatement(statement);
closeConnection(connection);
}
}
示例7: findExpiredIaPrefixes
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
@Override
public List<IaPrefix> findExpiredIaPrefixes() {
SQLiteConnection connection = null;
SQLiteStatement statement = null;
try {
connection = getSQLiteConnection();
statement = connection.prepare(
"select * from dhcplease" +
" where iatype = " + IdentityAssoc.PD_TYPE +
" and validendtime < ? order by validendtime");
statement.bind(1, new Date().getTime());
List<DhcpLease> leases = mapLeases(statement);
return toIaPrefixes(leases);
}
catch (SQLiteException ex) {
log.error("findExpiredIaPrefixes failed", ex);
throw new RuntimeException(ex);
}
finally {
closeStatement(statement);
closeConnection(connection);
}
}
示例8: beginWindow
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
@Override
public void beginWindow(long windowId)
{
try {
beginStatement.step();
beginStatement.reset();
} catch (SQLiteException ex) {
throw new RuntimeException(ex);
}
}
示例9: endWindow
import com.almworks.sqlite4java.SQLiteException; //导入依赖的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;
}
示例10: peekInstance
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
public static CardsManager peekInstance() {
if (INSTANCE == null) {
try {
INSTANCE = new CardsManager();
} catch (SQLiteException e) {
log.log(Level.SEVERE,"can not load cards database :{0}", e.getMessage());
}
}
return INSTANCE;
}
示例11: insertDhcpLease
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
/**
* Insert dhcp lease.
*
* @param lease the lease
*/
protected void insertDhcpLease(final DhcpLease lease)
{
SQLiteConnection connection = null;
SQLiteStatement statement = null;
try {
connection = getSQLiteConnection();
statement = connection.prepare("insert into dhcplease" +
" (ipaddress, duid, iatype, iaid, prefixlen, state," +
" starttime, preferredendtime, validendtime," +
" ia_options, ipaddr_options)" +
" values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
statement.bind(1, lease.getIpAddress().getAddress());
statement.bind(2, lease.getDuid());
statement.bind(3, lease.getIatype());
statement.bind(4, lease.getIaid());
statement.bind(5, lease.getPrefixLength());
statement.bind(6, lease.getState());
statement.bind(7, lease.getStartTime().getTime());
statement.bind(8, lease.getPreferredEndTime().getTime());
statement.bind(9, lease.getValidEndTime().getTime());
statement.bind(10, encodeOptions(lease.getIaDhcpOptions()));
statement.bind(11, encodeOptions(lease.getIaAddrDhcpOptions()));
while (statement.step()) {
log.debug("insertDhcpLease: step=true");
}
}
catch (SQLiteException ex) {
log.error("insertDhcpLease failed", ex);
throw new RuntimeException(ex);
}
finally {
closeStatement(statement);
closeConnection(connection);
}
}
示例12: createMgf
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
private static void createMgf(CreateMgfCommand cmd) throws SQLiteException, IOException, ClassNotFoundException {
logger.info("Creating MGF File for mzDB at: " + cmd.mzdbFile);
logger.info("Precursor m/z values will be defined using the method: " + cmd.precMzComputation);
MgfWriter writer = new MgfWriter(cmd.mzdbFile, cmd.msLevel);
writer.write(cmd.outputFile, cmd.precMzComputation, cmd.mzTolPPM, cmd.intensityCutoff, cmd.exportProlineTitle);
}
示例13: nativeExecute
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
@Implementation
public static void nativeExecute(final int connectionPtr, final int statementPtr) {
if (statementPtr == IGNORED_REINDEX_STMT) { return; } // TODO
CONNECTIONS.execute("execute", new Callable<Object>() {
@Override
public Object call() throws SQLiteException {
SQLiteStatement stmt = stmt(connectionPtr, statementPtr);
stmt.stepThrough();
return null;
}
});
}
示例14: nativeExecuteForString
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
@Implementation
public static String nativeExecuteForString(final int connectionPtr, final int statementPtr) {
return CONNECTIONS.execute("execute for string", new Callable<String>() {
@Override
public String call() throws SQLiteException {
SQLiteStatement stmt = stmt(connectionPtr, statementPtr);
if (!stmt.step()) {
throw new SQLiteDoneException();
}
return stmt.columnString(0);
}
});
}
示例15: nativeGetColumnCount
import com.almworks.sqlite4java.SQLiteException; //导入依赖的package包/类
@Implementation
public static int nativeGetColumnCount(final int connectionPtr, final int statementPtr) {
return CONNECTIONS.execute("get columns count", new Callable<Integer>() {
@Override
public Integer call() throws SQLiteException {
SQLiteStatement stmt = stmt(connectionPtr, statementPtr);
return stmt.columnCount();
}
});
}