All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class DSRG.MW.DBManager

java.lang.Object
   |
   +----DSRG.MW.DBManager

public abstract class DBManager
extends Object
The lowest layer of the DB connection, right above the ODBC driver.
All methods go directly to the DB, every time they are invoked.
This is subclassed to provide functionality for different DB systems in the ISs.


Variable Index

 o className
The Class name for the appropriate DB driver
 o connected
am I connected?
 o connection
the DB connection
 o date_datatype
constant for the string Oracle expects for the date datatype
 o DEBUG
 o driver
the DB driver
 o ISName
the name of the IS for this DBManager
 o numeric_datatype
constant for the string Oracle expects for the numeric datatype
 o passwd
Password
 o url
DB URL
 o user
Username

Constructor Index

 o DBManager()
constructior.
Initializes the "connected" variable.

Method Index

 o addAttribute(String, String, String, int)
 o addRelation(String, Vector, Vector)
interface for the schema change operations
 o deleteAttribute(String, String)
 o deleteRelation(String, boolean)
 o executeQuery(String)
executes a SQL-Query against one database.
 o executeViewQuery(String)
executes a SQL-View-Query against one database (which should be the local database, of course).
 o getAttributeExtent(String, String)
returns a vector of strings, which represent actual data values.
 o getAttributeNames(String)
returns a vector of strings representing attribute names in a certain relation
10/6/97 koeller
 o getAttributeType(String, String)
a string representing the type (in the syntax of the underlying DB!) of the attribute attributeName in the relation relationName
10/6/97 koeller
 o getISName()
returns the ISName for this DBManager
 o getRelationNames()
gets Relation names for this IS.
 o getTableName(String, int)
determines which table a certain attribute comes from.
 o isConnected()
am I connected?
 o makeSelectClause(String)
Helper function.
 o privateExecuteQuery(String, boolean)
returns a single Table object not tied to an IS.
 o renameAttribute(String, String, String)
 o renameAttributeInSchema(String, String, String)
Helper function.
 o renameRelation(String, String)
 o sendUpdate(String, int, String)
send an update :)
 o storeRelation(Table)
 o stripAttributeFromSchema(String, String)
Helper function.

Variables

 o DEBUG
 static final boolean DEBUG
 o url
 public String url
DB URL

 o user
 public String user
Username

 o passwd
 public String passwd
Password

 o className
 public String className
The Class name for the appropriate DB driver

 o driver
 public Class driver
the DB driver

 o connection
 public Connection connection
the DB connection

 o ISName
 public String ISName
the name of the IS for this DBManager

 o connected
 protected boolean connected
am I connected?

 o numeric_datatype
 public static final String numeric_datatype
constant for the string Oracle expects for the numeric datatype

 o date_datatype
 public static final String date_datatype
constant for the string Oracle expects for the date datatype

Constructors

 o DBManager
 public DBManager()
constructior.
Initializes the "connected" variable.

Methods

 o isConnected
 public boolean isConnected()
am I connected?

 o getISName
 public String getISName()
returns the ISName for this DBManager

 o getRelationNames
 public Vector getRelationNames()
gets Relation names for this IS.
10/6/97 koeller

 o getAttributeNames
 public Vector getAttributeNames(String RelationName)
returns a vector of strings representing attribute names in a certain relation
10/6/97 koeller

 o getAttributeType
 public String getAttributeType(String relationName,
                                String attributeName)
a string representing the type (in the syntax of the underlying DB!) of the attribute attributeName in the relation relationName
10/6/97 koeller

 o getAttributeExtent
 public Vector getAttributeExtent(String RelationName,
                                  String AttributeName)
returns a vector of strings, which represent actual data values. (regardless of their type in the DB there are always strings coming back!)
10/6/97 koeller

 o executeQuery
 public Table executeQuery(String SQL)
executes a SQL-Query against one database. The attribute names in the returning table are composed of relation names and attribute names of the attributes in the select-clause.

 o executeViewQuery
 public Table executeViewQuery(String SQL)
executes a SQL-View-Query against one database (which should be the local database, of course). The attribute names in the returning table are only the attribute names of the attributes in the select-clause. Otherwise, this method is equivalent to

See Also:
executeQuery
 o privateExecuteQuery
 private Table privateExecuteQuery(String SQL,
                                   boolean withRelationNames)
returns a single Table object not tied to an IS.
expects SQL in the dialect the DB understands, so for now we need to stick with basic SQL (which we do in the theory...).
If the second parameter is true, the Table object contains attribute names that are composed of relation and attribute names of the SQL-Query in the oaramater. Otherwise, the attribute names are only attribute names, and do not contain relation names. This method should only be called by the executeQuery() and executeViewQuery()-methods.

 o sendUpdate
 public boolean sendUpdate(String relationName,
                           int count,
                           String update)
send an update :)

 o addRelation
 public abstract boolean addRelation(String relationName,
                                     Vector attName,
                                     Vector attTypes)
interface for the schema change operations

 o deleteRelation
 public abstract boolean deleteRelation(String name,
                                        boolean silent)
 o renameAttribute
 public abstract boolean renameAttribute(String RelationName,
                                         String oldName,
                                         String newName)
 o addAttribute
 public abstract boolean addAttribute(String RelationName,
                                      String AttributeName,
                                      String type,
                                      int size)
 o deleteAttribute
 public abstract boolean deleteAttribute(String RelationName,
                                         String attributeName)
 o renameRelation
 public abstract boolean renameRelation(String oldName,
                                        String newName)
 o storeRelation
 public abstract boolean storeRelation(Table table)
 o stripAttributeFromSchema
 public String stripAttributeFromSchema(String schema,
                                        String attributeName)
Helper function.
this strips one attribute from a schema obtained by getSchema(), kind of awkward...

 o getTableName
 private String getTableName(String SQL,
                             int index)
determines which table a certain attribute comes from.
looks like this function (ResultSetMetaData.getTableName(int i)) is not implemented in the JDBC driver, so I have to parse the table name from the SQL-String. Great!!!!
it's only partly implemented - it needs:
{<table_name>.<attribute_name>,}<table_name>.<attribute_name> as a format.
It also doesn't work when there is a "*" in the select clause 6/3/98 koeller I'm going to have to fix the *-Problem, but it's only working with one relation then 9/24/98 koeller

 o renameAttributeInSchema
 public String renameAttributeInSchema(String schema,
                                       String oldName,
                                       String newName)
Helper function.
this renames one attribute in a schema obtained by getSchema(),

 o makeSelectClause
 String makeSelectClause(String schema)
Helper function.
This turns a schema obtained by getSchema into a list of attribute names without the types, to include them in a select clause when copying tables


All Packages  Class Hierarchy  This Package  Previous  Next  Index