|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectca.sqlpower.architect.SQLObject
ca.sqlpower.architect.SQLDatabase
public class SQLDatabase
| Field Summary |
|---|
| Fields inherited from class ca.sqlpower.architect.SQLObject |
|---|
children, magicDisableCount, populated, undoEventListeners |
| Constructor Summary | |
|---|---|
SQLDatabase()
Constructor for non-JDBC connected instances. |
|
SQLDatabase(ca.sqlpower.sql.SPDataSource dataSource)
Constructor for instances that connect to a real database by JDBC. |
|
| Method Summary | |
|---|---|
boolean |
allowsChildren()
Returns true if and only if this object can have child SQLObjects. |
void |
disconnect()
Closes all connections and other resources that were allocated by the connect() method. |
SQLCatalog |
getCatalogByName(java.lang.String catalogName)
|
java.lang.Class<? extends SQLObject> |
getChildType()
|
java.sql.Connection |
getConnection()
Returns a JDBC connection to the backing database, if there is one. |
ca.sqlpower.sql.SPDataSource |
getDataSource()
Gets the value of dataSource |
int |
getMaxActiveConnections()
Returns the maximum number of active connections that this database has ever opened. |
java.lang.String |
getName()
This is the name of the object. |
SQLObject |
getParent()
SQLDatabase objects don't have parents. |
SQLSchema |
getSchemaByName(java.lang.String schemaName)
Searches for the named schema as a direct child of this database, or as a child of any catalog of this database. |
java.lang.String |
getShortDisplayName()
Returns a short string that should be displayed to the user for representing this SQLObject as a label. |
SQLTable |
getTableByName(java.lang.String tableName)
|
SQLTable |
getTableByName(java.lang.String catalogName,
java.lang.String schemaName,
java.lang.String tableName)
Searches this database's list of tables for one with the given name, ignoring case because SQL isn't (usually) case sensitive. |
java.util.List<SQLTable> |
getTables()
Recursively searches this database for SQLTable descendants, compiles a list of those that were found, and returns that list. |
boolean |
isCatalogContainer()
Determines whether this SQL object is a container for catalog |
boolean |
isConnected()
|
boolean |
isPlayPenDatabase()
|
boolean |
isSchemaContainer()
Determines whether this SQL object is a container for schemas |
void |
populate()
Causes this SQLObject to load its children (if any exist). |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Listens for changes in DBCS properties, and resets this SQLDatabase if a critical property (url, driver, username) changes. |
protected void |
reset()
Removes all children, closes and discards the JDBC connection. |
void |
setDataSource(ca.sqlpower.sql.SPDataSource argDataSource)
Sets the value of dataSource |
void |
setName(java.lang.String argName)
Sets the data source name if the data source is not null |
protected void |
setParent(SQLObject newParent)
Parents call this on their children to update parent pointers during addChild and removeChild requests. |
void |
setPlayPenDatabase(boolean v)
|
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public SQLDatabase(ca.sqlpower.sql.SPDataSource dataSource)
public SQLDatabase()
| Method Detail |
|---|
public boolean isConnected()
public void populate()
throws ArchitectException
SQLObject
populate in class SQLObjectArchitectException
public SQLCatalog getCatalogByName(java.lang.String catalogName)
throws ArchitectException
ArchitectException
public SQLSchema getSchemaByName(java.lang.String schemaName)
throws ArchitectException
Note: there may be more than one schema with the given name,
if your RDBMS supports catalogs. In that case, use SQLCatalog.getSchemaByName(java.lang.String) or write another version of this
method that return an array of SQLSchema.
ArchitectException
public SQLTable getTableByName(java.lang.String tableName)
throws ArchitectException
ArchitectException
public SQLTable getTableByName(java.lang.String catalogName,
java.lang.String schemaName,
java.lang.String tableName)
throws ArchitectException
catalogName - The name of the catalog to search, or null
if you want to search all catalogs.schemaName - The name of the schema to search (in this
database or in the given catalog) or null to search all
schemas.tableName - The name of the table to look for (null is not
allowed).
ArchitectExceptionpublic SQLObject getParent()
getParent in class SQLObjectnullprotected void setParent(SQLObject newParent)
SQLObject
setParent in class SQLObjectpublic java.lang.String getName()
SQLObject
getName in class SQLObjectpublic void setName(java.lang.String argName)
setName in class SQLObjectargName - Value to assign to this.namepublic java.lang.String getShortDisplayName()
SQLObject
getShortDisplayName in class SQLObjectpublic boolean allowsChildren()
SQLObjectreturn true" or
"return false" depending on object type.
allowsChildren in class SQLObject
public boolean isCatalogContainer()
throws ArchitectException
ArchitectException
public boolean isSchemaContainer()
throws ArchitectException
ArchitectException
public java.util.List<SQLTable> getTables()
throws ArchitectException
WARNING: Calling this method will populate the entire database! Think carefully about using it on lazy-loading source databases (it is safe to use on the playpen database).
ArchitectExceptionpublic ca.sqlpower.sql.SPDataSource getDataSource()
public void setDataSource(ca.sqlpower.sql.SPDataSource argDataSource)
argDataSource - Value to assign to this.dataSourcepublic void setPlayPenDatabase(boolean v)
public boolean isPlayPenDatabase()
protected void reset()
playPenDatabase is true
public void propertyChange(java.beans.PropertyChangeEvent e)
propertyChange in interface java.beans.PropertyChangeListener
public java.sql.Connection getConnection()
throws ArchitectException
ArchitectExceptionpublic java.lang.String toString()
toString in class java.lang.Objectpublic void disconnect()
public java.lang.Class<? extends SQLObject> getChildType()
getChildType in class SQLObjectpublic int getMaxActiveConnections()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||