Hi Sergio,ok, I rewrite the patch for the 1.1.4 branch
Thanks for your patches!!!
Currently we are working on an new version v1.1.4 with rewritten navigation system. You can get this version if you check out the 1_1_4dev branch from SourceForge.
Copy event and formatting ideas sounds very interesting!you are right, but we actually using filter only, and the changes needed to the search subsystem are a little more consistent.
The case sensitive mode is interesting, too. But what's about using this
mode not only in filters? I think it should be possible to use it in
searching, too.
with that patch you can use CLOB to map dbforms's CHAR types, to overcome to the 4000 char max of the varchar type. An
Thanks for the clob patch. Do you you have an patch for storing the clobs back into the db, too?
explicit cast is necessary to read from CLOB, but the JDBC PrepareStatement.setString is
is used to write back data to db (the CLOB type is hidden by JDBC tier).
Anyway, in the 1.1.4 branch it seems to be hard to use a CLOB field in this way, so I'll take some time to find a way for it.
Here the patch for case sensitive filtering:
The default string comparing mode became case unsensitive, and switch to case sensitive mode is done adding "iscasesensitive," in the beginning of the filter string.
------------------------- CUT HERE ------------------------------
? case_sensitive_patch.txt
Index: org/dbforms/taglib/DbFormTag.java
===================================================================
RCS file: /cvsroot/jdbforms/dbforms/src/org/dbforms/taglib/DbFormTag.java,v
retrieving revision 1.42.2.10
diff -u -r1.42.2.10 DbFormTag.java
--- org/dbforms/taglib/DbFormTag.java 4 Jun 2003 10:08:10 -0000 1.42.2.10
+++ org/dbforms/taglib/DbFormTag.java 4 Jul 2003 10:50:59 -0000
@@ -1968,7 +1968,9 @@
private void initFilterFieldValues()
{
// 1 to n fields may be mapped
- Vector keyValPairs = ParseUtil.splitString(filter, ",;");
+ boolean isCaseSensitive = ParseUtil.isCaseSensitive(filter);
+ Vector keyValPairs = ParseUtil.parseFilter(filter);
+ // ~ no longer used as separator!
int len = keyValPairs.size();
@@ -2072,8 +2074,8 @@
logCat.debug("Filter value=" + value);// Create a new instance of FieldValue and set the operator variable
- filterFieldValues[i] = new FieldValue(filterField, value, operator,
- isLogicalOR);
+ filterFieldValues[i] = new FieldValue(filterField, value, operator,
+ isLogicalOR, isCaseSensitive);
logCat.debug("and fv is =" + filterFieldValues[i].toString());
}
}
Index: org/dbforms/util/FieldValue.java
===================================================================
RCS file: /cvsroot/jdbforms/dbforms/src/org/dbforms/util/Attic/FieldValue.java,v
retrieving revision 1.1.2.3
diff -u -r1.1.2.3 FieldValue.java
--- org/dbforms/util/FieldValue.java 1 Jun 2003 19:00:57 -0000 1.1.2.3
+++ org/dbforms/util/FieldValue.java 4 Jul 2003 10:51:04 -0000
@@ -81,6 +81,9 @@
/** specifies whether to OR all values or AND them... */
private boolean logicalOR = false;
+ /** specifies the string comparing mode */
+ private boolean isCaseSensitive = true;
+
/** holds the FileHolder object */
private FileHolder fileHolder;@@ -141,6 +144,22 @@
}/**
+ * constructor
+ *
+ * @param field
+ * @param fieldValue
+ * @param renderHiddenHtmlTag
+ * @param operator
+ * @param isLogicalOr
+ * @param isCaseSensitive
+ */
+ public FieldValue(Field field, String fieldValue, int operator, boolean isLogicalOR, boolean isCaseSensitive)
+ {
+ this(field,fieldValue, operator, isLogicalOR);
+ this.isCaseSensitive = isCaseSensitive;
+ }
+
+ /**
* Gets the operator attribute of the FieldValue object
*
* @return The operator value
@@ -306,6 +325,22 @@
/** + * @return boolean + */ + public boolean isCaseSensitive() { + return isCaseSensitive; + } + + /** + * Sets the isCaseSensitive. + * @param isCaseSensitive The isCaseSensitive to set + */ + public void setCaseSensitive(boolean isCaseSensitive) { + this.isCaseSensitive = isCaseSensitive; + } + + + /** * Build the WHERE clause string using the input field values. * * @param fv the array of FieldValue objects @@ -343,7 +378,11 @@ } else { - buf.append(f.getName()); + //Borghi case insensitive search + if(!fv[i].isCaseSensitive() && f.getType()==FieldTypes.CHAR) + buf.append("UPPER("+f.getName()+")"); + else + buf.append(f.getName()); }
// Check what type of operator is required
@@ -776,8 +815,10 @@
break;default:
- SqlUtil.fillPreparedStatement(ps, curCol, valueStr,
- curField.getType());
+ if(!cur.isCaseSensitive() && curField.getType()==FieldTypes.CHAR)
+ SqlUtil.fillPreparedStatement(ps, curCol, valueStr.toUpperCase(), curField.getType());
+ else
+ SqlUtil.fillPreparedStatement(ps, curCol, valueStr, curField.getType());
curCol++;
}
@@ -854,4 +895,5 @@
{
this.fileHolder = fileHolder;
}
+
}
Index: org/dbforms/util/ParseUtil.java
===================================================================
RCS file: /cvsroot/jdbforms/dbforms/src/org/dbforms/util/ParseUtil.java,v
retrieving revision 1.9.2.4
diff -u -r1.9.2.4 ParseUtil.java
--- org/dbforms/util/ParseUtil.java 1 Jun 2003 19:00:59 -0000 1.9.2.4
+++ org/dbforms/util/ParseUtil.java 4 Jul 2003 10:51:04 -0000
@@ -260,6 +260,52 @@
return result;
}+ /**
+ * Borghi: parseFilter comma-safe
+ */
+ public static Vector parseFilter(String str)
+ {
+ Vector temp = splitString(str, ",");
+ Vector result = new Vector();
+ int len = temp.size();
+ StringBuffer token = new StringBuffer();
+ for (int i=len-1;i>=0;i--)
+ {
+ if(((String)temp.elementAt(i)).trim().toLowerCase().startsWith("iscasesensitive"))
+ continue;
+ token.insert(0,(String)temp.elementAt(i));
+ if (token.toString().indexOf('=')!=-1 ||
+ token.toString().indexOf('<')!=-1 ||
+ token.toString().indexOf('>')!=-1 ||
+ token.toString().indexOf('~')!=-1)
+ {
+ result.addElement(token.toString());
+ token = new StringBuffer();
+ }
+ else
+ {
+ token.insert(0,',');
+ }
+ logCat.debug("########Filter token="+token.toString());
+ }
+ Collections.reverse(result);
+ return result;
+ }
+
+ public static boolean isCaseSensitive(String filter)
+ {
+ logCat.debug("The filter is: "+filter);
+ if(filter.toLowerCase().trim().indexOf("iscasesensitive,")!=-1)
+ {
+ logCat.debug("The filter is case sensitive");
+ return true;
+ }
+ else
+ {
+ logCat.debug("The filter is not case sensitive");
+ return false;
+ }
+ }
/**
<p>Method for parsing substring embedded by constant delimeters</p>
---------------------------- CUT HERE ---------------------------------
------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01 _______________________________________________ DbForms Mailing List
http://www.wap-force.net/dbforms
