ucGetSequenceInfo

Purpose

Applies To

Administration Methods

Signature

public Map ucGetSequenceInfo(
                Connection dbconn ) 

Notes

Example

public Map ucGetSequenceInfo(Connection dbconn) throws Exception {
        HashMap sequences = new HashMap();
        if (dbconn == null)throw new NullPointerException("Connection is null.");
        String sql =
            " select name, table_name, column_name, cache_size from ev_sequence 
               where name like '%' escape '$'";
        PreparedStatement ps = null;
        ResultSet rs = null;
        List updateStatements;
        try {
            ps = dbconn.prepareStatement(sql);
            rs = ps.executeQuery();
            while (rs.next()) {
                String sequenceName = rs.getString("name");
                int pos = sequenceName.indexOf("_");
                String altIdPrefix = sequenceName.substring(0, pos);
                String tableName = rs.getString("table_name");
                String columnName = rs.getString("column_name");
                String cache = rs.getString("cache_size");
                if (tableName != null && columnName != null && "ITEM".equals(tableName) 
                   && "ALT_ID".equals(columnName)) {
                    StringBuffer cookedName = new StringBuffer("cast( ");
                    cookedName.append(Z.dbms.substr("ALT_ID", "4", "5"));
                    cookedName.append(" as numeric )");
                    sequences.put(sequenceName,
                                  getSequenceUpdateStatement(tableName, 
                                     cookedName.toString(), cache, sequenceName,
                        altIdPrefix));
                }
            }
        } catch (Exception e) {
            ErrorWriter.write(e, ErrorWriter.LOG);
            throw e;
        } finally {
            if (rs != null)try {
                rs.close();
            }
            catch (Exception basura) {}
            if (ps != null)try {
                ps.close();
            }
            catch (Exception basura) {}
        }
        return sequences;
    }