use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class SchemaUtils method getSchemaResultSet.
public static JaqyResultSet getSchemaResultSet(JaqyHelper helper, SchemaInfo schemaInfo, boolean exact, JaqyInterpreter interpreter) throws SQLException {
int count = schemaInfo.columns.length;
PropertyTable pt = new PropertyTable(new String[] { "Column", "Type", "Nullable" });
for (int i = 0; i < count; ++i) {
String columnName = schemaInfo.columns[i].name;
String columnType;
if (exact) {
columnType = helper.getTypeName(schemaInfo.columns[i]);
} else {
columnType = helper.getTypeName(schemaInfo.columns[i].type, schemaInfo.columns[i].precision, schemaInfo.columns[i].scale, false);
}
String nullable = (schemaInfo.columns[i].nullable == ResultSetMetaData.columnNoNulls) ? "No" : (schemaInfo.columns[i].nullable == ResultSetMetaData.columnNullable ? "Yes" : "Unknown");
pt.addRow(new String[] { columnName, columnType, nullable });
}
return ResultSetUtils.getResultSet(pt);
}
use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class InfoCommand method listBehaviors.
private void listBehaviors(JaqyInterpreter interpreter, DatabaseMetaData metaData, JaqyHelper helper) throws SQLException {
PropertyTable pt = new PropertyTable(new String[] { "Name", "Value" });
try {
pt.addRow(new String[] { "Catalog Term", metaData.getCatalogTerm() });
pt.addRow(new String[] { "Schema Term", metaData.getSchemaTerm() });
pt.addRow(new String[] { "Procedure Term", metaData.getProcedureTerm() });
pt.addRow(new String[] { "NULLs are sorted high", getYesNo(metaData.nullsAreSortedHigh()) });
pt.addRow(new String[] { "NULLs are sorted low", getYesNo(metaData.nullsAreSortedLow()) });
pt.addRow(new String[] { "NULLs are sorted at start", getYesNo(metaData.nullsAreSortedAtStart()) });
pt.addRow(new String[] { "NULLs are sorted at end", getYesNo(metaData.nullsAreSortedAtEnd()) });
pt.addRow(new String[] { "NULL + non-null is NULL", getYesNo(metaData.nullPlusNonNullIsNull()) });
pt.addRow(new String[] { "Use local files", getYesNo(metaData.usesLocalFiles()) });
pt.addRow(new String[] { "Use local file per table", getYesNo(metaData.usesLocalFilePerTable()) });
pt.addRow(new String[] { "Identifier quote string", metaData.getIdentifierQuoteString() });
pt.addRow(new String[] { "Search string escape", metaData.getSearchStringEscape() });
pt.addRow(new String[] { "Extra name characters", metaData.getExtraNameCharacters() });
pt.addRow(new String[] { "Is catalog at start", getYesNo(metaData.isCatalogAtStart()) });
pt.addRow(new String[] { "Catalog separator", metaData.getCatalogSeparator() });
pt.addRow(new String[] { "Default Transaction Isolation", DatabaseMetaDataUtils.getIsolationLevel(metaData.getDefaultTransactionIsolation()) });
pt.addRow(new String[] { "ResultSet holdability", DatabaseMetaDataUtils.getHoldability(metaData.getResultSetHoldability()) });
pt.addRow(new String[] { "LOB update on copy", getYesNo(metaData.locatorsUpdateCopy()) });
pt.addRow(new String[] { "Row ID lifetime", metaData.getRowIdLifetime().toString() });
pt.addRow(new String[] { "Auto-commit failure closes all ResultSets", getYesNo(metaData.autoCommitFailureClosesAllResultSets()) });
pt.addRow(new String[] { "Auto-generated key always return", getYesNo(metaData.generatedKeyAlwaysReturned()) });
} catch (Throwable t) {
interpreter.getGlobals().log(Level.INFO, t);
}
interpreter.print(pt);
}
use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class InfoCommand method listFunctions.
private void listFunctions(JaqyInterpreter interpreter, DatabaseMetaData metaData, JaqyHelper helper) throws SQLException {
PropertyTable pt = new PropertyTable(new String[] { "Name", "Value" });
try {
pt.addRow(new String[] { "Numeric functions", metaData.getNumericFunctions() });
pt.addRow(new String[] { "String functions", metaData.getStringFunctions() });
pt.addRow(new String[] { "System functions", metaData.getSystemFunctions() });
pt.addRow(new String[] { "Date/Time functions", metaData.getTimeDateFunctions() });
} catch (Throwable t) {
interpreter.getGlobals().log(Level.INFO, t);
}
interpreter.print(pt);
}
use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class InfoCommand method listFeatures.
private void listFeatures(JaqyInterpreter interpreter, DatabaseMetaData metaData, JaqyHelper helper) throws SQLException {
PropertyTable pt = new PropertyTable(new String[] { "Name", "Supported" });
try {
pt.addRow(new String[] { "All Procedures are callable", getYesNo(metaData.allProceduresAreCallable()) });
pt.addRow(new String[] { "All tables are selectable", getYesNo(metaData.allTablesAreSelectable()) });
pt.addRow(new String[] { "ALT TABLE ADD column", getYesNo(metaData.supportsAlterTableWithAddColumn()) });
pt.addRow(new String[] { "ALT TABLE DROP column", getYesNo(metaData.supportsAlterTableWithDropColumn()) });
pt.addRow(new String[] { "Column aliasing", getYesNo(metaData.supportsColumnAliasing()) });
pt.addRow(new String[] { "CONVERT", getYesNo(metaData.supportsConvert()) });
pt.addRow(new String[] { "Table correlation names", getYesNo(metaData.supportsTableCorrelationNames()) });
pt.addRow(new String[] { "Different table correlation names", getYesNo(metaData.supportsDifferentTableCorrelationNames()) });
pt.addRow(new String[] { "Expression in ORDER BY", getYesNo(metaData.supportsExpressionsInOrderBy()) });
pt.addRow(new String[] { "ORDER BY unrelated", getYesNo(metaData.supportsOrderByUnrelated()) });
pt.addRow(new String[] { "GROUP BY", getYesNo(metaData.supportsGroupBy()) });
pt.addRow(new String[] { "GROUP BY unrelated", getYesNo(metaData.supportsGroupByUnrelated()) });
pt.addRow(new String[] { "GROUP BY beyond select", getYesNo(metaData.supportsGroupByBeyondSelect()) });
pt.addRow(new String[] { "LIKE escape clause", getYesNo(metaData.supportsLikeEscapeClause()) });
pt.addRow(new String[] { "Multiple result set", getYesNo(metaData.supportsMultipleResultSets()) });
pt.addRow(new String[] { "Multple transactions", getYesNo(metaData.supportsMultipleTransactions()) });
pt.addRow(new String[] { "Non-nullable columns", getYesNo(metaData.supportsNonNullableColumns()) });
pt.addRow(new String[] { "Minimum SQL grammar", getYesNo(metaData.supportsMinimumSQLGrammar()) });
pt.addRow(new String[] { "Core SQL grammar", getYesNo(metaData.supportsCoreSQLGrammar()) });
pt.addRow(new String[] { "Extended SQL grammar", getYesNo(metaData.supportsExtendedSQLGrammar()) });
pt.addRow(new String[] { "SQL92 entry", getYesNo(metaData.supportsANSI92EntryLevelSQL()) });
pt.addRow(new String[] { "SQL92 intermediate", getYesNo(metaData.supportsANSI92IntermediateSQL()) });
pt.addRow(new String[] { "SQL92 full", getYesNo(metaData.supportsANSI92FullSQL()) });
pt.addRow(new String[] { "Integrity Enhancement Facility", getYesNo(metaData.supportsIntegrityEnhancementFacility()) });
pt.addRow(new String[] { "OUTER JOIN", getYesNo(metaData.supportsOuterJoins()) });
pt.addRow(new String[] { "Full OUTER JOIN", getYesNo(metaData.supportsFullOuterJoins()) });
pt.addRow(new String[] { "Limited OUTER JOIN", getYesNo(metaData.supportsLimitedOuterJoins()) });
pt.addRow(new String[] { "Schemas in DML", getYesNo(metaData.supportsSchemasInDataManipulation()) });
pt.addRow(new String[] { "Schemas in procedure calls", getYesNo(metaData.supportsSchemasInProcedureCalls()) });
pt.addRow(new String[] { "Schemas in table DDL", getYesNo(metaData.supportsSchemasInTableDefinitions()) });
pt.addRow(new String[] { "Schemas in index DDL", getYesNo(metaData.supportsSchemasInIndexDefinitions()) });
pt.addRow(new String[] { "Schemas in privilege definitions", getYesNo(metaData.supportsSchemasInPrivilegeDefinitions()) });
pt.addRow(new String[] { "Catalog in DML", getYesNo(metaData.supportsCatalogsInDataManipulation()) });
pt.addRow(new String[] { "Catalog in procedure calls", getYesNo(metaData.supportsCatalogsInProcedureCalls()) });
pt.addRow(new String[] { "Catalog in table DDL", getYesNo(metaData.supportsCatalogsInTableDefinitions()) });
pt.addRow(new String[] { "Catalog in index DDL", getYesNo(metaData.supportsCatalogsInIndexDefinitions()) });
pt.addRow(new String[] { "Catalog in privilege definitions", getYesNo(metaData.supportsCatalogsInPrivilegeDefinitions()) });
pt.addRow(new String[] { "Positioned DELETE", getYesNo(metaData.supportsPositionedDelete()) });
pt.addRow(new String[] { "Positioned UPDATE", getYesNo(metaData.supportsPositionedUpdate()) });
pt.addRow(new String[] { "SELECT FOR UPDATE", getYesNo(metaData.supportsSelectForUpdate()) });
pt.addRow(new String[] { "Stored Procedure", getYesNo(metaData.supportsStoredProcedures()) });
pt.addRow(new String[] { "Subqueries in comparisons", getYesNo(metaData.supportsSubqueriesInComparisons()) });
pt.addRow(new String[] { "Subqueries in EXISTS", getYesNo(metaData.supportsSubqueriesInExists()) });
pt.addRow(new String[] { "Subqueries in IN", getYesNo(metaData.supportsSubqueriesInIns()) });
pt.addRow(new String[] { "Subqueries in quantified expressions", getYesNo(metaData.supportsSubqueriesInQuantifieds()) });
pt.addRow(new String[] { "Correlated subqueries", getYesNo(metaData.supportsCorrelatedSubqueries()) });
pt.addRow(new String[] { "UNION", getYesNo(metaData.supportsUnion()) });
pt.addRow(new String[] { "UNION ALL", getYesNo(metaData.supportsUnionAll()) });
pt.addRow(new String[] { "Open cursor across commits", getYesNo(metaData.supportsOpenCursorsAcrossCommit()) });
pt.addRow(new String[] { "Open cursor across rollbacks", getYesNo(metaData.supportsOpenCursorsAcrossRollback()) });
pt.addRow(new String[] { "Open statement across commits", getYesNo(metaData.supportsOpenStatementsAcrossCommit()) });
pt.addRow(new String[] { "Open statement across rollbacks", getYesNo(metaData.supportsOpenStatementsAcrossRollback()) });
pt.addRow(new String[] { "Transactions", getYesNo(metaData.supportsTransactions()) });
pt.addRow(new String[] { "DDL and DML in one transaction", getYesNo(metaData.supportsDataDefinitionAndDataManipulationTransactions()) });
pt.addRow(new String[] { "Only DML in one transaction", getYesNo(metaData.supportsDataManipulationTransactionsOnly()) });
pt.addRow(new String[] { "DDL causes transaction commit", getYesNo(metaData.dataDefinitionCausesTransactionCommit()) });
pt.addRow(new String[] { "DDL ignored in transactions", getYesNo(metaData.dataDefinitionIgnoredInTransactions()) });
pt.addRow(new String[] { "Batch updates", getYesNo(metaData.supportsBatchUpdates()) });
pt.addRow(new String[] { "Save points", getYesNo(metaData.supportsSavepoints()) });
pt.addRow(new String[] { "Named parameters", getYesNo(metaData.supportsNamedParameters()) });
pt.addRow(new String[] { "Multiple open results", getYesNo(metaData.supportsMultipleOpenResults()) });
pt.addRow(new String[] { "Get auto-generated keys", getYesNo(metaData.supportsGetGeneratedKeys()) });
pt.addRow(new String[] { "Statement pooling", getYesNo(metaData.supportsStatementPooling()) });
pt.addRow(new String[] { "SQL Function", getYesNo(metaData.supportsStoredFunctionsUsingCallSyntax()) });
pt.addRow(new String[] { "REF CURSOR", getYesNo(metaData.supportsRefCursors()) });
pt.addRow(new String[] { "Supports Mixed Case Identifiers", getYesNo(metaData.supportsMixedCaseIdentifiers()) });
pt.addRow(new String[] { "Stores Upper Case Identifiers", getYesNo(metaData.storesUpperCaseIdentifiers()) });
pt.addRow(new String[] { "Stores Lower Case Identifiers", getYesNo(metaData.storesLowerCaseIdentifiers()) });
pt.addRow(new String[] { "Stores Mixed Case Identifiers", getYesNo(metaData.storesMixedCaseIdentifiers()) });
pt.addRow(new String[] { "Supports Mixed Case Quoted Identifiers", getYesNo(metaData.supportsMixedCaseQuotedIdentifiers()) });
pt.addRow(new String[] { "Stores Upper Case Quoted Identifiers", getYesNo(metaData.storesUpperCaseQuotedIdentifiers()) });
pt.addRow(new String[] { "Stores Lower Case Quoted Identifiers", getYesNo(metaData.storesLowerCaseQuotedIdentifiers()) });
pt.addRow(new String[] { "Stores Mixed Case Quoted Identifiers", getYesNo(metaData.storesMixedCaseQuotedIdentifiers()) });
} catch (Throwable t) {
interpreter.getGlobals().log(Level.INFO, t);
}
interpreter.print(pt);
}
use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class DriverCommand method listDrivers.
private void listDrivers(JaqyInterpreter interpreter) throws SQLException {
PropertyTable pt = new PropertyTable(new String[] { "Driver", "Version", "Compliant" });
for (Driver driver : DriverManagerUtils.getDrivers()) {
String name;
if (driver instanceof JDBCWrapperDriver) {
name = ((JDBCWrapperDriver) driver).getInternalDriver().getClass().getCanonicalName();
} else {
name = driver.getClass().getCanonicalName();
}
String version = "";
if (driver.getMajorVersion() < 10)
version = " ";
version += driver.getMajorVersion() + "." + driver.getMinorVersion();
String jdbcCompliant = driver.jdbcCompliant() ? "T" : "F";
pt.addRow(new String[] { name, version, jdbcCompliant });
}
interpreter.print(pt);
}
Aggregations