|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--com.ds.fw.beans.FwBaseBean
|
+--com.ds.fw.beans.FwDBBean
Class FwDBBean ought to be used for DataBase interface. Generally extends FwBaseBean class and your framework for storing data, and methods for accessing information. It was implements SQL requests and suggest more user frendly interface for DataBase. Used set and get methods for setting and getting information in default DB. If you needed specify methods, Feel free to extends this class. When you stopping use this instance, you may have release connection with release method. Notice by default autocommitetd is false, use commit method!!!
| Field Summary | |
static java.lang.String |
STRING_ENCODING_DB
|
static java.lang.String |
STRING_ENCODING_OUT
|
| Fields inherited from class com.ds.fw.beans.FwBaseBean |
DEBUG_QUERY, result |
| Constructor Summary | |
FwDBBean()
Creates new FwDBBean. |
|
FwDBBean(com.ds.fw.dbcon.FwDBConnManager c)
|
|
FwDBBean(java.lang.String db)
|
|
| Method Summary | |
int |
buildDeleteQuery(java.lang.String sqlStr)
Builds Delete query and executes it . |
long |
buildInsertQuery(java.util.Hashtable pair,
java.lang.String tableName)
Builds the INSERT query and executes it. |
long |
buildInsertQuery(java.util.Vector columnNames,
java.util.Vector values,
java.lang.String tableName)
Builds the INSERT query and executes it. |
boolean |
buildSelectQuery(java.util.Vector selColumn,
java.util.Vector tables,
java.lang.String whereParam)
Builds the SELECT query and executes it. |
int |
buildUpdateQuery(java.util.Hashtable pair,
java.lang.String table,
java.lang.String whereParam)
Builds Update query and executes it . |
static com.ds.fw.dbcon.FwDBConnManager |
createDBConnManager()
|
static com.ds.fw.dbcon.FwDBConnManager |
createDBConnManager(java.lang.String database)
|
static java.lang.String |
encodeSQL(java.lang.String s)
|
long |
execInsertQuery(java.lang.String sqlStr)
|
int |
execNonSelectQuery(java.lang.String sqlStr)
Executes all non Select query. |
boolean |
execSelectQuery(java.lang.String sqlStr)
Executes a SELECT query. |
void |
finalize()
Destroy FwDBBean. |
java.sql.Blob |
getBlob(java.lang.String key,
long k)
Gets the k'th element in the column Key as an Blob. |
java.util.Vector |
getColumn(java.lang.String key)
Return column by key |
java.lang.String |
getDataBase()
|
java.util.Hashtable |
getHashtable()
Return all stored information in this instance. |
boolean |
isStore()
If the return value is true - we can store some information in DB If false - the information is not stored into DB |
static void |
releaseDBConnManager(com.ds.fw.dbcon.FwDBConnManager c)
|
static void |
releaseDBConnManager(java.lang.String database,
com.ds.fw.dbcon.FwDBConnManager c)
|
void |
set(java.lang.String key,
java.lang.String set)
Set new value (simple) in Column point by given key |
void |
set(java.lang.String key,
java.util.Vector set)
Set column by given key |
void |
setBlob(java.lang.String key,
java.sql.Blob blob,
long k)
Sets Blob as an Blob object at position k corresponding to Key |
void |
setDataBase(java.lang.String n)
|
void |
setDBConnManager(com.ds.fw.dbcon.FwDBConnManager c)
|
void |
setStore(boolean stored)
Set isStored changed information into DB |
| Methods inherited from class com.ds.fw.beans.FwBaseBean |
clear, findIndexOf, get, get, get, getBigDecimal, getColumn, getColumnNames, getDate, getDouble, getFloat, getInt, getLong, getNumber, getNumRows, getNumRows, getResult, getString, lastIndexOf, set, set, set, setBigDecimal, setColumn, setColumn, setDate, setDouble, setFloat, setInt, setLong, setNumber, setResult, setString, size, toString |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static java.lang.String STRING_ENCODING_DB
public static java.lang.String STRING_ENCODING_OUT
| Constructor Detail |
public FwDBBean()
public FwDBBean(com.ds.fw.dbcon.FwDBConnManager c)
public FwDBBean(java.lang.String db)
| Method Detail |
public void finalize()
finalize in class java.lang.Object
public static com.ds.fw.dbcon.FwDBConnManager createDBConnManager(java.lang.String database)
throws java.sql.SQLException
java.sql.SQLException
public static void releaseDBConnManager(java.lang.String database,
com.ds.fw.dbcon.FwDBConnManager c)
public static com.ds.fw.dbcon.FwDBConnManager createDBConnManager()
throws java.sql.SQLException
java.sql.SQLExceptionpublic static void releaseDBConnManager(com.ds.fw.dbcon.FwDBConnManager c)
public void setDBConnManager(com.ds.fw.dbcon.FwDBConnManager c)
public java.sql.Blob getBlob(java.lang.String key,
long k)
throws java.lang.ClassCastException
key - the column name
java.lang.ClassCastException - in case the corresponding Object is not of class Blob.
public void setBlob(java.lang.String key,
java.sql.Blob blob,
long k)
key - the column nameblob - the Blob valuek - the integer value
public boolean execSelectQuery(java.lang.String sqlStr)
throws java.sql.SQLException
sqlStr - - the query
java.sql.SQLExceptionbuildSelectQuery(Vector, Vector, String)
public int execNonSelectQuery(java.lang.String sqlStr)
throws java.sql.SQLException
sqlStr - - the query
java.sql.SQLException
public long execInsertQuery(java.lang.String sqlStr)
throws java.sql.SQLException
java.sql.SQLException
public boolean buildSelectQuery(java.util.Vector selColumn,
java.util.Vector tables,
java.lang.String whereParam)
throws java.sql.SQLException
selColumn - - Vector, containing the columns from which selection is madetables - - Vector, containing the tables from which selection is madewhereParam - - the select condition
java.sql.SQLExceptionexecSelectQuery(String)
public long buildInsertQuery(java.util.Vector columnNames,
java.util.Vector values,
java.lang.String tableName)
throws java.sql.SQLException
columnNames - - Vector, containing the columns in which we want to insert a valuevalues - - Vector, containing the values to be insertedtableName - - the name of the table in which we want to insert
java.sql.SQLException
public long buildInsertQuery(java.util.Hashtable pair,
java.lang.String tableName)
throws java.sql.SQLException
pair - - a hashtable,containing the elements(as keys), that must be inserted and the new valuestableName - - the name of the table, in which we have to insert
java.sql.SQLException
public int buildUpdateQuery(java.util.Hashtable pair,
java.lang.String table,
java.lang.String whereParam)
throws java.sql.SQLException
pair - - a hashtable,containing the elements(as keys), that must be modified and the new valuestable - - the name of the table,that must be modifiedwhereParam - - the where clause in the query statement
java.sql.SQLException
public int buildDeleteQuery(java.lang.String sqlStr)
throws java.sql.SQLException
sqlStr - - the query string
java.sql.SQLExceptionpublic java.util.Hashtable getHashtable()
public java.util.Vector getColumn(java.lang.String key)
getColumn in class FwBaseBean
public void set(java.lang.String key,
java.lang.String set)
throws java.sql.SQLException
java.sql.SQLException
public void set(java.lang.String key,
java.util.Vector set)
throws java.sql.SQLException
java.sql.SQLExceptionpublic void setStore(boolean stored)
public boolean isStore()
public java.lang.String getDataBase()
public void setDataBase(java.lang.String n)
public static java.lang.String encodeSQL(java.lang.String s)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||