portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser BrowserQuery.java DatabaseBrowserAction.java
Date Tue, 07 May 2002 05:02:30 GMT
taylor      02/05/06 22:02:30

  Modified:    src/java/org/apache/jetspeed/modules/actions/portlets/browser
                        BrowserQuery.java DatabaseBrowserAction.java
  Log:
  - added jdbc query parameter support to the browser SQL (prepared statement)
  
  Revision  Changes    Path
  1.6       +13 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser/BrowserQuery.java
  
  Index: BrowserQuery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser/BrowserQuery.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BrowserQuery.java	12 Apr 2002 21:28:04 -0000	1.5
  +++ BrowserQuery.java	7 May 2002 05:02:30 -0000	1.6
  @@ -54,6 +54,7 @@
   
   package org.apache.jetspeed.modules.actions.portlets.browser;
   
  +import java.util.List;
   
   import org.apache.turbine.util.RunData;
   
  @@ -63,7 +64,7 @@
    * Browser Query Fetch Interface
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  - * @version $Id: BrowserQuery.java,v 1.5 2002/04/12 21:28:04 taylor Exp $
  + * @version $Id: BrowserQuery.java,v 1.6 2002/05/07 05:02:30 taylor Exp $
    *
   */
   public interface BrowserQuery
  @@ -75,5 +76,16 @@
        *
        */
       public String getQueryString(RunData rundata, Context context);
  +
  +    /*
  +     * Set a list of JDBC query parameters.
  +     * All members of this list must be java objects (not primitives)
  +     * Should be called from derived classes.
  +     *
  +     */
  +    public void setSQLParameters(List parameters);
  +
  +    public List getSQLParameters();
  +
   
   }
  
  
  
  1.17      +20 -1     jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser/DatabaseBrowserAction.java
  
  Index: DatabaseBrowserAction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/browser/DatabaseBrowserAction.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- DatabaseBrowserAction.java	2 May 2002 02:41:33 -0000	1.16
  +++ DatabaseBrowserAction.java	7 May 2002 05:02:30 -0000	1.17
  @@ -112,7 +112,7 @@
    * according to the quey speciified by the user.
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
  - * @version $Id: DatabaseBrowserAction.java,v 1.16 2002/05/02 02:41:33 taylor Exp $
  + * @version $Id: DatabaseBrowserAction.java,v 1.17 2002/05/07 05:02:30 taylor Exp $
    */
   public class DatabaseBrowserAction extends VelocityPortletAction implements BrowserQuery
   {
  @@ -140,6 +140,7 @@
       private static final String PEID = "js_peid";
       private static final String SORT_COLUMN_NAME = "js_dbcolumn";
   
  +    private List sqlParameters = new Vector();
   
       /**
        * Build the maximized state content for this portlet. (Same as normal state).
  @@ -369,6 +370,14 @@
               dbConn = TurbineDB.getConnection();
               Connection con = dbConn.getConnection();
               selectStmt = con.prepareStatement(sql);
  +            Iterator it = sqlParameters.iterator();
  +            int ix = 0;
  +            while (it.hasNext())
  +            {
  +                ix++;
  +                Object object = it.next();
  +                selectStmt.setObject(ix, object);
  +            }
               rs = selectStmt.executeQuery();
               ResultSetMetaData rsmd = rs.getMetaData();
               int columnNum = rsmd.getColumnCount();
  @@ -651,6 +660,16 @@
           }
           return start;
   
  +    }
  +
  +    public void setSQLParameters(List parameters)
  +    {
  +        this.sqlParameters = parameters;
  +    }
  +
  +    public List getSQLParameters()
  +    {
  +        return sqlParameters;
       }
   
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message