froehlich 01/11/18 06:40:29
Modified: apps/db/src/java/org/apache/avalon/db/basic/actions
BasicSelect.java
Log:
added column check
Revision Changes Path
1.27 +15 -17
jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicSelect.java
Index: BasicSelect.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/BasicSelect.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- BasicSelect.java 2001/11/17 17:31:01 1.26
+++ BasicSelect.java 2001/11/18 14:40:29 1.27
@@ -128,7 +128,7 @@
if(!mWhereBuffer.toString().equals("")) {
RhinoHelper rh = new RhinoHelper();
Matched rc = new Matched();
- ConstantColumn cc = new ConstantColumn();
+ ColumnCheck cc = new ColumnCheck();
TestHelper testHelper = new TestHelper();
rh.addBean("row",row);
rh.addBean("cc",cc);
@@ -153,10 +153,19 @@
}
}
- public class ConstantColumn {
- public Column getConstantColumn(String name, String value) {
+ public class ColumnCheck {
+
+ public Column getColumn(BasicTable table, String name) {
+ if(table.getColumn(name,false) == null) {
+ return getConstantColumn("constantcolumn",name);
+ } else {
+ return table.getColumn(name);
+ }
+ }
+
+ private Column getConstantColumn(String name, String value) {
return new StringConstantColumn(name,value);
- }
+ }
}
private boolean checkSelectStructure(Element rootElement) {
@@ -332,17 +341,6 @@
operator = (String)enum.nextElement();
getLogger().debug("matching operator = " + operator);
getLogger().debug("matching function = " +
mOperators.get(operator));
- /*
- StringTokenizer strtok = new StringTokenizer(expr,operator);
- strarr = new String[strtok.countTokens()];
- int cnt = 0;
- while(strtok.hasMoreElements()) {
- String s = (String)strtok.nextElement();
- getLogger().debug("s=" + s);
- strarr[cnt] = s;
- cnt++;
- }
- */
RE re = new RE(operator);
strarr = re.split(expr);
if(strarr.length > 1) {
@@ -351,8 +349,8 @@
result = strarr;
}
}
- method = "testHelper." + method + "(table.getColumn(\"" +
result[0]
- + "\"),cc.getConstantColumn(\"constantcolumn\",\"" +
result[1] + "\"),row)";
+ method = "testHelper." + method + "(cc.getColumn(table,\"" +
result[0]
+ + "\"),cc.getColumn(table,\"" + result[1] + "\"),row)";
getLogger().debug("method=" + method);
} catch (RESyntaxException rse) {
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>