SimpleTextDatabaseMetaDatapublic class SimpleTextDatabaseMetaData extends SimpleTextObject implements DatabaseMetaData
Fields Summary |
---|
protected SimpleTextIConnection | ownerConnection |
Methods Summary |
---|
protected void | add(java.util.Hashtable h, int col, java.lang.String name, int type)
h.put(new Integer(col), new SimpleTextColumn(name,type));
| public boolean | allProceduresAreCallable()
// The SimpleText driver does not support callable statements, so
// none are callable
return false;
| public boolean | allTablesAreSelectable()
// The SimpleText driver allows all tables returned by getTables
// to be selected
return true;
| public boolean | dataDefinitionCausesTransactionCommit()
// The SimpleText driver does not support transactions
return false;
| public boolean | dataDefinitionIgnoredInTransactions()
// The SimpleText driver does not support transactions
return false;
| public boolean | doesMaxRowSizeIncludeBlobs()
return false;
| public java.sql.ResultSet | getBestRowIdentifier(java.lang.String catalog, java.lang.String schema, java.lang.String table, int scope, boolean nullable)
if (traceOn()) {
trace("@getBestRowIdentifier(" + catalog + ", " + schema + ", " +
table + ", " + scope + ", " + nullable + ")");
}
// The SimpleText driver does not support row identifiers. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "SCOPE", Types.SMALLINT);
add(columns, 2, "COLUMN_NAME", Types.VARCHAR);
add(columns, 3, "DATA_TYPE", Types.SMALLINT);
add(columns, 4, "TYPE_NAME", Types.VARCHAR);
add(columns, 5, "COLUMN_SIZE", Types.INTEGER);
add(columns, 6, "BUFFER_LENGTH", Types.INTEGER);
add(columns, 7, "DECIMAL_DIGITS", Types.SMALLINT);
add(columns, 8, "PSEUDO_COLUMN", Types.SMALLINT);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getCatalogSeparator()
// The SimpleText driver supports specifying fully qualified
// file names, so the catalog separator is the directory
// separator
return "/";
| public java.lang.String | getCatalogTerm()
return "CATALOG";
| public java.sql.ResultSet | getCatalogs()
if (traceOn()) {
trace("@getCatalogs");
}
// The SimpleText driver only supports one catalog - the current
// directory for the connection
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create a Hashtable for a single row
Hashtable singleRow = new Hashtable();
// Set the value for column 1, which is the directory for the
// connection
singleRow.put (new Integer(1),
new CommonValue(ownerConnection.getDirectory(null)));
rows.put (new Integer(1), singleRow);
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getColumnPrivileges(java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String columnNamePattern)
if (traceOn()) {
trace("@getColumnPrivileges(" + catalog + ", " + schema + ", " +
table + ", " + columnNamePattern + ")");
}
// The SimpleText driver does not support column privileges. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
add(columns, 2, "TABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "TABLE_NAME", Types.VARCHAR);
add(columns, 4, "COLUMN_NAME", Types.VARCHAR);
add(columns, 5, "GRANTOR", Types.VARCHAR);
add(columns, 6, "GRANTEE", Types.VARCHAR);
add(columns, 7, "PRIVILEGE", Types.VARCHAR);
add(columns, 8, "IS_GRANTABLE", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String columnNamePattern)
if (traceOn()) {
trace("@getColumns(" + catalog + ", " + schemaPattern +
", " + tableNamePattern + ", " + columnNamePattern + ")");
}
// Create a statement object
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
add(columns, 2, "TABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "TABLE_NAME", Types.VARCHAR);
add(columns, 4, "COLUMN_NAME", Types.VARCHAR);
add(columns, 5, "DATA_TYPE", Types.SMALLINT);
add(columns, 6, "TYPE_NAME", Types.VARCHAR);
add(columns, 7, "COLUMN_SIZE", Types.INTEGER);
add(columns, 8, "BUFFER_LENGTH", Types.INTEGER);
add(columns, 9, "DECIMAL_DIGITS", Types.INTEGER);
add(columns, 10, "NUM_PREC_RADIX", Types.INTEGER);
add(columns, 11, "NULLABLE", Types.INTEGER);
add(columns, 12, "REMARKS", Types.VARCHAR);
add(columns, 13, "COLUMN_DEF", Types.VARCHAR);
add(columns, 14, "SQL_DATA_TYPE", Types.INTEGER);
add(columns, 15, "SQL_DATETIME_SUB", Types.INTEGER);
add(columns, 16, "CHAR_OCTET_LENGTH", Types.INTEGER);
add(columns, 17, "ORDINAL_POSITION", Types.INTEGER);
add(columns, 18, "IS_NULLABLE", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Get a Hashtable will all tables
Hashtable tables = ownerConnection.getTables(
ownerConnection.getDirectory(catalog), tableNamePattern);
Hashtable singleRow;
Hashtable columnList;
SimpleTextTable table;
SimpleTextColumn column;
int count = 0;
// Create a row for each column in each table in the Hashtable
for (int i = 0; i < tables.size(); i++) {
table = (SimpleTextTable) tables.get(new Integer(i));
// Get the columns
columnList = ownerConnection.getColumns(table.dir, table.name);
if (columnList == null) {
continue;
}
for (int ii = 1; ii <= columnList.size(); ii++) {
column = (SimpleTextColumn) columnList.get(new Integer(ii));
// Create a new Hashtable for a single row
singleRow = new Hashtable();
// Build the row
singleRow.put(new Integer(1), new CommonValue(table.dir));
singleRow.put(new Integer(3), new CommonValue(table.name));
singleRow.put(new Integer(4), new CommonValue(column.name));
singleRow.put(new Integer(5), new CommonValue(column.type));
singleRow.put(new Integer(6),
new CommonValue(typeToName(column.type)));
singleRow.put(new Integer(7),
new CommonValue(column.precision));
// Add it to the row list (column numbers are 1-based)
count++;
rows.put(new Integer(count), singleRow);
}
}
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getCrossReference(java.lang.String primaryCatalog, java.lang.String primarySchema, java.lang.String primaryTable, java.lang.String foreignCatalog, java.lang.String foreignSchema, java.lang.String foreignTable)
if (traceOn()) {
trace("@getCrossReference(" + primaryCatalog + ", " +
primarySchema + ", " + primaryTable + ", " +
foreignCatalog + ", " + foreignSchema + ", " +
foreignTable + ")");
}
// The SimpleText driver does not support indexes. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "PKTABLE_CAT", Types.VARCHAR);
add(columns, 2, "PKTABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "PKTABLE_NAME", Types.VARCHAR);
add(columns, 4, "PKCOLUMN_NAME", Types.VARCHAR);
add(columns, 5, "FKTABLE_CAT", Types.VARCHAR);
add(columns, 6, "FKTABLE_SCHEM", Types.VARCHAR);
add(columns, 7, "FKTABLE_NAME", Types.VARCHAR);
add(columns, 8, "FKCOLUMN_NAME", Types.VARCHAR);
add(columns, 9, "KEY_SEQ", Types.SMALLINT);
add(columns, 10, "UPDATE_RULE", Types.SMALLINT);
add(columns, 11, "DELETE_RULE", Types.SMALLINT);
add(columns, 12, "FK_NAME", Types.VARCHAR);
add(columns, 13, "PK_NAME", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getDatabaseProductName()
return "Simple Text JDBC Driver";
| public java.lang.String | getDatabaseProductVersion()
return "1.00";
| public int | getDefaultTransactionIsolation()
// The SimpleText driver does not support transactions
return Connection.TRANSACTION_NONE;
| public int | getDriverMajorVersion()
return SimpleTextDefine.MAJOR_VERSION;
| public int | getDriverMinorVersion()
return SimpleTextDefine.MINOR_VERSION;
| public java.lang.String | getDriverName()
return "SimpleText";
| public java.lang.String | getDriverVersion()
String s = "";
int minorVersion = getDriverMinorVersion();
// Format the minor version to have 4 places, with leading 0's
if (minorVersion < 1000) s += "0";
if (minorVersion < 100) s += "0";
if (minorVersion < 10) s += "0";
s += "" + minorVersion;
return "" + getDriverMajorVersion() + "." + s;
| public java.sql.ResultSet | getExportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
if (traceOn()) {
trace("@getExportedKeys(" + catalog + ", " + schema + ", " +
table + ")");
}
// The SimpleText driver does not support indexes. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "PKTABLE_CAT", Types.VARCHAR);
add(columns, 2, "PKTABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "PKTABLE_NAME", Types.VARCHAR);
add(columns, 4, "PKCOLUMN_NAME", Types.VARCHAR);
add(columns, 5, "FKTABLE_CAT", Types.VARCHAR);
add(columns, 6, "FKTABLE_SCHEM", Types.VARCHAR);
add(columns, 7, "FKTABLE_NAME", Types.VARCHAR);
add(columns, 8, "FKCOLUMN_NAME", Types.VARCHAR);
add(columns, 9, "KEY_SEQ", Types.SMALLINT);
add(columns, 10, "UPDATE_RULE", Types.SMALLINT);
add(columns, 11, "DELETE_RULE", Types.SMALLINT);
add(columns, 12, "FK_NAME", Types.VARCHAR);
add(columns, 13, "PK_NAME", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getExtraNameCharacters()
// The SimpleText driver does not allow any special characters
// in indentifier names
return "";
| public java.lang.String | getIdentifierQuoteString()
// The SimpleText driver does not support quoting
return " ";
| public java.sql.ResultSet | getImportedKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
if (traceOn()) {
trace("@getImportedKeys(" + catalog + ", " + schema + ", " +
table + ")");
}
// The SimpleText driver does not support indexes. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "PKTABLE_CAT", Types.VARCHAR);
add(columns, 2, "PKTABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "PKTABLE_NAME", Types.VARCHAR);
add(columns, 4, "PKCOLUMN_NAME", Types.VARCHAR);
add(columns, 5, "FKTABLE_CAT", Types.VARCHAR);
add(columns, 6, "FKTABLE_SCHEM", Types.VARCHAR);
add(columns, 7, "FKTABLE_NAME", Types.VARCHAR);
add(columns, 8, "FKCOLUMN_NAME", Types.VARCHAR);
add(columns, 9, "KEY_SEQ", Types.SMALLINT);
add(columns, 10, "UPDATE_RULE", Types.SMALLINT);
add(columns, 11, "DELETE_RULE", Types.SMALLINT);
add(columns, 12, "FK_NAME", Types.VARCHAR);
add(columns, 13, "PK_NAME", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getIndexInfo(java.lang.String catalog, java.lang.String schema, java.lang.String table, boolean unique, boolean approximate)
if (traceOn()) {
trace("@getIndexInfo(" + catalog + ", " + schema + ", " +
table + ", " + unique + ", " + approximate + ")");
}
// The SimpleText driver does not support indexes. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
add(columns, 2, "TABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "TABLE_NAME", Types.VARCHAR);
add(columns, 4, "NON_UNIQUE", Types.BIT);
add(columns, 5, "INDEX_CAT", Types.VARCHAR);
add(columns, 6, "INDEX_NAME", Types.VARCHAR);
add(columns, 7, "TYPE", Types.SMALLINT);
add(columns, 8, "ORDINAL_POSITION", Types.SMALLINT);
add(columns, 9, "COLUMN_NAME", Types.VARCHAR);
add(columns, 10, "ASC_OR_DESC", Types.VARCHAR);
add(columns, 11, "CARDINALITY", Types.INTEGER);
add(columns, 12, "PAGES", Types.INTEGER);
add(columns, 13, "FILTER_CONDITION", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public int | getMaxBinaryLiteralLength()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxCatalogNameLength()
return SimpleTextDefine.MAX_CATALOG_NAME_LEN;
| public int | getMaxCharLiteralLength()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxColumnNameLength()
return SimpleTextDefine.MAX_COLUMN_NAME_LEN;
| public int | getMaxColumnsInGroupBy()
// The SimpleText driver does not support GROUP BY
return 0;
| public int | getMaxColumnsInIndex()
// The SimpleText driver does not support indexes
return 0;
| public int | getMaxColumnsInOrderBy()
// The SimpleText driver does not support ORDER BY
return 0;
| public int | getMaxColumnsInSelect()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxColumnsInTable()
return SimpleTextDefine.MAX_COLUMNS_IN_TABLE;
| public int | getMaxConnections()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxCursorNameLength()
// The SimpleText driver does not support named cursors
return 0;
| public int | getMaxIndexLength()
// The SimpleText driver does not support indexes
return 0;
| public int | getMaxProcedureNameLength()
// The SimpleText driver does not support stored procedures
return 0;
| public int | getMaxRowSize()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxSchemaNameLength()
// The SimpleText driver does not support schemas
return 0;
| public int | getMaxStatementLength()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxStatements()
// The SimpleText driver does not have a limit. 0 indicates no
// limit, or the limit is not known.
return 0;
| public int | getMaxTableNameLength()
return SimpleTextDefine.MAX_TABLE_NAME_LEN;
| public int | getMaxTablesInSelect()
// The SimpleText driver does not support joins, so only 1 table
// is allowed to be specified in a SELECT statement
return 1;
| public int | getMaxUserNameLength()
// The SimpleText driver does not support users
return 0;
| public java.lang.String | getNumericFunctions()
// The SimpleText driver does not support any math functions
return "";
| public java.sql.ResultSet | getPrimaryKeys(java.lang.String catalog, java.lang.String schema, java.lang.String table)
if (traceOn()) {
trace("@getPrimaryKeys(" + catalog + ", " + schema + ", " +
table + ")");
}
// The SimpleText driver does not support indexes. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
add(columns, 2, "TABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "TABLE_NAME", Types.VARCHAR);
add(columns, 4, "COLUMN_NAME", Types.VARCHAR);
add(columns, 5, "KEY_SEQ", Types.SMALLINT);
add(columns, 6, "PK_NAME", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getProcedureColumns(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern, java.lang.String columnNamePattern)
if (traceOn()) {
trace("@getProcedureColumns(" + catalog + ", " + schemaPattern +
", " + procedureNamePattern + ", " +
columnNamePattern + ")");
}
// The SimpleText driver does not support procedures. Instead of
// throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "PROCEDURE_CAT", Types.VARCHAR);
add(columns, 2, "PROCEDURE_SCHEM", Types.VARCHAR);
add(columns, 3, "PROCEDURE_NAME", Types.VARCHAR);
add(columns, 4, "COLUMN_NAME", Types.VARCHAR);
add(columns, 5, "COLUMN_TYPE", Types.SMALLINT);
add(columns, 6, "DATA_TYPE", Types.SMALLINT);
add(columns, 7, "TYPE_NAME", Types.VARCHAR);
add(columns, 8, "PRECISION", Types.INTEGER);
add(columns, 9, "LENGTH", Types.INTEGER);
add(columns, 10, "LENGTH", Types.SMALLINT);
add(columns, 11, "RADIX", Types.SMALLINT);
add(columns, 12, "NULLABLE", Types.SMALLINT);
add(columns, 13, "REMARKS", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getProcedureTerm()
return "PROCEDURE";
| public java.sql.ResultSet | getProcedures(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String procedureNamePattern)
if (traceOn()) {
trace("@getProcedures(" + catalog + ", " + schemaPattern + ", " +
procedureNamePattern + ")");
}
// The SimpleText driver does not support procedures. Instead of
// throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "PROCEDURE_CAT", Types.VARCHAR);
add(columns, 2, "PROCEDURE_SCHEM", Types.VARCHAR);
add(columns, 3, "PROCEDURE_NAME", Types.VARCHAR);
add(columns, 4, "REMARKS", Types.VARCHAR);
add(columns, 5, "PROCEDURE_TYPE", Types.SMALLINT);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getSQLKeywords()
return "";
| public java.lang.String | getSchemaTerm()
return "SCHEMA";
| public java.sql.ResultSet | getSchemas()
if (traceOn()) {
trace("@getSchemas");
}
// The SimpleText driver does not support schemas. Instead of
// throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_SCHEM", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getSearchStringEscape()
// The SimpleText driver does not support search patterns, so
// return an empty string
return "";
| public java.lang.String | getStringFunctions()
// The SimpleText driver does not support any String functions
return "";
| public java.lang.String | getSystemFunctions()
// The SimpleText driver does not support any System functions
return "";
| public java.sql.ResultSet | getTablePrivileges(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern)
if (traceOn()) {
trace("@getTablePrivileges(" + catalog + ", " + schemaPattern +
", " + tableNamePattern + ")");
}
// The SimpleText driver does not support table privileges. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
add(columns, 2, "TABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "TABLE_NAME", Types.VARCHAR);
add(columns, 4, "COLUMN_NAME", Types.VARCHAR);
add(columns, 5, "GRANTOR", Types.VARCHAR);
add(columns, 6, "GRANTEE", Types.VARCHAR);
add(columns, 7, "PRIVILEGE", Types.VARCHAR);
add(columns, 8, "IS_GRANTABLE", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getTableTypes()
if (traceOn()) {
trace("@getTableTypes");
}
// The SimpleText driver only supports one table type - TABLE
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_TYPE", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create a Hashtable for a single row
Hashtable singleRow = new Hashtable();
// Set the value for column 1, which is the only table type - TABLE
singleRow.put (new Integer(1), new CommonValue("TABLE"));
rows.put (new Integer(1), singleRow);
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.sql.ResultSet | getTables(java.lang.String catalog, java.lang.String schemaPattern, java.lang.String tableNamePattern, java.lang.String[] types)
if (traceOn()) {
trace("@getTables(" + catalog + ", " + schemaPattern +
", " + tableNamePattern + ")");
}
// Create a statement object
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TABLE_CAT", Types.VARCHAR);
add(columns, 2, "TABLE_SCHEM", Types.VARCHAR);
add(columns, 3, "TABLE_NAME", Types.VARCHAR);
add(columns, 4, "TABLE_TYPE", Types.VARCHAR);
add(columns, 5, "REMARKS", Types.VARCHAR);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// If any of the parameters will return an empty result set, do so
boolean willBeEmpty = false;
// If table types are specified, make sure that 'TABLE' is
// included. If not, no rows will be returned
if (types != null) {
willBeEmpty = true;
for (int ii = 0; ii < types.length; ii++) {
if (types[ii].equalsIgnoreCase("TABLE")) {
willBeEmpty = false;
break;
}
}
}
if (!willBeEmpty) {
// Get a Hashtable will all tables
Hashtable tables = ownerConnection.getTables(
ownerConnection.getDirectory(catalog), tableNamePattern);
Hashtable singleRow;
SimpleTextTable table;
// Create a row for each table in the Hashtable
for (int i = 0; i < tables.size(); i++) {
table = (SimpleTextTable) tables.get(new Integer(i));
// Create a new Hashtable for a single row
singleRow = new Hashtable();
// Build the row
singleRow.put(new Integer(1), new CommonValue(table.dir));
singleRow.put(new Integer(3), new CommonValue(table.name));
singleRow.put(new Integer(4), new CommonValue("TABLE"));
// Add it to the row list
rows.put(new Integer(i + 1), singleRow);
}
}
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getTimeDateFunctions()
// The SimpleText driver does not support any Time or Date functions
return "";
| public java.sql.ResultSet | getTypeInfo()
if (traceOn()) {
trace("@getTableTypes");
}
// The SimpleText driver only supports the following data types:
//
// VARCHAR
// INTEGER
// VARBINARY
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "TYPE_NAME", Types.VARCHAR);
add(columns, 2, "DATA_TYPE", Types.SMALLINT);
add(columns, 3, "PRECISION", Types.INTEGER);
add(columns, 4, "LITERAL_PREFIX", Types.VARCHAR);
add(columns, 5, "LITERAL_SUFFIX", Types.VARCHAR);
add(columns, 6, "CREATE_PARAMS", Types.VARCHAR);
add(columns, 7, "NULLABLE", Types.SMALLINT);
add(columns, 8, "CASE_SENSITIVE", Types.BIT);
add(columns, 9, "SEARCHABLE", Types.SMALLINT);
add(columns, 10, "UNSIGNED_ATTRIBUTE", Types.BIT);
add(columns, 11, "FIXED_PREC_SCALE", Types.BIT);
add(columns, 12, "AUTO_INCREMENT", Types.BIT);
add(columns, 13, "LOCAL_TYPE_NAME", Types.VARCHAR);
add(columns, 14, "MINIMUM_SCALE", Types.SMALLINT);
add(columns, 15, "MAXIMUM_SCALE", Types.SMALLINT);
add(columns, 16, "SQL_DATA_TYPE", Types.INTEGER);
add(columns, 17, "SQL_DATETIME_SUB", Types.INTEGER);
add(columns, 18, "NUM_PREC_RADIX", Types.INTEGER);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create a Hashtable for a single row
Hashtable singleRow;
// Create the VARCHAR entry
singleRow = new Hashtable();
singleRow.put(new Integer(1),
new CommonValue(typeToName(Types.VARCHAR)));
singleRow.put(new Integer(2), new CommonValue(Types.VARCHAR));
singleRow.put(new Integer(3),
new CommonValue(SimpleTextDefine.MAX_VARCHAR_LEN));
singleRow.put(new Integer(4), new CommonValue("'"));
singleRow.put(new Integer(5), new CommonValue("'"));
singleRow.put(new Integer(7), new CommonValue(typeNoNulls));
singleRow.put(new Integer(9), new CommonValue(typePredBasic));
singleRow.put(new Integer(13),
new CommonValue(typeToName(Types.VARCHAR)));
rows.put (new Integer(1), singleRow);
// Create the INTEGER entry
singleRow = new Hashtable();
singleRow.put(new Integer(1),
new CommonValue(typeToName(Types.INTEGER)));
singleRow.put(new Integer(2), new CommonValue(Types.INTEGER));
singleRow.put(new Integer(3),
new CommonValue(SimpleTextDefine.MAX_INTEGER_LEN));
singleRow.put(new Integer(7), new CommonValue(typeNoNulls));
singleRow.put(new Integer(9), new CommonValue(typePredBasic));
singleRow.put(new Integer(13),
new CommonValue(typeToName(Types.INTEGER)));
rows.put (new Integer(2), singleRow);
// Create the VARBINARY entry
singleRow = new Hashtable();
singleRow.put(new Integer(1),
new CommonValue(typeToName(Types.VARBINARY)));
singleRow.put(new Integer(2), new CommonValue(Types.VARBINARY));
singleRow.put(new Integer(3),
new CommonValue(SimpleTextDefine.MAX_VARBINARY_LEN));
singleRow.put(new Integer(4), new CommonValue("'"));
singleRow.put(new Integer(5), new CommonValue("'"));
singleRow.put(new Integer(7), new CommonValue(typeNoNulls));
singleRow.put(new Integer(9), new CommonValue(typePredNone));
singleRow.put(new Integer(13),
new CommonValue(typeToName(Types.VARBINARY)));
rows.put (new Integer(3), singleRow);
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public java.lang.String | getURL()
// Can't generate a URL
return null;
| public java.lang.String | getUserName()
// The SimpleText driver does not support user names
return "";
| public java.sql.ResultSet | getVersionColumns(java.lang.String catalog, java.lang.String schema, java.lang.String table)
if (traceOn()) {
trace("@getVersionColumns(" + catalog + ", " + schema + ", " +
table + ")");
}
// The SimpleText driver does not support version columns. Instead
// of throwing a 'Driver not capable' SQLException, we'll be
// graceful and return an empty result set
SimpleTextStatement stmt =
(SimpleTextStatement) ownerConnection.createStatement();
// Create a Hashtable for all of the columns
Hashtable columns = new Hashtable();
add(columns, 1, "SCOPE", Types.SMALLINT);
add(columns, 2, "COLUMN_NAME", Types.VARCHAR);
add(columns, 3, "DATA_TYPE", Types.SMALLINT);
add(columns, 4, "TYPE_NAME", Types.VARCHAR);
add(columns, 5, "COLUMN_SIZE", Types.INTEGER);
add(columns, 6, "BUFFER_LENGTH", Types.INTEGER);
add(columns, 7, "DECIMAL_DIGITS", Types.SMALLINT);
add(columns, 8, "PSEUDO_COLUMN", Types.SMALLINT);
// Create an empty Hashtable for the rows
Hashtable rows = new Hashtable();
// Create the ResultSet object and return it
SimpleTextResultSet rs = new SimpleTextResultSet();
rs.initialize(stmt, columns, rows);
return rs;
| public void | initialize(SimpleTextIConnection con)
// Save the owning connection object
ownerConnection = con;
| public boolean | isCatalogAtStart()
// The SimpleText driver supports specifying fully qualified
// file names, so the catalog (directory) is specified first
return true;
| public boolean | isReadOnly()
return ownerConnection.isReadOnly();
| public boolean | nullPlusNonNullIsNull()
// The SimpleText driver does not support nulls
return false;
| public boolean | nullsAreSortedAtEnd()
// The SimpleText driver does not support nulls (or sorting, for
// that matter)
return false;
| public boolean | nullsAreSortedAtStart()
// The SimpleText driver does not support nulls (or sorting, for
// that matter)
return false;
| public boolean | nullsAreSortedHigh()
// The SimpleText driver does not support nulls (or sorting, for
// that matter)
return false;
| public boolean | nullsAreSortedLow()
// The SimpleText driver does not support nulls (or sorting, for
// that matter)
return false;
| public boolean | storesLowerCaseIdentifiers()
return false;
| public boolean | storesLowerCaseQuotedIdentifiers()
return false;
| public boolean | storesMixedCaseIdentifiers()
return false;
| public boolean | storesMixedCaseQuotedIdentifiers()
return false;
| public boolean | storesUpperCaseIdentifiers()
return true;
| public boolean | storesUpperCaseQuotedIdentifiers()
return true;
| public boolean | supportsANSI92EntryLevelSQL()
// The SimpleText driver does not even support the most minimum
// SQL grammar
return false;
| public boolean | supportsANSI92FullSQL()
// The SimpleText driver does not even support the most minimum
// SQL grammar
return false;
| public boolean | supportsANSI92IntermediateSQL()
// The SimpleText driver does not even support the most minimum
// SQL grammar
return false;
| public boolean | supportsAlterTableWithAddColumn()
// The SimpleText driver does not support ALTER TABLE at all
return false;
| public boolean | supportsAlterTableWithDropColumn()
// The SimpleText driver does not support ALTER TABLE at all
return false;
| public boolean | supportsCatalogsInDataManipulation()
// The SimpleText driver does support catalogs (path names)
return true;
| public boolean | supportsCatalogsInIndexDefinitions()
// The SimpleText driver does not support indexes
return false;
| public boolean | supportsCatalogsInPrivilegeDefinitions()
// The SimpleText driver does not support privileges
return false;
| public boolean | supportsCatalogsInProcedureCalls()
// The SimpleText driver does not support stored procedures
return false;
| public boolean | supportsCatalogsInTableDefinitions()
// The SimpleText driver does support catalogs (path names)
return true;
| public boolean | supportsColumnAliasing()
// The SimpleText driver does not support column alias names
return false;
| public boolean | supportsConvert()
// The SimpleText driver does not support the CONVERT function
return false;
| public boolean | supportsConvert(int fromType, int toType)
// The SimpleText driver does not support the CONVERT function
return false;
| public boolean | supportsCoreSQLGrammar()
// The SimpleText driver does not even support the most minimum
// SQL grammar
return false;
| public boolean | supportsCorrelatedSubqueries()
// The SimpleText driver does not support subqueries
return false;
| public boolean | supportsDataDefinitionAndDataManipulationTransactions()
// The SimpleText driver does not support transactions
return false;
| public boolean | supportsDataManipulationTransactionsOnly()
// The SimpleText driver does not support transactions
return false;
| public boolean | supportsDifferentTableCorrelationNames()
// The SimpleText driver does not support table correlation names
return false;
| public boolean | supportsExpressionsInOrderBy()
// The SimpleText driver does not support ORDER BY
return false;
| public boolean | supportsExtendedSQLGrammar()
// The SimpleText driver does not even support the most minimum
// SQL grammar
return false;
| public boolean | supportsFullOuterJoins()
// The SimpleText driver does not support outer joins
return false;
| public boolean | supportsGroupBy()
// The SimpleText driver does not support GROUP BY
return false;
| public boolean | supportsGroupByBeyondSelect()
// The SimpleText driver does not support GROUP BY
return false;
| public boolean | supportsGroupByUnrelated()
// The SimpleText driver does not support GROUP BY
return false;
| public boolean | supportsIntegrityEnhancementFacility()
// The SimpleText driver does support referential integrity
return false;
| public boolean | supportsLikeEscapeClause()
// The SimpleText driver does not support the LIKE clause
return false;
| public boolean | supportsLimitedOuterJoins()
// The SimpleText driver does not support outer joins
return false;
| public boolean | supportsMinimumSQLGrammar()
// The SimpleText driver does not even support the most minimum
// SQL grammar
return false;
| public boolean | supportsMixedCaseIdentifiers()
return true;
| public boolean | supportsMixedCaseQuotedIdentifiers()
return true;
| public boolean | supportsMultipleResultSets()
// The SimpleText driver does not support multiple result sets
return false;
| public boolean | supportsMultipleTransactions()
// The SimpleText driver does not support transactions
return false;
| public boolean | supportsNonNullableColumns()
// The SimpleText driver does not support nulls, so all columns by
// default are non-nullable. This, however, specifies whether the
// column can be defined as NON NULL in the DDL (Data Definition
// Language) statement, which is not supported.
return false;
| public boolean | supportsOpenCursorsAcrossCommit()
// The SimpleText driver does not support transactions; it is
// always in auto-commit mode. The cursor remains open after
// a transaction is auto-committed
return true;
| public boolean | supportsOpenCursorsAcrossRollback()
// The SimpleText driver does not support transactions; it is
// always in auto-commit mode. The cursor remains open after
// a transaction is auto-committed. A rollback has no effect.
return true;
| public boolean | supportsOpenStatementsAcrossCommit()
// The SimpleText driver does not support transactions; it is
// always in auto-commit mode. The statement remains open after
// a transaction is auto-committed
return true;
| public boolean | supportsOpenStatementsAcrossRollback()
// The SimpleText driver does not support transactions; it is
// always in auto-commit mode. The statement remains open after
// a transaction is auto-committed. A rollback has no effect.
return true;
| public boolean | supportsOrderByUnrelated()
// The SimpleText driver does not support ORDER BY
return false;
| public boolean | supportsOuterJoins()
// The SimpleText driver does not support outer joins
return false;
| public boolean | supportsPositionedDelete()
// The SimpleText driver does not support positioned deletes
return false;
| public boolean | supportsPositionedUpdate()
// The SimpleText driver does not support positioned updates
return false;
| public boolean | supportsSchemasInDataManipulation()
// The SimpleText driver does not support schemas
return false;
| public boolean | supportsSchemasInIndexDefinitions()
// The SimpleText driver does not support schemas
return false;
| public boolean | supportsSchemasInPrivilegeDefinitions()
// The SimpleText driver does not support schemas
return false;
| public boolean | supportsSchemasInProcedureCalls()
// The SimpleText driver does not support schemas
return false;
| public boolean | supportsSchemasInTableDefinitions()
// The SimpleText driver does not support schemas
return false;
| public boolean | supportsSelectForUpdate()
// The SimpleText driver does not support the FOR UPDATE clause
return false;
| public boolean | supportsStoredProcedures()
// The SimpleText driver does not support stored procedures
return false;
| public boolean | supportsSubqueriesInComparisons()
// The SimpleText driver does not support subqueries
return false;
| public boolean | supportsSubqueriesInExists()
// The SimpleText driver does not support subqueries
return false;
| public boolean | supportsSubqueriesInIns()
// The SimpleText driver does not support subqueries
return false;
| public boolean | supportsSubqueriesInQuantifieds()
// The SimpleText driver does not support subqueries
return false;
| public boolean | supportsTableCorrelationNames()
// The SimpleText driver does not support table correlation names
return false;
| public boolean | supportsTransactionIsolationLevel(int level)
// The SimpleText driver does not support transaction. Return
// false for any level except for TRANSACTION_NONE
boolean rc = false;
if (level == Connection.TRANSACTION_NONE) {
rc = true;
}
return rc;
| public boolean | supportsTransactions()
// The SimpleText driver does not support transactions
return false;
| public boolean | supportsUnion()
// The SimpleText driver does not support unions
return false;
| public boolean | supportsUnionAll()
// The SimpleText driver does not support unions
return false;
| protected java.lang.String | typeToName(int type)
String s = "";
switch(type) {
case Types.VARCHAR:
s = "VARCHAR";
break;
case Types.INTEGER:
s = "INTEGER";
break;
case Types.VARBINARY:
s = "BINARY";
break;
}
return s;
| public boolean | usesLocalFilePerTable()
// The SimpleText driver uses a file for each table
return true;
| public boolean | usesLocalFiles()
// The SimpleText driver stores all database data in files
return true;
|
|