giovedì 21 dicembre 2017

DDL support for HYPERLINK fields

Starting with version 4.0.3, UCanAccess DDL now supports HYPERLINK fields, e.g.,

CREATE TABLE table1 (id LONG, website HYPERLINK)

ALTER TABLE table2 ADD COLUMN website HYPERLINK

Those fields are recorded in the UCanAccess metadata as 'HYPERLINK'. We can identify such fields via the ORIGINAL_TYPE column of DatabaseMetaData#getColumns, like so:

String tableName = "urlTest";
String fieldName = "website";
ResultSet rs = conn.getMetaData().getColumns(null, null, tableName, fieldName);
if (rs.next()) {
    if (rs.getString("ORIGINAL_TYPE").equals("HYPERLINK")) {
        System.out.printf("[%s].[%s] is a HYPERLINK field.%n", tableName, fieldName);
    }
}

Nessun commento:

Posta un commento