com.java4less.rreport
Class RJDBCSource

java.lang.Object
  |
  +--com.java4less.rreport.RJDBCSource
All Implemented Interfaces:
RSource

public class RJDBCSource
extends java.lang.Object
implements RSource

Uses a database table (or a SQL query) as data source for an area.


Field Summary
 boolean allowParameters
          If true, the [%] parameters in the SQL statement will be replaced with the values provided (see setParameter()).
 java.awt.Frame parentFrame
          to be used by RReport Visual Builder.
 boolean promptForParameters
          to be used by RReport Visual Builder.
 
Constructor Summary
RJDBCSource(java.sql.Statement pst, java.lang.String psSQL)
          The fields' names in the select command (psSQL) must match the elements' names in the area.
 
Method Summary
 java.lang.String getFilter()
          current filter that will be used to contruct the SQL statement.
 java.lang.String[] getFromFields()
          field names in the linked RJDBCSource used for the relationship (this is normally the primary key).
 RSource getLinkSource()
          linked RJDBCSource.
 java.sql.Statement getStatement()
          gets or sets the Statement object used for executing the SQL query.
 java.lang.String[] getToFields()
          field names in this RDBCSource used for the relationship (this is normally a foreign key).
 void rsource_end()
          closes table
 java.lang.Object rsource_getData(java.lang.String FieldName)
          get value for field "Fieldname".
 boolean rsource_nextRecord()
          get next record in table
 boolean rsource_start()
          opens database table
 void setFilter(java.lang.String s)
          current filter that will be used to contruct the SQL statement.
 void setFromFields(java.lang.String[] s)
          field names in the linked RJDBCSource used for the relationship (this is normally the primary key).
 void setLinkSource(RJDBCSource l)
          linked RJDBCSource.
 void setLinkSource(RSource l)
          linked RJDBCSource.
 void setParameter(java.lang.String param, java.lang.String value)
          sets a value for a parameter.
 void setSQL(java.lang.String s)
          changes the sql of this data source
 void setStatement(java.sql.Statement pst)
          gets or sets the Statement object used for executing the SQL query.
 void setToFields(java.lang.String[] s)
          field names in this RDBCSource used for the relationship (this is normally a foreign key).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parentFrame

public java.awt.Frame parentFrame
to be used by RReport Visual Builder. Required if promptForParameters=true.

promptForParameters

public boolean promptForParameters
to be used by RReport Visual Builder. If true, you will be prompted for the missing parameters.

allowParameters

public boolean allowParameters
If true, the [%] parameters in the SQL statement will be replaced with the values provided (see setParameter()). The default is true.
Constructor Detail

RJDBCSource

public RJDBCSource(java.sql.Statement pst,
                   java.lang.String psSQL)
The fields' names in the select command (psSQL) must match the elements' names in the area.
Method Detail

setParameter

public void setParameter(java.lang.String param,
                         java.lang.String value)
sets a value for a parameter. SQL stattments may ccontain parameters in the form of [%paramname]. For example: "Select * from table where id=[%parameter1]". Use myRJDBCSource.setParameter("Parameter1" ,value) before you run the report.
Specified by:
setParameter in interface RSource

setSQL

public void setSQL(java.lang.String s)
changes the sql of this data source

getStatement

public java.sql.Statement getStatement()
gets or sets the Statement object used for executing the SQL query.

setStatement

public void setStatement(java.sql.Statement pst)
gets or sets the Statement object used for executing the SQL query.

getLinkSource

public RSource getLinkSource()
linked RJDBCSource. Please see: Using a database.
Specified by:
getLinkSource in interface RSource

setLinkSource

public void setLinkSource(RJDBCSource l)
linked RJDBCSource. Please see: Using a database.

setLinkSource

public void setLinkSource(RSource l)
linked RJDBCSource. Please see: Using a database.
Specified by:
setLinkSource in interface RSource

getFromFields

public java.lang.String[] getFromFields()
field names in the linked RJDBCSource used for the relationship (this is normally the primary key).
Specified by:
getFromFields in interface RSource

getToFields

public java.lang.String[] getToFields()
field names in this RDBCSource used for the relationship (this is normally a foreign key).
Specified by:
getToFields in interface RSource

setFromFields

public void setFromFields(java.lang.String[] s)
field names in the linked RJDBCSource used for the relationship (this is normally the primary key).
Specified by:
setFromFields in interface RSource

setToFields

public void setToFields(java.lang.String[] s)
field names in this RDBCSource used for the relationship (this is normally a foreign key).
Specified by:
setToFields in interface RSource

getFilter

public java.lang.String getFilter()
current filter that will be used to contruct the SQL statement. For example "date < '01/01/2001' ". This will be added to the psSQL parameter in the constructor.

setFilter

public void setFilter(java.lang.String s)
current filter that will be used to contruct the SQL statement. For example "date < '01/01/2001' ". This will be added to the psSQL parameter in the constructor.

rsource_getData

public java.lang.Object rsource_getData(java.lang.String FieldName)
get value for field "Fieldname".
Specified by:
rsource_getData in interface RSource

rsource_nextRecord

public boolean rsource_nextRecord()
get next record in table
Specified by:
rsource_nextRecord in interface RSource

rsource_start

public boolean rsource_start()
opens database table
Specified by:
rsource_start in interface RSource

rsource_end

public void rsource_end()
closes table
Specified by:
rsource_end in interface RSource