Search in sources :

Example 1 with DbException

use of org.h2.message.DbException in project siena by mandubian.

the class FullText method setIgnoreList.

/**
     * Change the ignore list. The ignore list is a comma separated list of
     * common words that must not be indexed. The default ignore list is empty.
     * If indexes already exist at the time this list is changed, reindex must
     * be called.
     *
     * @param conn the connection
     * @param commaSeparatedList the list
     */
public static void setIgnoreList(Connection conn, String commaSeparatedList) throws SQLException {
    try {
        init(conn);
        FullTextSettings setting = FullTextSettings.getInstance(conn);
        setIgnoreList(setting, commaSeparatedList);
        Statement stat = conn.createStatement();
        stat.execute("TRUNCATE TABLE " + SCHEMA + ".IGNORELIST");
        PreparedStatement prep = conn.prepareStatement("INSERT INTO " + SCHEMA + ".IGNORELIST VALUES(?)");
        prep.setString(1, commaSeparatedList);
        prep.execute();
    } catch (DbException e) {
        throw DbException.toSQLException(e);
    }
}
Also used : PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) PreparedStatement(java.sql.PreparedStatement) DbException(org.h2.message.DbException)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 Statement (java.sql.Statement)1 DbException (org.h2.message.DbException)1