|
|||||||||
| Home >> All >> javatools >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
javatools.db
Class DbDatabase

java.lang.Objectjavatools.db.DbDatabase
- Direct Known Subclasses:
- DbDatabaseAdmin
- public class DbDatabase
- extends java.lang.Object
A class that represents a particular database. A DbDatabase basically consists of some connection parameters plus we keep track of the open connections. The constructor is not public. Use DbManager.getDatabase().
- Version:
- 0.1.10
| Field Summary | |
(package private) boolean |
autoCommit
true: each database update is autocommitted;
false: commit must be made manually. |
protected boolean |
checkStatement
A flag indicating if a DBMS supports check clauses in its constraints. |
(package private) java.util.Map |
connectionThreadMap
A map to reference each connection to each thread. |
(package private) java.lang.String |
connectString
The connection string for this DBMS-database. |
(package private) java.lang.String |
driver
The JDBC driver to access this DBMS. |
protected boolean |
foreignKey
A flag indicating if a DBMS supports foreign keys. |
(package private) DbManager |
manager
The manager for databases. |
(package private) java.lang.String |
name
The name of this DBMS. |
protected boolean |
onDeleteCascade
A flag indicating if a DBMS supports ON DELETE CASCADE clauses in its constraints. |
protected boolean |
onDeleteSetDefault
A flag indicating if a DBMS supports ON DELETE SET DEFAULT clauses in its constraints. |
protected boolean |
onDeleteSetNull
A flag indicating if a DBMS supports ON DELETE SET NULL clauses in its constraints. |
protected boolean |
onUpdateCascade
A flag indicating if a DBMS supports ON UPDATE CASCADE clauses in its constraints. |
protected boolean |
onUpdateSetDefault
A flag indicating if a DBMS supports ON UPDATE SET DEFAULT clauses in its constraints. |
protected boolean |
onUpdateSetNull
A flag indicating if a DBMS supports ON UPDATE SET NULL clauses in its constraints. |
(package private) java.lang.String |
password
The password to use in connection. |
(package private) java.util.Map |
tables
A map to access easily tables. |
(package private) java.util.Map |
threadConnectionMap
A map to reference each thread to each connection. |
(package private) java.lang.String |
userName
The user name to use in connection. |
| Constructor Summary | |
DbDatabase()
Builds a new DbDatabase empty object. |
|
DbDatabase(DbManager manager,
java.lang.String name,
java.lang.String driver,
java.lang.String connectString,
java.lang.String userName,
java.lang.String password)
Builds a new DbDatabase object. |
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
Checks if a DbDatabase object equals this one. |
DbExpr |
falseExpr()
Return an expression representing an SQL false expression. |
boolean |
getCheckStatement()
Returns the capability of DBMS to handle check statements. |
private void |
getEmulationsNeeded()
|
DbConnection |
getExistingThreadConnection()
Get a DbConnection that will be associated with this Thread, but only if one exists already. |
boolean |
getForeignKey()
Returns the capability of DBMS to handle foreign keys. |
DbJoinedTable |
getJoinedTable(DbAbstractTable tableLeft,
DbAbstractTable tableRight,
int joinType,
DbExpr joinCondition)
Returns a joined table. |
DbConnection |
getNewConnection()
Return a brand new DbConnection. |
boolean |
getOnDeleteCascade()
Returns the capability of DBMS to handle ON DELETE CASCADE clauses. |
boolean |
getOnDeleteSetDefault()
Returns the capability of DBMS to handle ON DELETE SET DEFAULT clauses. |
boolean |
getOnDeleteSetNull()
Returns the capability of DBMS to handle ON DELETE SET NULL clauses. |
boolean |
getOnUpdateCascade()
Returns the capability of DBMS to handle ON UPDATE CASCADE clauses. |
boolean |
getOnUpdateSetDefault()
Returns the capability of DBMS to handle ON UPDATE SET DEFAULT clauses. |
boolean |
getOnUpdateSetNull()
Returns the capability of DBMS to handle ON UPDATE SET NULL clauses. |
java.lang.String |
getPassword()
|
java.lang.String |
getProperty(java.lang.String pname)
A database can have a set of properties associated with it. |
DbSequence |
getSequence(java.lang.String name)
Ahem... |
DbTable |
getTable(java.lang.String name)
Return an object representing a particular table in the database. |
DbConnection |
getThreadConnection()
Get a DbConnection that will be associated with this Thread. |
java.lang.String |
getUserName()
|
boolean |
hasThreadConnection()
Does this thread have a default connection associated with it? (i.e. |
(package private) void |
notifyClose(DbConnection con)
Notify the DbDatabase that one of its connections has closed. |
DbSelector |
selector()
Create a new DbSelector. |
void |
setAutoCommit(boolean pAutoCommit)
Sets autocommit property. |
void |
setProperty(java.lang.String pname,
java.lang.String value)
Set a property for this database. |
private boolean |
string2boolean(java.lang.String value)
|
java.lang.String |
toString()
A database to a string? Ok if you want it... |
DbExpr |
trueExpr()
Return an expression representing an SQL true expression. |
DbExpr |
valueList(java.util.Collection col)
Returns a value list. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
threadConnectionMap
java.util.Map threadConnectionMap
- A map to reference each thread to each connection.
connectionThreadMap
java.util.Map connectionThreadMap
- A map to reference each connection to each thread.
tables
java.util.Map tables
- A map to access easily tables.
manager
DbManager manager
- The manager for databases.
name
java.lang.String name
- The name of this DBMS.
driver
java.lang.String driver
- The JDBC driver to access this DBMS.
connectString
java.lang.String connectString
- The connection string for this DBMS-database.
userName
java.lang.String userName
- The user name to use in connection.
password
java.lang.String password
- The password to use in connection.
autoCommit
boolean autoCommit
true: each database update is autocommitted;false: commit must be made manually.
foreignKey
protected boolean foreignKey
- A flag indicating if a DBMS supports foreign keys.
true: the DBMS supports foreign keys;false: otherwise.
checkStatement
protected boolean checkStatement
- A flag indicating if a DBMS supports check clauses in its constraints.
true: the DBMS supports check clauses;false: otherwise.
onDeleteCascade
protected boolean onDeleteCascade
- A flag indicating if a DBMS supports ON DELETE CASCADE clauses in its
constraints.
true: the DBMS supports ON DELETE CASCADE clauses;false: otherwise.
onDeleteSetDefault
protected boolean onDeleteSetDefault
- A flag indicating if a DBMS supports ON DELETE SET DEFAULT clauses in its
constraints.
true: the DBMS supports ON DELETE SET DEFAULT clauses;false: otherwise.
onDeleteSetNull
protected boolean onDeleteSetNull
- A flag indicating if a DBMS supports ON DELETE SET NULL clauses in its
constraints.
true: the DBMS supports ON DELETE SET NULL clauses;false: otherwise.
onUpdateCascade
protected boolean onUpdateCascade
- A flag indicating if a DBMS supports ON UPDATE CASCADE clauses in its
constraints.
true: the DBMS supports ON UPDATE CASCADE clauses;false: otherwise.
onUpdateSetDefault
protected boolean onUpdateSetDefault
- A flag indicating if a DBMS supports ON UPDATE SET DEFAULT clauses in its
constraints.
true: the DBMS supports ON UPDATE SET DEFAULT clauses;false: otherwise.
onUpdateSetNull
protected boolean onUpdateSetNull
- A flag indicating if a DBMS supports ON UPDATE SET NULL clauses in its
constraints.
true: the DBMS supports ON UPDATE SET NULL clauses;false: otherwise.
| Constructor Detail |
DbDatabase
public DbDatabase()
- Builds a new DbDatabase empty object.
DbDatabase
public DbDatabase(DbManager manager, java.lang.String name, java.lang.String driver, java.lang.String connectString, java.lang.String userName, java.lang.String password)
- Builds a new DbDatabase object.
| Method Detail |
setAutoCommit
public void setAutoCommit(boolean pAutoCommit)
- Sets autocommit property.
setProperty
public void setProperty(java.lang.String pname, java.lang.String value) throws DbException
- Set a property for this database.
getProperty
public java.lang.String getProperty(java.lang.String pname) throws DbException
- A database can have a set of properties associated with it. We use
. in a properties file and by default we use "driver", "userId", "password" and "connect".
getTable
public DbTable getTable(java.lang.String name) throws DbException
- Return an object representing a particular table in the database.
getJoinedTable
public DbJoinedTable getJoinedTable(DbAbstractTable tableLeft, DbAbstractTable tableRight, int joinType, DbExpr joinCondition) throws DbException
- Returns a joined table.
getSequence
public DbSequence getSequence(java.lang.String name)
- Ahem... uncommented. It is obscure, call Chris Bitmead.
getThreadConnection
public DbConnection getThreadConnection() throws DbException
- Get a DbConnection that will be associated with this Thread.
getExistingThreadConnection
public DbConnection getExistingThreadConnection() throws DbException
- Get a DbConnection that will be associated with this Thread, but only if
one exists already.
getNewConnection
public DbConnection getNewConnection() throws DbException
- Return a brand new DbConnection.
equals
public boolean equals(java.lang.Object o)
- Checks if a DbDatabase object equals this one.
selector
public DbSelector selector() throws DbException
- Create a new DbSelector.
hasThreadConnection
public boolean hasThreadConnection()
- Does this thread have a default connection associated with it? (i.e. has
this Thread called getThreadConnection()).
trueExpr
public DbExpr trueExpr()
- Return an expression representing an SQL true expression. We use the
expression "0 = 0" for this purpose. This is handy when using complex code
to construct a big conditional clause, it can be easier to start with a
true expression and "AND" expressions onto the end.
falseExpr
public DbExpr falseExpr()
- Return an expression representing an SQL false expression. We use the
expression "0 = 1" for this purpose. This is handy when using complex code
to construct a big conditional clause, it can be easier to start with a
false expression and "OR" expressions onto the end.
valueList
public DbExpr valueList(java.util.Collection col)
- Returns a value list.
toString
public java.lang.String toString()
- A database to a string? Ok if you want it...
getUserName
public java.lang.String getUserName()
getPassword
public java.lang.String getPassword()
getForeignKey
public boolean getForeignKey()
- Returns the capability of DBMS to handle foreign keys.
getCheckStatement
public boolean getCheckStatement()
- Returns the capability of DBMS to handle check statements.
getOnDeleteCascade
public boolean getOnDeleteCascade()
- Returns the capability of DBMS to handle ON DELETE CASCADE clauses.
getOnDeleteSetDefault
public boolean getOnDeleteSetDefault()
- Returns the capability of DBMS to handle ON DELETE SET DEFAULT clauses.
getOnDeleteSetNull
public boolean getOnDeleteSetNull()
- Returns the capability of DBMS to handle ON DELETE SET NULL clauses.
getOnUpdateCascade
public boolean getOnUpdateCascade()
- Returns the capability of DBMS to handle ON UPDATE CASCADE clauses.
getOnUpdateSetDefault
public boolean getOnUpdateSetDefault()
- Returns the capability of DBMS to handle ON UPDATE SET DEFAULT clauses.
getOnUpdateSetNull
public boolean getOnUpdateSetNull()
- Returns the capability of DBMS to handle ON UPDATE SET NULL clauses.
notifyClose
void notifyClose(DbConnection con)
- Notify the DbDatabase that one of its connections has closed.
getEmulationsNeeded
private void getEmulationsNeeded()
string2boolean
private boolean string2boolean(java.lang.String value)
|
|||||||||
| Home >> All >> javatools >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
javatools.db.DbDatabase