Code example for ResultSetMetaData

Methods: getCatalogName, getColumnDisplaySize, getColumnLabel, getColumnName, getColumnTypeName, getPrecision, getScale, getSchemaName, getTableName, isAutoIncrement

0
    private void writeMetadataByCol(Document doc, Element ele,
            ResultSetMetaData rsmd, int colIndex) throws SQLException {
        Element colDefEle = doc.createElement("column-definition"); //$NON-NLS-1$
        appendElement(colDefEle, doc, "column-index", colIndex); //$NON-NLS-1$
        appendElement(colDefEle, doc, "auto-increment", rsmd //$NON-NLS-1$
                .isAutoIncrement(colIndex));
        appendElement(colDefEle, doc, "case-sensitive", rsmd //$NON-NLS-1$
                .isCaseSensitive(colIndex));
        appendElement(colDefEle, doc, "currency", rsmd.isCurrency(colIndex)); //$NON-NLS-1$
        appendElement(colDefEle, doc, "nullable", rsmd.isNullable(colIndex)); //$NON-NLS-1$
        appendElement(colDefEle, doc, "signed", rsmd.isSigned(colIndex)); //$NON-NLS-1$
        appendElement(colDefEle, doc, "searchable", rsmd.isSearchable(colIndex)); //$NON-NLS-1$
        appendElement(colDefEle, doc, "column-display-size", rsmd //$NON-NLS-1$
                .getColumnDisplaySize(colIndex));
        appendElement(colDefEle, doc, "column-label", rsmd //$NON-NLS-1$
                .getColumnLabel(colIndex));
        appendElement(colDefEle, doc, "column-name", rsmd //$NON-NLS-1$
                .getColumnName(colIndex));
        appendElement(colDefEle, doc, "schema-name", rsmd //$NON-NLS-1$
                .getSchemaName(colIndex));
        appendElement(colDefEle, doc, "column-precision", rsmd //$NON-NLS-1$
                .getPrecision(colIndex));
        appendElement(colDefEle, doc, "column-scale", rsmd.getScale(colIndex)); //$NON-NLS-1$
        appendElement(colDefEle, doc, "table-name", rsmd.getTableName(colIndex)); //$NON-NLS-1$
        appendElement(colDefEle, doc, "catalog-name", rsmd //$NON-NLS-1$
                .getCatalogName(colIndex));
        appendElement(colDefEle, doc, "column-type", rsmd //$NON-NLS-1$
                .getColumnType(colIndex));
        appendElement(colDefEle, doc, "column-type-name", rsmd //$NON-NLS-1$
                .getColumnTypeName(colIndex));
        ele.appendChild(colDefEle);
    } 
}