use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class InfoCommand method listLimits.
private void listLimits(JaqyInterpreter interpreter, DatabaseMetaData metaData, JaqyHelper helper) throws SQLException {
PropertyTable pt = new PropertyTable(new String[] { "Name", "Limit" });
try {
pt.addRow(new String[] { "Max binary literal length", getNumberString(metaData.getMaxBinaryLiteralLength()) });
pt.addRow(new String[] { "Max character literal length", getNumberString(metaData.getMaxCharLiteralLength()) });
pt.addRow(new String[] { "Max column name length", getNumberString(metaData.getMaxColumnNameLength()) });
pt.addRow(new String[] { "Max columns in GROUP BY", getNumberString(metaData.getMaxColumnsInGroupBy()) });
pt.addRow(new String[] { "Max columns in an index", getNumberString(metaData.getMaxColumnsInIndex()) });
pt.addRow(new String[] { "Max columns in ORDER BY", getNumberString(metaData.getMaxColumnsInOrderBy()) });
pt.addRow(new String[] { "Max columns in SELECT", getNumberString(metaData.getMaxColumnsInSelect()) });
pt.addRow(new String[] { "Max columns in a table", getNumberString(metaData.getMaxColumnsInTable()) });
pt.addRow(new String[] { "Max connections", getNumberString(metaData.getMaxConnections()) });
pt.addRow(new String[] { "Max cursor name length", getNumberString(metaData.getMaxCursorNameLength()) });
pt.addRow(new String[] { "Max index length", getNumberString(metaData.getMaxIndexLength()) });
pt.addRow(new String[] { "Max schema name length", getNumberString(metaData.getMaxSchemaNameLength()) });
pt.addRow(new String[] { "Max procedure name length", getNumberString(metaData.getMaxProcedureNameLength()) });
pt.addRow(new String[] { "Max catalog name length", getNumberString(metaData.getMaxCatalogNameLength()) });
pt.addRow(new String[] { "Max row size", getNumberString(metaData.getMaxRowSize()) });
pt.addRow(new String[] { "Max row size include BLOB", getYesNo(metaData.doesMaxRowSizeIncludeBlobs()) });
pt.addRow(new String[] { "Max statement length", getNumberString(metaData.getMaxStatementLength()) });
pt.addRow(new String[] { "Max statements", getNumberString(metaData.getMaxStatements()) });
pt.addRow(new String[] { "Max table name length", getNumberString(metaData.getMaxTableNameLength()) });
pt.addRow(new String[] { "Max tables in SELECT", getNumberString(metaData.getMaxTablesInSelect()) });
pt.addRow(new String[] { "Max user name length", getNumberString(metaData.getMaxUserNameLength()) });
pt.addRow(new String[] { "Max logical LOB size", getNumberString(metaData.getMaxLogicalLobSize()) });
} 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 listServer.
private void listServer(JaqyInterpreter interpreter, DatabaseMetaData metaData, JaqyHelper helper) throws SQLException {
PropertyTable pt = new PropertyTable(new String[] { "Name", "Value" });
try {
pt.addRow(new String[] { "User", metaData.getUserName() });
pt.addRow(new String[] { "URL", metaData.getURL() });
pt.addRow(new String[] { "Ready only", getYesNo(metaData.isReadOnly()) });
pt.addRow(new String[] { "Database product name", metaData.getDatabaseProductName() });
pt.addRow(new String[] { "Database product version", metaData.getDatabaseProductVersion() });
pt.addRow(new String[] { "Database major version", "" + metaData.getDatabaseMajorVersion() });
pt.addRow(new String[] { "Database major version", "" + metaData.getDatabaseMinorVersion() });
pt.addRow(new String[] { "Driver name", metaData.getDriverName() });
pt.addRow(new String[] { "Driver version", metaData.getDriverVersion() });
pt.addRow(new String[] { "JDBC major version", "" + metaData.getJDBCMajorVersion() });
pt.addRow(new String[] { "JDBC minor version", "" + metaData.getJDBCMinorVersion() });
} 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 ProtocolCommand method execute.
@Override
public void execute(String[] args, boolean silent, JaqyInterpreter interpreter) throws Exception {
JaqyDriverManager driverManager = interpreter.getGlobals().getDriverManager();
if (args.length == 0) {
PropertyTable pt = PropertyTableUtils.createPropertyTable(driverManager.getDriverProtocolMap(), new String[] { "Protocol", "Driver" });
interpreter.print(pt);
return;
}
if (args.length != 2) {
interpreter.error("invalid command arguments.");
}
driverManager.addDriverProtocol(args[0], args[1]);
}
use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class EnvCommand method execute.
@Override
public void execute(String[] args, boolean silent, JaqyInterpreter interpreter) throws Exception {
PropertyTable pt = new PropertyTable(new String[] { "Key", "Value" });
TreeMap<String, String> tree = new TreeMap<String, String>();
// Get system environments
// {
// Map<String, String> env = System.getenv ();
// tree.putAll (env);
// }
// Get JVM properties
{
Properties prop = System.getProperties();
for (Enumeration<?> e = prop.propertyNames(); e.hasMoreElements(); ) {
String key = (String) e.nextElement();
String value = prop.getProperty(key);
tree.put(key, value);
}
}
// Print
for (Map.Entry<String, String> entry : tree.entrySet()) {
pt.addRow(new String[] { entry.getKey(), entry.getValue() });
}
interpreter.print(pt);
}
use of com.teradata.jaqy.PropertyTable in project jaqy by Teradata.
the class DefaultHelper method getTableColumns.
@Override
public JaqyResultSet getTableColumns(String tableName, JaqyInterpreter interpreter) throws Exception {
if (m_tableColumnFormat != null) {
JaqyResultSet rs = interpreter.getResultSet(m_tableColumnFormat.format(new Object[] { tableName }));
if (rs == null)
throw ExceptionUtils.getTableNotFound();
InMemoryResultSet inmemrs = (InMemoryResultSet) rs.getResultSet();
if (inmemrs.getRows().size() == 0)
throw ExceptionUtils.getTableNotFound();
return rs;
}
String query = "SELECT * FROM " + tableName + " WHERE 1 = 0";
JaqyStatement stmt = null;
try {
stmt = createStatement(true);
stmt.execute(query);
JaqyResultSet rs = stmt.getResultSet(interpreter);
if (rs == null)
throw ExceptionUtils.getTableNotFound();
JaqyResultSetMetaData meta = rs.getMetaData();
SchemaInfo schemaInfo = ResultSetMetaDataUtils.getColumnInfo(meta.getMetaData(), null);
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 = getTypeName(schemaInfo.columns[i]);
String nullable = (schemaInfo.columns[i].nullable == ResultSetMetaData.columnNoNulls) ? "No" : (schemaInfo.columns[i].nullable == ResultSetMetaData.columnNullable ? "Yes" : "Unknown");
pt.addRow(new String[] { columnName, columnType, nullable });
}
rs.close();
return ResultSetUtils.getResultSet(pt);
} finally {
try {
stmt.close();
} catch (Exception ex) {
}
}
}
Aggregations