本文整理匯總了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);
}