|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.toften.jlips.persist.db.DBAbstractStatement
public abstract class DBAbstractStatement
SQL statement which direct implementation of the DBStatement
interface can extend.
The class implements a set of helper method designed to assist in generating the
SQL statements for the database request
Field Summary | |
---|---|
protected List |
expressions
Holds the expressions passed in by jLips |
protected Connection |
myCon
Holds the database connection |
protected Object |
primaryKeyValue
Holder for valued to be changed by the statement |
protected List |
returnColumns
Holds the return columns requested by jLips |
protected List |
sourceTables
Holds the source tables requested by jLips |
Constructor Summary | |
---|---|
DBAbstractStatement()
|
Method Summary | |
---|---|
void |
addEqualExpression(DBTableColumnInfo newColumn,
Object value)
|
void |
addReturnColumn(DBTableColumnInfo newReturnColumn)
|
void |
addSourceTable(DBTableInfo newTable)
|
protected void |
appendColumnNames(StringBuffer s,
Iterator iter)
Appends column names to a StringBuffer using ", " as delimeter The column names are taken from an Iterator that must iterate over a Collection containing DBTableColumnInfo objects |
protected void |
appendPrimaryKeyEquals(StringBuffer s)
Will append a equal expression for the primary key for the first added source table This method will append an equal expression to the provided StringBuffer using the specified primary key value and the name of the primary key in the first source table added. |
protected void |
appendStrings(StringBuffer s,
Iterator iter,
String delimiter,
String preString)
Appends a list of strings to a StringBuffer using a defined delimiter. |
protected void |
appendTableNames(StringBuffer s,
Iterator iter)
Appends table names to a StringBuffer using ", " as delimeter The table names are taken from an Iterator that must iterate over a Collection containing DBTableInfo objects |
protected Statement |
prepareConnection()
Will request a database connection from the database connection factory and create a statement |
void |
release()
|
void |
setPrimaryKeyValue(Object pKey)
|
String |
toString()
Returns the provided data for the statement |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected List expressions
addEqualExpression(DBTableColumnInfo, Object)
protected Connection myCon
prepareConnection()
protected Object primaryKeyValue
#addSetValue(DBTableColumnInfo, Object)
protected List returnColumns
addReturnColumn(DBTableColumnInfo)
protected List sourceTables
addSourceTable(DBTableInfo)
,
addReturnColumn(DBTableColumnInfo)
Constructor Detail |
---|
public DBAbstractStatement()
Method Detail |
---|
public void addEqualExpression(DBTableColumnInfo newColumn, Object value)
DBStatement.addEqualExpression(DBTableColumnInfo, Object)
public void addReturnColumn(DBTableColumnInfo newReturnColumn)
DBStatement.addReturnColumn(DBTableColumnInfo)
public void addSourceTable(DBTableInfo newTable)
DBStatement.addSourceTable(DBTableInfo)
public void setPrimaryKeyValue(Object pKey)
DBStatement.setPrimaryKeyValue(Object)
protected void appendColumnNames(StringBuffer s, Iterator iter)
s
- StringBuffer to append column names toiter
- Iterator for Collection containing DBTableColumnInfo objectsDBTableColumnInfo
protected void appendStrings(StringBuffer s, Iterator iter, String delimiter, String preString)
s
- StringBuffer to append strings toiter
- Iterator for Collection containing String objectsdelimiter
- The delimeter used between the stringspreString
- String appended before every stringprotected void appendTableNames(StringBuffer s, Iterator iter)
s
- StringBuffer to append table names toiter
- Iterator for Collection containing DBTableInfo objectsDBTableInfo
protected void appendPrimaryKeyEquals(StringBuffer s) throws DBBadPropertiesException
person
:
dbs.addSourceTable(personTableInfo);and the primary key name of the
person
table is id
and the type of the primary key is Integer
then the added expression is
id = 1This is of course if the provided primary key value is 1:
dbs.setPrimaryKeyValue(new Integer(1));
s
- StringBuffer to append the equal string to
DBBadPropertiesException
public void release()
DBStatement.release()
protected Statement prepareConnection() throws SQLException
SQLException
- passed from the connection factoryDBConnectionFactory.getConnection()
,
#s
public String toString()
toString
in class Object
Object.toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |