Pages

02 November 2010

Dynamically changing the View Object's query WHERE clause

Excellent post by Nick:
http://adfcodebits.blogspot.com/2010/05/bit-18-dynamically-changing-view.html

I am just providing his code eg here



    @Override
    protected boolean buildWhereClause(StringBuffer sqlBuffer, int noBindVars) {

        // call ViewObjectImpl's buildWhereClause() to allow the framework to do its processing
        boolean hasWhereClause = super.buildWhereClause(sqlBuffer, noBindVars);

        if (hasWhereClause) { // framework added a WHERE clause
            // modify the WHERE clause as needed
        }
        else { // framework did not add a WHERE clause, so we need to add it ourselves
            // add a WHERE clause here
            hasWhereClause = true; // ensure that is set to notify the framework
        }

        return hasWhereClause; // return true/false to indicate whether a WHERE clause was added
    }    
  


Use the link above for more.

No comments:

Post a Comment