Exemplo n.º 1
0
 protected void index(ResultSet rs, ILinguist linguist, long sid, String sent)
     throws LoadException {
   if (rs == null) throw new LoadException("Index ResultSet null");
   try {
     // System.out.println(sent);
     String[] words = linguist.indexkeys(sent);
     if (words.length > 0) {
       Map<String, String> dup = new HashMap<String, String>();
       int i = 0;
       for (String word : words) {
         // System.out.print(word+" ");
         if (!dup.containsKey(word)) {
           dup.put(word, word);
           rs.moveToInsertRow();
           rs.updateString("F_Word", word);
           rs.updateLong("F_SID", sid);
           rs.updateInt("F_Offset", i++);
           rs.insertRow();
         }
       }
       // System.out.println();
     }
   } catch (SQLException se) {
     throw new LoadException("SQLException occurred: " + se.getMessage());
   } catch (LanguageException le) {
     throw new LoadException("LanguageException occurred indexing: " + le.getMessage());
   }
 }
Exemplo n.º 2
0
 protected long getNextSid() throws LoadException {
   try {
     String sql = "SELECT nextval('S_ENZH')";
     Statement stmt = this.conn_.createStatement();
     ResultSet rs = stmt.executeQuery(sql);
     long sid = 0;
     if (rs.next()) sid = rs.getLong(1);
     rs.close();
     stmt.close();
     return sid;
   } catch (SQLException se) {
     throw new LoadException("SQLException occurred: " + se.getMessage());
   }
 }