|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.ejen.ext.db.MetaDataNodeBuilder
Database/table metadata abstract class.
(see BasicMetaDataConnection
for usage).
Constructor Summary | |
MetaDataNodeBuilder()
|
Method Summary | |
protected static void |
appendErrorNode(Exception e)
Appends an error Node to the current _errors NodeSet. |
protected static Connection |
getConnection()
Gets the current active JDBC connection. |
static Node |
getDatabaseInformation(ExpressionContext context)
Returns a Node that contains basic database informations.
|
static NodeSet |
getErrors(ExpressionContext context)
Returns a NodeSet that contains errors informations.
|
static NodeSet |
getExportedKeys(ExpressionContext context,
String table)
Returns a NodeSet that contains exported keys metadata.
|
static NodeSet |
getExportedKeys(ExpressionContext context,
String catalog,
String schema,
String table)
Returns a NodeSet that contains exported keys metadata.
|
protected static NodeSet |
getExportedKeys(String catalog,
String schema,
String table,
Document doc)
Returns a NodeSet that contains exported keys metadata.
|
static NodeSet |
getImportedKeys(ExpressionContext context,
String table)
Returns a NodeSet that contains imported keys metadata.
|
static NodeSet |
getImportedKeys(ExpressionContext context,
String catalog,
String schema,
String table)
Returns a NodeSet that contains imported keys metadata.
|
protected static NodeSet |
getImportedKeys(String catalog,
String schema,
String table,
Document doc)
Returns a NodeSet that contains imported keys metadata.
|
protected static void |
getImportedOrExportedKeys(ResultSet rs,
String eltName,
NodeSet ns,
Document doc)
Returns a NodeSet that contains exported or imported
keys metadata.
|
static NodeSet |
getIndexInfo(ExpressionContext context,
String table)
Returns a NodeSet that contains indexes metadata.
|
static NodeSet |
getIndexInfo(ExpressionContext context,
String catalog,
String schema,
String table)
Returns a NodeSet that contains indexes metadata.
|
protected static NodeSet |
getIndexInfo(String catalog,
String schema,
String table,
Document doc)
Returns a NodeSet that contains indexes metadata.
|
static NodeSet |
getPrimaryKeys(ExpressionContext context,
String table)
Returns a NodeSet that contains primary keys metadata.
|
static NodeSet |
getPrimaryKeys(ExpressionContext context,
String catalog,
String schema,
String table)
Returns a NodeSet that contains primary keys metadata.
|
protected static NodeSet |
getPrimaryKeys(String catalog,
String schema,
String table,
Document doc)
Returns a NodeSet that contains primary keys metadata.
|
static NodeSet |
getResultSetMetaData(ExpressionContext context,
String table)
Returns a NodeSet that contains ResultSet
metadata (for all columns).
|
static NodeSet |
getResultSetMetaData(ExpressionContext context,
String table,
String columns)
Returns a NodeSet that contains ResultSet metadata
(for the given column names).
|
protected static NodeSet |
getResultSetMetaData(String table,
String columns,
String eltName,
Document doc)
Returns a NodeSet that contains ResultSet metadata
(for the given column names).
|
protected static String |
noNull(String s)
Returns s if s is not null , "#NULL" otherwise.
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String S_DI_NODE_NAME
public static final String S_DI_DATABASE_PRODUCT_NAME
public static final String S_DI_DATABASE_PRODUCT_VERSION
public static final String S_RS_COLUMN_NODE_NAME
public static final String S_RS_CATALOG_NAME
public static final String S_RS_COLUMN_CLASS_NAME
public static final String S_RS_COLUMN_DISPLAY_SIZE
public static final String S_RS_COLUMN_LABEL
public static final String S_RS_COLUMN_NAME
public static final String S_RS_COLUMN_TYPE
public static final String S_RS_COLUMN_TYPE_NAME
public static final String S_RS_PRECISION
public static final String S_RS_SCALE
public static final String S_RS_SCHEMA_NAME
public static final String S_RS_TABLE_NAME
public static final String S_RS_AUTO_INCREMENT
public static final String S_RS_CASE_SENSITIVE
public static final String S_RS_CURRENCY
public static final String S_RS_DEFINITELY_WRITABLE
public static final String S_RS_NULLABLE
public static final String S_RS_READ_ONLY
public static final String S_RS_SEARCHABLE
public static final String S_RS_SIGNED
public static final String S_RS_WRITABLE
public static final String S_RS_COLUMN_NO_NULLS
public static final String S_RS_COLUMN_NULLABLE
public static final String S_RS_COLUMN_NULLABLE_UNKNOWN
public static final String S_PK_NODE_NAME
public static final String S_PK_TABLE_CAT
public static final String S_PK_TABLE_SCHEM
public static final String S_PK_TABLE_NAME
public static final String S_PK_COLUMN_NAME
public static final String S_PK_KEY_SEQ
public static final String S_PK_PK_NAME
public static final String S_EIK_EK_NODE_NAME
public static final String S_EIK_IK_NODE_NAME
public static final String S_EIK_PKTABLE_CAT
public static final String S_EIK_PKTABLE_SCHEM
public static final String S_EIK_PKTABLE_NAME
public static final String S_EIK_PKCOLUMN_NAME
public static final String S_EIK_FKTABLE_CAT
public static final String S_EIK_FKTABLE_SCHEM
public static final String S_EIK_FKTABLE_NAME
public static final String S_EIK_FKCOLUMN_NAME
public static final String S_EIK_KEY_SEQ
public static final String S_EIK_UPDATE_RULE
public static final String S_EIK_DELETE_RULE
public static final String S_EIK_FK_NAME
public static final String S_EIK_PK_NAME
public static final String S_EIK_DEFERRABILITY
public static final String S_II_NODE_NAME
public static final String S_II_TABLE_CAT
public static final String S_II_TABLE_SCHEM
public static final String S_II_TABLE_NAME
public static final String S_II_NON_UNIQUE
public static final String S_II_INDEX_QUALIFIER
public static final String S_II_INDEX_NAME
public static final String S_II_TYPE
public static final String S_II_ORDINAL_POSITION
public static final String S_II_COLUMN_NAME
public static final String S_II_ASC_OR_DESC
public static final String S_II_CARDINALITY
public static final String S_II_PAGES
public static final String S_II_FILTER_CONDITION
public static final String S_EXCEPTION_NODE_NAME
public static final String S_EXCEPTION_CLASS_NAME
public static final String S_EXCEPTION_CODE
public static final String S_NOT_SUPPORTED
public static final String S_NULL
protected static NodeSet _errors
NodeSet
containing errors informations
protected static Connection _activeConn
Constructor Detail |
public MetaDataNodeBuilder()
Method Detail |
protected static Connection getConnection() throws SQLException
SQLException
- if there is no active connection
(ie: no connections at all).public static NodeSet getErrors(ExpressionContext context)
NodeSet
that contains errors informations.
<xsl:variable name="errors" select="mta:getErrors()"/> |
The returned NodeSet
has the following format:
[... other 'exception' nodes with earlier errors] <exception class-name="java.sql.SQLException" code="0"> Table not found: ADRESS in statement [SELECT * FROM ADRESS] </exception> |
context
- automatically passed by the xalan extension mechanism.
NodeSet
.public static Node getDatabaseInformation(ExpressionContext context)
Node
that contains basic database informations.
<xsl:copy-of select="mta:getDatabaseInformation()/@*"/> |
The returned Node
has the following format:
<database-information database-product-name="..." database-product-version="..."/> |
Database errors (SQLException) are not thrown. Instead, an errors
NodeSet
is built that can be retreived by the
getErrors(ExpressionContext)
method.
See DatabaseMetaData.getDatabaseProductName()
and
DatabaseMetaData.getDatabaseProductVersion()
.
context
- automatically passed by the xalan extension mechanism.
Node
.
WrappedRuntimeException
- DOM error.public static NodeSet getResultSetMetaData(ExpressionContext context, String table)
NodeSet
that contains ResultSet
metadata (for all columns).
<xsl:copy-of select="mta:getResultSetMetaData('ADDRESS')"/> |
The returned NodeSet
has the following format
<column auto-increment="false" case-sensitive="true" catalog-name="" column-class-name="#NOT_SUPPORTED" column-display-size="0" column-label="ID" column-name="ID" column-no-nulls="0" column-nullable="1" column-nullable-unknown="2" column-type="4" column-type-name="INTEGER" currency="false" definitely-writable="true" nullable="1" precision="0" read-only="false" scale="0" schema-name="" searchable="true" sequence="true" signed="true" table-name="ADDRESS" writable="true"/> [... Other column nodes] |
Note: column-no-nulls
, column-nullable
and
column-nullable-unknown
are just constant values used by
nullable
attribute.
Any null
value returned by a
ResultSetMetaData
.get*()
or a ResultSet
.get*(int columnIndex) is marked
as #NULL
.
Any exception thrown by a ResultSetMetaData
.get*() method
is marked as #NOT_SUPPORTED
.
Important database errors (table does not exists, ...) are not thrown. Instead,
an errors NodeSet
is built and can be retreived by the
getErrors(ExpressionContext)
method.
See ResultSetMetaData
.
context
- automatically passed by the xalan extension mechanism.table
- name of the table.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getResultSetMetaData(ExpressionContext context, String table, String columns)
NodeSet
that contains ResultSet
metadata
(for the given column names).
<xsl:copy-of select="mta:getResultSetMetaData('ADDRESS','COL1,COL2')"/> |
See getResultSetMetaData(ExpressionContext,String)
method.
context
- automatically passed by the xalan extension mechanism.table
- name of the table.columns
- comma separated list of columns.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.protected static NodeSet getResultSetMetaData(String table, String columns, String eltName, Document doc)
NodeSet
that contains ResultSet
metadata
(for the given column names).
See getResultSetMetaData(ExpressionContext,String)
method.
table
- name of the table.columns
- comma separated list of columns.eltName
- name of each columns node name.doc
- a Document
.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getPrimaryKeys(ExpressionContext context, String table)
NodeSet
that contains primary keys metadata.
<xsl:copy-of select="mta:getPrimaryKeys('ADDRESS')"/> |
The returned NodeSet
has the following format:
<primary-key column-name="ID" key-seq="1" pk-name="SYSTEM_PK" table-cat="#NULL" table-name="ADDRESS" table-shem="#NULL"/> |
Any null
value returned by a
ResultSetMetaData
.get*()
or a ResultSet
.get*(int columnIndex) is marked
as #NULL
.
Any exception thrown by a ResultSetMetaData
.get*() method
is marked as #NOT_SUPPORTED
.
Important database errors (table does not exists, ...) are not thrown.
Instead, an errors NodeSet
is built and can be retreived by the
getErrors(ExpressionContext)
method.
See DatabaseMetaData.getPrimaryKeys(String,String,String)
.
context
- automatically passed by the xalan extension mechanism.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getPrimaryKeys(ExpressionContext context, String catalog, String schema, String table)
NodeSet
that contains primary keys metadata.
<xsl:copy-of select="mta:getPrimaryKeys('CAT','SCH','ADDRESS')"/> |
See getPrimaryKeys(ExpressionContext,String)
.
context
- automatically passed by the xalan extension mechanism.catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.protected static NodeSet getPrimaryKeys(String catalog, String schema, String table, Document doc)
NodeSet
that contains primary keys metadata.
See getPrimaryKeys(ExpressionContext,String)
.
catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.doc
- a Document
.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getImportedKeys(ExpressionContext context, String table)
NodeSet
that contains imported keys metadata.
<xsl:copy-of select="mta:getImportedKeys('ADDRESS')"/> |
The returned NodeSet
has the following format:
<imported-key pktable-cat="..." pktable-shem="..." pktable-name="..." pkcolumn-name="..." fktable-cat="..." fktable-shem="..." fktable-name="..." fkcolumn-name="..." key-seq="..." update-rule="..." delete-rule="..." fk-name="..." pk-name="..." deferrability="..."/> [... Other imported-key nodes] |
Any null
value is marked as #NULL
.
Important database errors (table does not exists, ...) are not thrown.
Instead, an errors NodeSet
is built and can be retreived by the
getErrors(ExpressionContext)
method.
See DatabaseMetaData.getImportedKeys(String,String,String)
.
context
- automatically passed by the xalan extension mechanism.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getImportedKeys(ExpressionContext context, String catalog, String schema, String table)
NodeSet
that contains imported keys metadata.
<xsl:copy-of select="mta:getImportedKeys('CAT','SCH','ADDRESS')"/> |
See getImportedKeys(ExpressionContext,String)
.
context
- automatically passed by the xalan extension mechanism.catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.protected static NodeSet getImportedKeys(String catalog, String schema, String table, Document doc)
NodeSet
that contains imported keys metadata.
See getImportedKeys(ExpressionContext,String)
.
catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.doc
- a Document
.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getExportedKeys(ExpressionContext context, String table)
NodeSet
that contains exported keys metadata.
<xsl:copy-of select="mta:getExportedKeys('ADDRESS')"/> |
The returned NodeSet
has the following format:
<exported-key pktable-cat="..." pktable-shem="..." pktable-name="..." pkcolumn-name="..." fktable-cat="..." fktable-shem="..." fktable-name="..." fkcolumn-name="..." key-seq="..." update-rule="..." delete-rule="..." fk-name="..." pk-name="..." deferrability="..."/> [... Other exported-key nodes] |
Any null
value is marked as #NULL
.
Important database errors (table does not exists, ...) are not thrown.
Instead, an errors NodeSet
is built and can be retreived by the
getErrors(ExpressionContext)
method.
See DatabaseMetaData.getExportedKeys(String,String,String)
.
context
- automatically passed by the xalan extension mechanism.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getExportedKeys(ExpressionContext context, String catalog, String schema, String table)
NodeSet
that contains exported keys metadata.
<xsl:copy-of select="mta:getExportedKeys('CAT','SCH','ADDRESS')"/> |
See getExportedKeys(ExpressionContext,String)
.
context
- automatically passed by the xalan extension mechanism.catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.protected static NodeSet getExportedKeys(String catalog, String schema, String table, Document doc)
NodeSet
that contains exported keys metadata.
See getExportedKeys(ExpressionContext,String)
.
catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.doc
- a Document
.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.protected static void getImportedOrExportedKeys(ResultSet rs, String eltName, NodeSet ns, Document doc) throws Exception
NodeSet
that contains exported or imported
keys metadata.
See getExportedKeys(ExpressionContext,String)
and
getImportedKeys(ExpressionContext,String)
.
rs
- a ResutSet with imported or exported keys metadata.eltName
- name of the Nodes to be built.ns
- NodeSet to fill with Nodes.doc
- a Document
.
Exception
- any...public static NodeSet getIndexInfo(ExpressionContext context, String table)
NodeSet
that contains indexes metadata.
<xsl:copy-of select="mta:getIndexInfo('ADDRESS')"/> |
The returned NodeSet
has the following format:
<index asc-or-desc="A" cardinality="#NULL" column-name="ID" filter-condition="#NULL" index-name="SYSTEM_PK" index-qualifier="#NULL" non-unique="false" ordinal-position="1" pages="#NULL" table-cat="#NULL" table-name="ADDRESS" table-shem="#NULL" type="3"/> [... Other index nodes] |
Any null
value is marked as #NULL
.
Important database errors (table does not exists, ...) are not thrown.
Instead, an errors NodeSet
is built and can be retreived by the
getErrors(ExpressionContext)
method.
See DatabaseMetaData.getIndexInfo(String,String,String,boolean,boolean)
.
context
- automatically passed by the xalan extension mechanism.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.public static NodeSet getIndexInfo(ExpressionContext context, String catalog, String schema, String table)
NodeSet
that contains indexes metadata.
<xsl:copy-of select="mta:getIndexInfo('CAT','SCH','ADDRESS')"/> |
See getIndexInfo(ExpressionContext,String)
.
context
- automatically passed by the xalan extension mechanism.catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.
NodeSet
.
WrappedRuntimeException
- DOM error.protected static NodeSet getIndexInfo(String catalog, String schema, String table, Document doc)
NodeSet
that contains indexes metadata.
See getIndexInfo(ExpressionContext,String)
.
catalog
- name of the catalog.schema
- name of the schema.table
- name of the table.doc
- a Document
.
ResultSet
metadata NodeSet
.
WrappedRuntimeException
- DOM error.protected static void appendErrorNode(Exception e)
e
- the exception that must be add as an error Node.
WrappedRuntimeException
- DOM error.protected static String noNull(String s)
null
, "#NULL" otherwise.
s
- the String to test for nullity.
null
, "#NULL" otherwise.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |