| java.lang.Object jimm.datavision.source.DataSource jimm.datavision.source.sql.Database
All known Subclasses: jimm.datavision.source.sql.SubreportDatabase,
Database | public class Database extends DataSource (Code) | | A database knows about the tables in a database.
author: Jim Menard, jimm@io.com |
Constructor Summary | |
public | Database(Connection conn, Report report) | public | Database(String driverClassName, String connInfo, Report report, String name, String user) Constructor. | public | Database(String driverClassName, String connInfo, Report report, String name, String user, String password) Constructor. | protected | Database(String driverClassName, String connInfo, Report report, String name, String user, String password, boolean givenPassword) Constructor. |
Method Summary | |
public boolean | areRecordsSelectable() | public boolean | areRecordsSortable() | public boolean | canGroupRecords() | public boolean | canJoinTables() | public Iterator | columns() | protected void | doWriteXML(XMLWriter out) Writes this database and all its tables as an XML tag. | public DataCursor | execute() | public Column | findColumn(Object id) Given an id (a column name), returns the column that has that id. | protected Table | findTable(String tableName) Given a table name, find the table. | protected Table | findTableWithId(String id) Finds table with given id string. | public Connection | getConnection() Returns a connection to the database. | public String | getConnectionInfo() Returns the connection info string. | public String | getDriverClassName() Returns the driver class name. | public String | getName() Returns the database name. | public String | getPassword() Returns the password. | public String | getUserName() Returns the user name. | public void | initializeConnection() Initializes the connection to the database. | public boolean | isConnectionEditable() | public boolean | isSQLGenerated() | protected void | loadAllTables() Loads information about all tables in the database. | protected void | loadTablesUsingSchemaNameAndTypes(DatabaseMetaData dbmd, String schema, String[] objectTypes) Loads our list of tables using a database meta data object and a
schema name. | public void | reset(String driverClassName, String connInfo, String dbName, String username, String password) Reset key instance variables, closes current connection, and "reloads"
all table information (compares new info with existing info and complains
if any existing info is not in the new info).
Note: if the connection we currently have was created by this
object, we close it. | protected void | setConnectionInfo(String newConnectionInfo) Sets the connection info string. | protected void | setDriverClassName(String newDriverClassName) Sets the driver class name. | protected void | setName(String newName) Sets the name. | public void | setPassword(String newPassword) Sets the password. | public void | setUserName(String newUserName) Sets the user name. | public boolean | storesLowerCaseIdentifiers() | public boolean | storesUpperCaseIdentifiers() | public Iterator | tables() | public Iterator | tablesUsedInReport() |
DB_OBJECT_TYPES | final protected static String[] DB_OBJECT_TYPES(Code) | | |
connectionOwnedByMe | protected boolean connectionOwnedByMe(Code) | | |
hasPassword | protected boolean hasPassword(Code) | | |
storesLowerCaseIdentifiers | protected boolean storesLowerCaseIdentifiers(Code) | | |
storesUpperCaseIdentifiers | protected boolean storesUpperCaseIdentifiers(Code) | | |
Database | protected Database(String driverClassName, String connInfo, Report report, String name, String user, String password, boolean givenPassword) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, UserCancellationException(Code) | | Constructor.
Parameters: driverClassName - database driver class name Parameters: connInfo - database connection info string Parameters: report - the report using this database Parameters: name - the database name Parameters: user - the user name to use when logging in to the database Parameters: password - the database password Parameters: givenPassword - if true , the password was passed into some other constructor |
areRecordsSelectable | public boolean areRecordsSelectable()(Code) | | |
areRecordsSortable | public boolean areRecordsSortable()(Code) | | |
canGroupRecords | public boolean canGroupRecords()(Code) | | |
canJoinTables | public boolean canJoinTables()(Code) | | |
doWriteXML | protected void doWriteXML(XMLWriter out)(Code) | | Writes this database and all its tables as an XML tag.
Parameters: out - a writer that knows how to write XML |
findColumn | public Column findColumn(Object id)(Code) | | Given an id (a column name), returns the column that has that id. If no
column with the specified id exists, returns null . Uses
Table.findColumn .
Parameters: id - a column id a column, or null if no column with the specifiedid exists See Also: Table.findColumn |
findTable | protected Table findTable(String tableName)(Code) | | Given a table name, find the table. The table name may have a schema name
or not. We look for the table first using tableName as-is,
then we use this database's schema name, then we try no schema name
at all.
Parameters: tableName - a table name, perhaps including a schema name. |
findTableWithId | protected Table findTableWithId(String id)(Code) | | Finds table with given id string. Returns null if
it is not found. If the report says that database names are not
case-sensitive, then we do a case-insensitive comparison.
Parameters: id - a table id; if names are not case-sensitive then idwill be lower-case when it is passed in |
getConnection | public Connection getConnection()(Code) | | Returns a connection to the database.
a connection to the database |
getConnectionInfo | public String getConnectionInfo()(Code) | | Returns the connection info string.
the connection info string |
getDriverClassName | public String getDriverClassName()(Code) | | Returns the driver class name.
the driver class name |
getName | public String getName()(Code) | | Returns the database name.
the database name |
getPassword | public String getPassword()(Code) | | Returns the password.
the password |
getUserName | public String getUserName()(Code) | | Returns the user name.
the user name |
isConnectionEditable | public boolean isConnectionEditable()(Code) | | |
isSQLGenerated | public boolean isSQLGenerated()(Code) | | |
loadAllTables | protected void loadAllTables() throws SQLException(Code) | | Loads information about all tables in the database. If no tables are
found when using the database schema name, try again with a
null schema name.
|
loadTablesUsingSchemaNameAndTypes | protected void loadTablesUsingSchemaNameAndTypes(DatabaseMetaData dbmd, String schema, String[] objectTypes) throws SQLException(Code) | | Loads our list of tables using a database meta data object and a
schema name. The schema name may be null .
Parameters: dbmd - the database meta data object Parameters: objectTypes - a list of database object types Parameters: schema - the schema name; may be null |
reset | public void reset(String driverClassName, String connInfo, String dbName, String username, String password) throws SQLException, ClassNotFoundException, InstantiationException, IllegalAccessException, UserCancellationException(Code) | | Reset key instance variables, closes current connection, and "reloads"
all table information (compares new info with existing info and complains
if any existing info is not in the new info).
Note: if the connection we currently have was created by this
object, we close it. If the connection was handed to us, we do
not close the connection.
Parameters: driverClassName - database driver class name Parameters: connInfo - database connection info string Parameters: dbName - database name Parameters: username - the user name to use when logging in to the database |
setConnectionInfo | protected void setConnectionInfo(String newConnectionInfo)(Code) | | Sets the connection info string.
Parameters: newConnectionInfo - the connection info string |
setDriverClassName | protected void setDriverClassName(String newDriverClassName)(Code) | | Sets the driver class name.
Parameters: newDriverClassName - the driver class name |
setName | protected void setName(String newName)(Code) | | Sets the name.
Parameters: newName - the new name |
setPassword | public void setPassword(String newPassword)(Code) | | Sets the password.
Parameters: newPassword - the new password |
setUserName | public void setUserName(String newUserName)(Code) | | Sets the user name.
Parameters: newUserName - the new user name |
storesLowerCaseIdentifiers | public boolean storesLowerCaseIdentifiers()(Code) | | |
storesUpperCaseIdentifiers | public boolean storesUpperCaseIdentifiers()(Code) | | |
|
|