myClassName We use getClass().getName() a lot in this class, however, it takes
actually significant time to use this over the time it takes to do, say,
a concurrentReaderHashMap lookup.
buildWhereClause(boolean useAllFields) Build and return a string consisting of an SQL 'where' clause
using the current field values as criteria for the search.
buildWhereClauseBuffer(boolean useAllFields, FastStringBuffer allocatedBuffer) Build and return a FastStringBuffer ring consisting of an SQL 'where' clause
using the current field values as criteria for the search.
public boolean
checkZeroUpdate() Returns the checkzero update as defined by the object's metadata.
getSerialForm(DataFieldMetaData theField) This function is called whenever the DBField is about to be written to
the database.
public void
loadFromConnection(JDBCDataObject myObj, DBConnection myConnection, ArrayList retrievedFieldList) Fills the given constructed data object with data from the connection
given the field order specified in retrievedFieldList.
makeLimitationStub(DBConnection theConnection) Creates the limitation syntax optimisation stub
to embed inside the SQL command that performs
search and retrieve.
This method takes the limitation syntax string
and performs a string replacement on the following
tokens
%offset%
the number of rows in the ResultSet to skip
before reading the data.
%maxrecord%
the maximum number of rows to read from the ResultSet.
Also known as the rowlength.
%endrecord%
the last record of in the ResultSet that the
search and retrieved should retrieve.
quoteIfNeeded(String fieldName, String rangeString) Return the value of this field, placing double quotes around it if the
field's datatype requires it.
This flag tells the buildWhereClause method(s) to either be case
sensitive (normal queries) or to be case insensitive. The case
insensitive query is useful when you want to do a search and retreive
and want case insensitive matching.
We use getClass().getName() a lot in this class, however, it takes
actually significant time to use this over the time it takes to do, say,
a concurrentReaderHashMap lookup. So we precalculate this value at
instantiation and go from there.
The number of records we must skip over before we start reading
the ResultSet proper in a searchAndRetrieve.
0 means no limit
author Peter Pilgrim, Thu Jun 21 10:30:59 BST 2001
DBObjects themselves do not contain the "meta data" or the definition of
what fields they contain and other information. Instead, a DBObjectRef object
(one per TYPE of DBObject) contains this info and is looked up as needed.
This HashMap contains the DBObjectRef objects for all initialized DBObjects
Add a new field to the list of fields that are part of this
object's list of input parameters. Called after all of the "addField" calls in the setupFields()
method to specify which fields make up the primary key of this object.
Parameters: inFieldName - The name of the field to add as part of the key throws: DBException - if the field name is not valid or the fieldallows nulls
Add a new field to the list of fields that are part of this
object's list of output parameter. Called after all of the "addField" calls in the setupFields()
method to specify which fields make up the primary key of this object.
Parameters: outFieldName - The name of the field to add as part of the key throws: DBException - if the field name is not valid or the fieldallows nulls
Build and return a string consisting of an SQL 'where' clause
using the current field values as criteria for the search. See
setCustomWhereClause for information on specifying a more complex where clause.
Parameters: useAllFields - True if all fields are to be used,false for only key fields The where clause to use in a query.
Build and return a FastStringBuffer ring consisting of an SQL 'where' clause
using the current field values as criteria for the search. See
setCustomWhereClause for information on specifying a more complex where clause.
Parameters: useAllFields - True if all fields are to be used,false for only key fields Parameters: allocatedBuffer - - An already allocated FastStringBuffer to fill out.This allows for compatability with, for example, object pools. A FastStringBuffer containing the "where" clause for the SQL statement
Construction method to allow for specialized metadata with specialized
fields other than DBObjectDef. Override in classes that need custom
derived from DBObjectDef classes.
DBOBjectDef derived instance throws: DBException - upon construction error
Refactoring to split the execution of a query statement into the query
part and the load part. The DBConnection returned will have the query
already executed.
SIDE-EFFECT: custom 'where' clause is set to null.
Parameters: retrievedFieldList - instantiate an ArrayList and the function willfill out the field order that the SQL statement will have it's fields in. connection that has already executed the search statement.Modify by Yves Henri AMAIZO throws: DBException - upon database communication error since: $DatabaseSchema $Date: 2004/11/18 02:03:27 $
Refactoring to split the execution of a query statement into the query
part and the load part. The DBConnection returned will have the query
already executed, it is ready to
Parameters: retrievedFieldList - instantiate an ArrayList and the function willfill out the field order that the SQL statement will have it's fields in. connection that has already executed the search statement. throws: DBException - upon database communication error
Retrieve the connection pool associated with this DBObject.
DBConnectionPool instance for the current mapped context. throws: DataException - upon error getting the connection pool instance
This convenience method retrieve through the resultSet.MetaData
the date value of field define as date or time DBObject Parameters: connection - The DBConnection Parameters: oneFieldName - the field name to get the custom field value from Custom String value retrieve from resultSet according to metaData. throws: DBException - author Yves Henri AMAIZO
Return the DBObjectRef object that contains the definition of the current
DBObject. If there isn't one in the dbobjMetadata hashmap, initialize a new one
as required
static the DBObject Definition
Get a special ArrayList object list of all
of the fields in this object that are set to distinct
An Iterator of all thedistinct fieldNames in this object throws: DBException - If the list cannot be retrievedauthor Peter Pilgrim
Use this function to acquire the Executor interface that is associated
with this data object
DataExecutorInterface or null if no Executor has been associatedwith this object
Returns the name of the physical database that we're talking with. This
is opposed to getDataContext() which returns the security context as well.
getMappedDataContext() is strictly used to get at the low level database
connection.
java.lang.String... the underlying data context that is mappedto the physical database
Use this function to acquire the DataQueryInterface that is associated
with this data object
DataQueryInterface or null if no QueryInterface has beenassociated with this object
This function is called whenever the DBField is about to be written to
the database. It may do additional processing such as encryption depending
on the field attributes.
Parameters: theField - A DBField object the value to write to the data source. throws: DataException - upon error
Fills the given constructed data object with data from the connection
given the field order specified in retrievedFieldList. Similar to
loadFromConnection but much faster because the connection fields are
retrieved via number instead of name.
Parameters: myObj - the Object to have the values filled out. [in/out parameter] Parameters: myConnection - [in] the connection to retrieve the fields from Parameters: retrievedFieldList - [in] An array of Strings representing the fieldnames to retrieve in the order they exist in the connection. throws: DBException - upon error
Return the value of this field, placing double quotes around it if the
field's datatype requires it.
Parameters: fieldName - The name of the field to be used Parameters: rangeString - the appropriately formatted string A string, quoted if necessary, to be used in building an SQL statement throws: DBException - If there is no such field or it's value cannot bedetermined
Run a particular store procedure in the database into this object's fields
Vector A vector of new database objects containing the resultsof the search throws: DBException - If the record could not be retrieved.
Build an appropriate String for use in the select part of an SQL statement
by doing the
Parameters: fieldName - The name of the field to be handled The portion of the select clause with the appropriate functionwrapped around it
setCaseSensitiveQuery
public void setCaseSensitiveQuery(boolean caseSensitiveQuery)(Code)
This tells the buildWhereClause to either respect case (true) or
ignore case (false). You can call this method before doing a search and
retrieve if you want to match without worrying about case. For example
if you were to call this method with isCaseSensitiveQuery = FALSE
then this comparison would match in the search:
vendor_name actual value = "My Name"
query value = "my name"
This would match in a search and retrieve.
author Adam Rossi, PlatinumSolutions
Parameters: caseSensitiveQuery - boolean
Set a specific DB connection for use with this db object. If you do not set
a connection, the db object will request it's own connection from the
appropriate connection pool & release it again after every operation (e.g.
add, update, etc). It is important to use your own explicit connection when
dealing with a database transactional environment (e.g. commit(), rollback()).
Parameters: newConnection - The new DBConnection object to be used by this DB Object
Set a specific DB connection for use with this db object. If you do not set
a connection, the db object will request it's own connection from the
appropriate connection pool & release it again after every operation (e.g.
add, update, etc). It is important to use your own explicit connection when
dealing with a database transactional environment (e.g. commit(), rollback()).
The difference between this and setConnection(DBConnection) is that this
is used for using otherDB capabilities within a transaction. So you use
a dbconnection from your other pool, but the setup tables are in a different
context
Parameters: newConnection - The new DBConnection object to be used by this DB Object Parameters: setupTablesContext - the data context that is used for the expresso setup tables. See Also:JDBCDataObject.setConnection(DBConnection)
Sets the connection pool associated with this dbobject. Is only settable
from derived classes as we normally create our own as needed.
Parameters: newPool - the new DBConnectionPool to set
Set the database name/context for this db object. If setDBName is not called,
the "default" db name and context is used.
See com.jcorporate.expresso.core.misc.ConfigManager for information about
multiple contexts. Note that setting a db/context name only affects the
object when it allocates it's own db connections - if a specific connection
is used (via the setConnection(DBConnection) method) then that connection must
be already associated with the correct db/context.
If there is an entry in the DBOtherMap table for this object, it is forced to
that database, and a warning is logged if any other database is specified.
Parameters: newOther - The name of the context or database to use
Set the name of the db context that was the "original" context
for this object - e.g. before any database mapping took place.
Parameters: newOriginalName - new value to set
setTargetStoreProcedure
public synchronized void setTargetStoreProcedure(String theStoreProcedure) throws DBException(Code)
Set the target store procedure for this DBObject.
Parameters: theStoreProcedure - Table for this object throws: DBException - upon execution error.
Fields inherited from com.jcorporate.expresso.core.dataobjects.BaseDataObject