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.
-
className
- The Class name for the appropriate DB driver
-
connected
- am I connected?
-
connection
- the DB connection
-
date_datatype
- constant for the string Oracle expects for the date datatype
-
DEBUG
-
-
driver
- the DB driver
-
ISName
- the name of the IS for this DBManager
-
numeric_datatype
- constant for the string Oracle expects for the numeric datatype
-
passwd
- Password
-
url
- DB URL
-
user
- Username
-
DBManager()
- constructior.
Initializes the "connected" variable.
-
addAttribute(String, String, String, int)
-
-
addRelation(String, Vector, Vector)
- interface for the schema change operations
-
deleteAttribute(String, String)
-
-
deleteRelation(String, boolean)
-
-
executeQuery(String)
- executes a SQL-Query against one database.
-
executeViewQuery(String)
- executes a SQL-View-Query against one database (which should
be the local database, of course).
-
getAttributeExtent(String, String)
-
returns a vector of strings, which represent actual data values.
-
getAttributeNames(String)
-
returns a vector of strings representing attribute names in a certain relation
10/6/97 koeller
-
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
-
getISName()
- returns the ISName for this DBManager
-
getRelationNames()
- gets Relation names for this IS.
-
getTableName(String, int)
- determines which table a certain attribute comes from.
-
isConnected()
- am I connected?
-
makeSelectClause(String)
- Helper function.
-
privateExecuteQuery(String, boolean)
-
returns a single Table object not tied to an IS.
-
renameAttribute(String, String, String)
-
-
renameAttributeInSchema(String, String, String)
- Helper function.
-
renameRelation(String, String)
-
-
sendUpdate(String, int, String)
- send an update :)
-
storeRelation(Table)
-
-
stripAttributeFromSchema(String, String)
- Helper function.
DEBUG
static final boolean DEBUG
url
public String url
- DB URL
user
public String user
- Username
passwd
public String passwd
- Password
className
public String className
- The Class name for the appropriate DB driver
driver
public Class driver
- the DB driver
connection
public Connection connection
- the DB connection
ISName
public String ISName
- the name of the IS for this DBManager
connected
protected boolean connected
- am I connected?
numeric_datatype
public static final String numeric_datatype
- constant for the string Oracle expects for the numeric datatype
date_datatype
public static final String date_datatype
- constant for the string Oracle expects for the date datatype
DBManager
public DBManager()
- constructior.
Initializes the "connected" variable.
isConnected
public boolean isConnected()
- am I connected?
getISName
public String getISName()
- returns the ISName for this DBManager
getRelationNames
public Vector getRelationNames()
- gets Relation names for this IS.
10/6/97 koeller
getAttributeNames
public Vector getAttributeNames(String RelationName)
- returns a vector of strings representing attribute names in a certain relation
10/6/97 koeller
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
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
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.
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
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.
sendUpdate
public boolean sendUpdate(String relationName,
int count,
String update)
- send an update :)
addRelation
public abstract boolean addRelation(String relationName,
Vector attName,
Vector attTypes)
- interface for the schema change operations
deleteRelation
public abstract boolean deleteRelation(String name,
boolean silent)
renameAttribute
public abstract boolean renameAttribute(String RelationName,
String oldName,
String newName)
addAttribute
public abstract boolean addAttribute(String RelationName,
String AttributeName,
String type,
int size)
deleteAttribute
public abstract boolean deleteAttribute(String RelationName,
String attributeName)
renameRelation
public abstract boolean renameRelation(String oldName,
String newName)
storeRelation
public abstract boolean storeRelation(Table table)
stripAttributeFromSchema
public String stripAttributeFromSchema(String schema,
String attributeName)
- Helper function.
this strips one attribute from a schema obtained by getSchema(),
kind of awkward...
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
renameAttributeInSchema
public String renameAttributeInSchema(String schema,
String oldName,
String newName)
- Helper function.
this renames one attribute in a schema obtained by getSchema(),
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