The MetaData Object

A MetaData object can not be created, it can only be obtained from the Cursor object.

var cursor = db.cursor(“select * from myTable”);

var metaDataObj = cursor.getMetaData();

The MetaData object can be used to get information about the types and properties of the columns in a table that has been the subject of an SQL select using the Cursor object.

Shown below is the MetaData object prototype chain.

MetaData objects are of class MetaData.

MetaData Object Properties

The MetaData object properties are read only objects, one for each column in the cursor data. The property name is the column label and the column objects have properties that describe the column.

The table below describes all the properties that the columns may have. If the database does not return a certain metadata property then it will not be represented in the object.

Property

Description

catalogName

The designated column's table's catalog name.

className

The fully-qualified name of the Java class related to the column type.

displaySize

Indicates the designated column's normal maximum width in characters.

columnLabel

The designated columns's suggested title for use in printouts and displays.

columnTypeName

The designated column's database-specific type name.

precision

The designated column's number of decimal digits.

scale

The designated column's number of digits to the right of the decimal point.

schemaName

The designated column's table's schema.

tableName

The designated column's table name.

isAutoIncrement

Indicates whether the designated column is automatically numbered, thus read-only.

isCaseSensitive

Indicates whether a column's case matters.

isCurrency

Indicates whether the designated column is a cash value.

isDefinitelyWritable

Indicates whether a write on the designated column will definitely succeed

isNullable

Indicates the nullability of values in the designated column.

isReadOnly

Indicates whether the designated column is definitely not writable.

isSearchable

Indicates whether the designated column can be used in a where clause.

isSigned

Indicates whether values in the designated column are signed numbers.

isWritable

Indicates whether it is possible for a write on the designated column to succeed.

The example below can be used to find out if a column with a label of 'myColumn1'  is writable:

var cursor = db.cursor(“select * from myTable”);

var metaDataObj = cursor.getMetaData();

var column1Writable = metaDataObj.myColumn1.isWritable;

MetaData Object Functions

The MetaData object has no functions.

Comment on this topic

Topic ID: 150072