Class: ColumnMetadata

$.hdb. ColumnMetadata

$.hdb.ColumnMetadata represents the metadata of a single column from a result set.

new ColumnMetadata()

Example
var conn = $.hdb.getConnection();
conn.executeUpdate('CREATE SCHEMA EXAMPLE');
conn.executeUpdate('CREATE TABLE EXAMPLE.TEST_METADATA( TINT TINYINT NOT NULL, FLOAT FLOAT )');
conn.executeUpdate('INSERT INTO EXAMPLE.TEST_METADATA VALUES(12, 34.5)');
conn.commit();
var resultSet = conn.executeQuery('SELECT * FROM EXAMPLE.TEST_METADATA');
var columnsMetadata = resultSet.metadata.columns;
var columnCount = columnsMetadata.length;
var body = "";
for(var i = 0; i < columnCount; i++) {
    body += "Column " + (i + 1) + " metadata:\n";
    body += "  Catalog name: " + columnsMetadata[i].catalogName + "\n";
    body += "  Display size: " + columnsMetadata[i].displaySize + "\n";
    body += "  Label:        " + columnsMetadata[i].label + "\n";
    body += "  Name:         " + columnsMetadata[i].name + "\n";
    body += "  Type:         " + columnsMetadata[i].type + "\n";
    body += "  Type name:    " + columnsMetadata[i].typeName + "\n";
    body += "  Precision:    " + columnsMetadata[i].precision + "\n";
    body += "  Scale:        " + columnsMetadata[i].scale + "\n";
    body += "  Table name:   " + columnsMetadata[i].tableName + "\n";
    body += "  Is nullable:  " + (columnsMetadata[i].isNullable ? "true" : "false") + "\n\n";
}

conn.executeUpdate('DROP TABLE EXAMPLE.TEST_METADATA');
conn.executeUpdate('DROP SCHEMA EXAMPLE');
$.response.contentType = "text/plain";
$.response.setBody(body);

Members

catalogName :string

Returns the column's catalog name.
Type:
  • string

displaySize :number

Returns the column's display size.
Type:
  • number

isNullable :number

Returns true if the column is nullable and false otherwise.
Type:
  • number

label :string

Returns the column's label.
Type:
  • string

name :string

Returns the column's name.
Type:
  • string

precision :number

Returns the column's precision.
Type:
  • number

scale :number

Returns the column's scale.
Type:
  • number

tableName :string

Returns the name of the table to which the column belongs.
Type:
  • string

type :$.hdb.types

Returns the column's type.
Type:

typeName :string

Returns the column's type name.
Type:
  • string