|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javaWebGen.data.DAO
public abstract class DAO
Base DAO(Data Access Object) object that handles running sql against the database.
| Field Summary | |
|---|---|
static int |
TOO_MANY_ROWS
|
static java.lang.String |
TOO_MANY_ROWS_WARNING
|
| Constructor Summary | |
|---|---|
protected |
DAO()
will get a data manager specified in the config file if it fails it will try to use the MySQL as a DataManager |
protected |
DAO(DataManager dataManager)
|
| Method Summary | |
|---|---|
protected void |
close(java.sql.Connection con)
|
protected java.lang.Object |
getColumnClass(int column,
java.sql.ResultSet result)
find the Object for a specified column |
protected java.sql.Connection |
getConnection()
returns a open connection to the database |
protected DataManager |
getDataManager()
|
protected int |
getNextValue(java.sql.Connection con,
java.lang.String tablename)
Calls the DataManager object for the next value for a primary key |
protected int |
getNextValue(java.lang.String tablename)
Calls the DataManager object for the next value for a primary key |
protected java.sql.ResultSet |
getResultSet(java.sql.Connection con,
java.lang.String sql)
get the result set after running a sql statment generaly only used to get the metadata by one of the code generators. |
protected java.util.ArrayList<java.lang.Object[]> |
query(java.sql.Connection con,
java.lang.String sql)
returns the results of running a sql statement Calling object is responsible for handleing data base conection Calling object should use the runQuery method because it returns more information |
protected java.util.ArrayList<java.lang.Object[]> |
query(java.sql.Connection con,
java.lang.String sql,
java.lang.Object[] parms)
returns the results of running a SQL statement Calling object is responsible for handling the data base connection |
protected java.util.ArrayList<java.lang.Object[]> |
query(java.lang.String sql)
returns the results of running a SQL statement Calling objects should use the runQuery method instead it returns more information |
protected java.util.ArrayList<java.lang.Object[]> |
query(java.lang.String sql,
java.lang.Object[] parms)
returns the results of running a sql statement and handles the database connection |
DbResult |
runQuery(java.sql.Connection con,
java.lang.String sql)
runs a SQL statemnt returning the resultes in a DbResult object The calling object is responsible for handling the connection to the data base. |
DbResult |
runQuery(java.sql.Connection con,
java.lang.String sql,
java.lang.Object[] parms)
runs an SQL statemnt returning the results in a DbResult object calling object should use this method. |
DbResult |
runQuery(java.lang.String sql)
runs an SQL statement returning the results in a DbResult object data base. |
DbResult |
runQuery(java.lang.String sql,
java.lang.Object[] parms)
runs an SQL statement returning the results in a DbResult object calling objects should use this method |
protected void |
setColumn(int index,
int type,
java.lang.Object column,
java.sql.PreparedStatement pstmt)
set a column in a prepared statement based on the java.sql.Type for that column |
protected int |
update(java.sql.Connection con,
java.lang.String sql)
make a change to a database using sql calling objects should handle the database connection |
protected int |
update(java.sql.Connection con,
java.lang.String sql,
java.lang.Object[] parms)
make a change to a database using sql |
protected int |
update(java.lang.String sql)
make a change to a database using sql |
protected int |
update(java.lang.String sql,
java.lang.Object[] parms)
make a change to a database using sql |
int |
updateDataBean(java.sql.Connection con,
java.lang.String sql,
DataBean databean)
runs an update to database based on a DataBean |
int |
updateDataBean(java.lang.String sql,
DataBean databean)
runs an update to database based on a DataBean |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int TOO_MANY_ROWS
public static final java.lang.String TOO_MANY_ROWS_WARNING
| Constructor Detail |
|---|
protected DAO(DataManager dataManager)
dataManager - data manager to use to talk to the databaseprotected DAO()
| Method Detail |
|---|
protected DataManager getDataManager()
protected java.sql.Connection getConnection()
throws DBException
DBExceptionprotected void close(java.sql.Connection con)
con - db connection to close
protected int update(java.lang.String sql)
throws java.sql.SQLException
sql - statement to change database
java.sql.SQLException
protected int update(java.sql.Connection con,
java.lang.String sql)
throws java.sql.SQLException
con - db connectionsql - statement to change database
java.sql.SQLException
protected int update(java.lang.String sql,
java.lang.Object[] parms)
throws java.sql.SQLException
sql - statement to change databaseparms - list of parms to pass the sql statement
java.sql.SQLException
protected int update(java.sql.Connection con,
java.lang.String sql,
java.lang.Object[] parms)
throws java.sql.SQLException
con - db connectionsql - statement to change databaseparms - to pass the sql
java.sql.SQLException
protected java.util.ArrayList<java.lang.Object[]> query(java.sql.Connection con,
java.lang.String sql,
java.lang.Object[] parms)
throws java.sql.SQLException
con - db connectionsql - to runparms - to pass to query
java.sql.SQLException
protected java.util.ArrayList<java.lang.Object[]> query(java.lang.String sql,
java.lang.Object[] parms)
throws java.sql.SQLException
sql - statement to run against the dbparms - to pass to the prepared staement
java.sql.SQLException
protected java.util.ArrayList<java.lang.Object[]> query(java.lang.String sql)
throws java.sql.SQLException
sql - statement
java.sql.SQLExceptionrunQuery(java.sql.Connection, java.lang.String)
protected java.util.ArrayList<java.lang.Object[]> query(java.sql.Connection con,
java.lang.String sql)
throws java.sql.SQLException
con - db connectionsql - to run
java.sql.SQLExceptionrunQuery(java.sql.Connection, java.lang.String)
public DbResult runQuery(java.sql.Connection con,
java.lang.String sql)
throws java.sql.SQLException
con - connection to DBsql - statement
java.sql.SQLException
public DbResult runQuery(java.lang.String sql)
throws java.sql.SQLException
sql - statement
java.sql.SQLException
public DbResult runQuery(java.sql.Connection con,
java.lang.String sql,
java.lang.Object[] parms)
throws java.sql.SQLException
con - connection to DBsql - statementparms - object[] of parameters to pass into the prepared statement
java.sql.SQLException
public DbResult runQuery(java.lang.String sql,
java.lang.Object[] parms)
throws java.sql.SQLException
sql - statementparms - to pass into the prepared statement returns
java.sql.SQLException
public int updateDataBean(java.lang.String sql,
DataBean databean)
throws DBException
sql - with where clausedatabean - with table data to update
DBExceptionDataBean
public int updateDataBean(java.sql.Connection con,
java.lang.String sql,
DataBean databean)
throws DBException
con - db connectionsql - with where clausedatabean - with table data to update
DBExceptionDataBean
protected java.lang.Object getColumnClass(int column,
java.sql.ResultSet result)
throws java.sql.SQLException
column - numberresult - resultset to work on (get matadata for)
java.sql.SQLException
protected void setColumn(int index,
int type,
java.lang.Object column,
java.sql.PreparedStatement pstmt)
throws java.sql.SQLException
index - of the row to start withtype - SQL data Typecolumn - datapstmt - the actual preparedStatement to set paramanters for
java.sql.SQLException
protected java.sql.ResultSet getResultSet(java.sql.Connection con,
java.lang.String sql)
throws java.sql.SQLException
con - db connectionsql - string
java.sql.SQLExceptionrunQuery(java.sql.Connection, java.lang.String)
protected int getNextValue(java.lang.String tablename)
throws DBException
tablename -
DBExceptionDataManager
protected int getNextValue(java.sql.Connection con,
java.lang.String tablename)
throws java.sql.SQLException
con - DB connectiontablename -
java.sql.SQLExceptionDataManager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||