[cvs]
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj
DBObject.java
JCorporate Ltd
jcorp at jcorp2.servlets.net
Mon Jun 7 12:02:00 PDT 2004
Update of /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj
In directory jcorp2.servlets.net:/tmp/cvs-serv13437/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj
Modified Files:
DBObject.java
Log Message:
DBObject.deleteAll failed with customWhereClause because this clause is erased by searchAndRetrieveList(). Reset clause each time through our (memory safe) 100-at-a-time loop. Also, getCustomWhereClause already has 'WHERE' prepended, so remove this when re-appending.
Index: DBObject.java
===================================================================
RCS file: /home/javacorp/.cvs/expresso/expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/core/dbobj/DBObject.java,v
retrieving revision 1.194
retrieving revision 1.195
diff -C2 -d -r1.194 -r1.195
*** DBObject.java 28 May 2004 19:14:52 -0000 1.194
--- DBObject.java 7 Jun 2004 19:01:58 -0000 1.195
***************
*** 239,242 ****
--- 239,243 ----
};
private static Logger slog = null;
+ public static final String WHERE_KEYWORD = " WHERE ";
/**
***************
*** 1898,1905 ****
}
- if (customWhereClause != null) {
- testObject.setCustomWhereClause(getCustomWhereClause(), appendCustomWhere);
- }
-
testObject.setMaxRecords(100);
--- 1899,1902 ----
***************
*** 1911,1915 ****
ArrayList al = new ArrayList(100);
do {
! al = testObject.searchAndRetrieveList();
num = al.size();
for (Iterator i = al.iterator(); i.hasNext();) {
--- 1908,1916 ----
ArrayList al = new ArrayList(100);
do {
! if (customWhereClause != null) {
! testObject.setCustomWhereClause(getCustomWhereClause().substring(WHERE_KEYWORD.length()),
! appendCustomWhere);
! }
! al = testObject.searchAndRetrieveList(); // will clear custom where clause
num = al.size();
for (Iterator i = al.iterator(); i.hasNext();) {
***************
*** 1918,1922 ****
}
! al.clear();
} while (num >= 100);
--- 1919,1923 ----
}
! al.clear(); // help gc
} while (num >= 100);
***************
*** 4370,4374 ****
String cacheName = myClassName + ".validValues";
! CacheSystem cs = CacheManager.getInstance().getCacheSystem(getDataContext());
if (cs != null) {
if (!cs.existsCache(cacheName)) {
--- 4371,4376 ----
String cacheName = myClassName + ".validValues";
! CacheManager.getInstance();
! CacheSystem cs = CacheManager.getCacheSystem(getDataContext());
if (cs != null) {
if (!cs.existsCache(cacheName)) {
***************
*** 4600,4604 ****
// *PP* 27/12/2002
String cacheName = myClassName + "." + oneLocale.toString() + ".validValues";
! CacheSystem cs = CacheManager.getInstance().getCacheSystem(getDataContext());
if (cs != null && !cs.existsCache(cacheName)) {
--- 4602,4607 ----
// *PP* 27/12/2002
String cacheName = myClassName + "." + oneLocale.toString() + ".validValues";
! CacheManager.getInstance();
! CacheSystem cs = CacheManager.getCacheSystem(getDataContext());
if (cs != null && !cs.existsCache(cacheName)) {
***************
*** 5212,5216 ****
*/
protected CacheUtils getCacheUtil() {
! return this.cacheUtils;
}
--- 5215,5219 ----
*/
protected CacheUtils getCacheUtil() {
! return cacheUtils;
}
***************
*** 5231,5235 ****
/* valid value cache */
try {
! CacheSystem cs = CacheManager.getInstance().getCacheSystem(getDataContext());
//Caching is not enabled if cs == null
if (cs == null) {
--- 5234,5239 ----
/* valid value cache */
try {
! CacheManager.getInstance();
! CacheSystem cs = CacheManager.getCacheSystem(getDataContext());
//Caching is not enabled if cs == null
if (cs == null) {
***************
*** 5475,5479 ****
throws DBException {
try {
! CacheManager.getInstance().removeItem(theDBObj.getDataContext(),
theDBObj.myClassName, theDBObj);
} catch (CacheException ce) {
--- 5479,5484 ----
throws DBException {
try {
! CacheManager.getInstance();
! CacheManager.removeItem(theDBObj.getDataContext(),
theDBObj.myClassName, theDBObj);
} catch (CacheException ce) {
***************
*** 5564,5568 ****
throws DBException {
! CacheSystem cs = CacheManager.getInstance().getCacheSystem(getDataContext());
if (cs == null) {
return false;
--- 5569,5574 ----
throws DBException {
! CacheManager.getInstance();
! CacheSystem cs = CacheManager.getCacheSystem(getDataContext());
if (cs == null) {
return false;
***************
*** 5818,5821 ****
--- 5824,5829 ----
* NOTE: Criteria in 'text' type colums is ignored (SQL Server limitation)
*
+ * SIDE-EFFECT: custom 'where' clause is set to null.
+ *
* @return Vector A vector of new database objects containing the results
* of the search
***************
*** 6168,6172 ****
* where clause is built from the field values in the object.
*
! * @param newCustomWhere java.lang.String
*/
public synchronized void setCustomWhereClause(String newCustomWhere) {
--- 6176,6180 ----
* where clause is built from the field values in the object.
*
! * @param newCustomWhere java.lang.String string with clause. Do NOT add 'WHERE' keyword--this is prepended by system, so that multiple calls to append can be made
*/
public synchronized void setCustomWhereClause(String newCustomWhere) {
***************
*** 6178,6182 ****
* one built from the field values in the object
*
! * @param newCustomWhere java.lang.String
* @param append if true, custom WHERE clause is appended
*/
--- 6186,6190 ----
* one built from the field values in the object
*
! * @param newCustomWhere java.lang.String string with clause. Do NOT add 'WHERE' keyword--this is prepended by system, so that multiple calls to append can be made
* @param append if true, custom WHERE clause is appended
*/
***************
*** 6189,6193 ****
customWhereClause = null;
} else {
! customWhereClause = " WHERE " + newCustomWhere;
}
}
--- 6197,6201 ----
customWhereClause = null;
} else {
! customWhereClause = WHERE_KEYWORD + newCustomWhere;
}
}
***************
*** 6196,6200 ****
/**
! * Allows us to query the custom where clause (if any)
* @return java.lang.String or null if no custom where clause has been set.
*/
--- 6204,6209 ----
/**
! * Allows us to query the custom where clause (if any). ' WHERE ' has been prepended to the clause.
! * You may want to remove this prepended info for reuse, e.g. getCustomWhereClause().substring(WHERE_KEYWORD.length())
* @return java.lang.String or null if no custom where clause has been set.
*/
More information about the cvs
mailing list