|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.sourceforge.idrs.utils.DB
Class DB DB.java Copyright (C) 2000 Marc Boorshtein under the GNU General Public License offered without warenty Purpose: This class is used as a wrapper for JDBC to insure cross database compatability. This class allows for the connection to and retrieval from DB's without the need for dirrect use of JDBC
Field Summary | |
static int |
CLIENT
|
(package private) java.sql.Connection |
con
|
(package private) IDRSScript |
idrs
|
static int |
INPUT
|
static int |
OUTPUT
|
(package private) java.sql.ResultSet |
rs
|
static int |
SERVER
|
Constructor Summary | |
DB(java.lang.String ID)
|
Method Summary | |
void |
addVar(java.lang.String val,
java.lang.String type)
pre:none post: used to add a var to a query |
void |
clearVars()
Clears all variables |
void |
close()
Closes the connection and recordset |
java.sql.Connection |
getConnection()
Is used to retrieve a connection to DB |
int |
getCurrLocation()
Returns the current cursor location of the db |
java.lang.String |
getDBDriver()
returns the name of the driver being used |
java.lang.String |
getDBName()
Returns the name of the DBName |
int |
getDirection()
|
java.lang.String |
getFieldData(java.lang.String fieldname,
java.lang.String format)
pre: fields is poulated fieldname exists in fields if no format, then it should be set to null format must follow java.text.MessageFormat() specs post: returns the data in fieldname with applied format |
int |
getFirstRec()
Returns the number of the first record to be retrieved from dataset, used only with client side cursur |
boolean |
getHasNext()
Retruns wether or not the db has another row in it |
java.lang.String |
getID()
|
boolean |
getIsPaged()
Returns wether or not current DB is paged |
int |
getNumRecs()
Returns the number of records should be retrieved in current report |
java.lang.String |
getPassword()
returns the password |
int |
getUpdateResult()
|
java.lang.String |
getUserName()
returns the user name |
boolean |
moveTo(int location)
Moves to a specific position within a db, only usable with client cursor |
boolean |
next()
pre:rs is populated post:if the there is another record, advance a record readin the fields else return false |
void |
procMethod(ObjectStore obj,
java.lang.String method,
java.util.Vector vals)
Pre: setDBName() has been executed successfully SQL is a valid SQL statement OR SQL is the name of a stored procedure all parameters must be shown in SQL using the ? character the vars and varTypes vectors must be filled for each parameter in SQL the vars and varTypes must contain information acording to the order in which the parametes apear in SQL if there are no parameters, then vars and varTypes must be empty Post: retrieves information based on SQL |
void |
ProcSQL(java.lang.String SQL,
boolean isProc)
|
void |
removeVar(int index)
pre: index < vars.size(); post: removes variable index from vars and varTypes vectors |
void |
setConnection(java.sql.Connection con)
Is used to set a pre-made connection to a DB |
void |
setCursurType(int type)
|
void |
setDBDriver(java.lang.String driver)
Pre: driver must be in the CLASSPATH Post: dirver is loaded by the VM and is ready for use |
void |
setDBName(java.lang.String name)
Pre: setDBDriver(), setUser(), setPassword() must all be executed Post: object is connected to the specified database |
void |
setDBName(java.lang.String name,
boolean connect)
|
void |
setDirection(int dir)
Sets wether or not a DB was retrieved from a cache |
void |
setIDRS(IDRSScript idrs)
|
void |
setIsPaged(boolean page)
Sets wether or not the db is paged |
void |
setNumRecs(int recs)
Sets the number of records to be retrieved in a report |
void |
setPassword(java.lang.String pass)
Pre: none post: sets passwords, use "" for no password |
void |
setUserName(java.lang.String user)
Pre:none Post: sets user name, use "" for no user name |
void |
setVar(java.lang.String val,
java.lang.String type,
int index)
pre: index < vars.size() post: sets a variable's value and type at index |
boolean |
shouldPool()
|
void |
startWith(int location)
|
boolean |
wasCached()
Returns wether or not the db was retrieved from a cache |
void |
wasCached(boolean yup)
|
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int SERVER
public static final int CLIENT
public static final int INPUT
public static final int OUTPUT
java.sql.ResultSet rs
java.sql.Connection con
IDRSScript idrs
Constructor Detail |
public DB(java.lang.String ID)
Method Detail |
public void setDirection(int dir)
public int getDirection()
public void wasCached(boolean yup) throws java.lang.Exception
public boolean wasCached() throws java.lang.Exception
public int getFirstRec() throws java.lang.Exception
public int getNumRecs() throws java.lang.Exception
public void setNumRecs(int recs) throws java.lang.Exception
public boolean getIsPaged() throws java.lang.Exception
public void setIsPaged(boolean page) throws java.lang.Exception
public int getCurrLocation() throws java.lang.Exception
public java.lang.String getID() throws java.lang.Exception
public void setCursurType(int type) throws java.lang.Exception
public void setIDRS(IDRSScript idrs)
public boolean shouldPool()
public void close() throws java.lang.Exception
public void setDBDriver(java.lang.String driver) throws java.lang.Exception
public java.lang.String getDBDriver() throws java.lang.Exception
public void setDBName(java.lang.String name) throws java.lang.Exception
public void setDBName(java.lang.String name, boolean connect) throws java.lang.Exception
public java.lang.String getDBName() throws java.lang.Exception
public void setUserName(java.lang.String user) throws java.lang.Exception
public java.lang.String getUserName() throws java.lang.Exception
public void setPassword(java.lang.String pass) throws java.lang.Exception
public java.lang.String getPassword() throws java.lang.Exception
public void setConnection(java.sql.Connection con) throws java.lang.Exception
public java.sql.Connection getConnection() throws java.lang.Exception
public void procMethod(ObjectStore obj, java.lang.String method, java.util.Vector vals) throws java.lang.Exception
public void ProcSQL(java.lang.String SQL, boolean isProc) throws java.lang.Exception
public void addVar(java.lang.String val, java.lang.String type) throws java.lang.Exception
public void removeVar(int index) throws java.lang.Exception
public void setVar(java.lang.String val, java.lang.String type, int index) throws java.lang.Exception
public void clearVars() throws java.lang.Exception
public int getUpdateResult() throws java.lang.Exception
public java.lang.String getFieldData(java.lang.String fieldname, java.lang.String format) throws java.lang.Exception
public boolean moveTo(int location) throws java.lang.Exception
public void startWith(int location) throws java.lang.Exception
public boolean next() throws java.lang.Exception
public boolean getHasNext() throws java.lang.Exception
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |