本文整理汇总了Java中org.sqlite.SQLiteException类的典型用法代码示例。如果您正苦于以下问题:Java SQLiteException类的具体用法?Java SQLiteException怎么用?Java SQLiteException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SQLiteException类属于org.sqlite包,在下文中一共展示了SQLiteException类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateJoin
import org.sqlite.SQLiteException; //导入依赖的package包/类
public static void updateJoin(String nameQuery, String update) throws Exception{
Connection conn = DBConnect("JoinDB");
String query = "SELECT * from JoinEvent where Name = '" + nameQuery + "'";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
int ID = rs.getInt("ID");
rs.close();
System.out.println(ID);
String updateQuery = "UPDATE JoinEvent SET Message = ? " + "WHERE ID = ?";
PreparedStatement pstmt = conn.prepareStatement(updateQuery);
pstmt.setString(1, update);
pstmt.setInt(2, ID);
try{
System.out.println("UPDATE JoinEvent SET Message = " + update + " WHERE ID = " + ID);
pstmt.executeUpdate();
}catch (SQLiteException e){
e.printStackTrace();
}
}
示例2: newSQLException
import org.sqlite.SQLiteException; //导入依赖的package包/类
/**
* Throws formated SQLException with error code and message.
* @param errorCode Error code to be passed.
* @param errorMessage Error message to be passed.
* @return Formated SQLException with error code and message.
* @throws SQLException
*/
public static SQLiteException newSQLException(int errorCode, String errorMessage) {
SQLiteErrorCode code = SQLiteErrorCode.getErrorCode(errorCode);
SQLiteException e = new SQLiteException(
String.format("%s (%s)", code, errorMessage), code
);
return e;
}
示例3: throwex
import org.sqlite.SQLiteException; //导入依赖的package包/类
/**
* Throws SQL Exception with error code and message.
* @param errorCode Error code to be passed.
* @param errorMessage Error message to be passed.
* @throws SQLException
*/
static final void throwex(int errorCode, String errorMessage) throws SQLiteException {
throw newSQLException(errorCode, errorMessage);
}