com.businessobjects.rebean.wi
Interface SQLDataProvider

All Superinterfaces:
DataProvider

public interface SQLDataProvider
extends DataProvider

Warning: This interface is no longer functional from the SAP BusinessObjects 4.0 release onwards.

The SQLDataProvider interface is a specialized DataProvider which supports the SQL query language.

Since:
11.5
See Also:
DataProvider, SQLContainer, SQLNode, SQLSelectStatement, SamplingMode

Method Summary
 boolean changeSQL()
          Replaces the previous SQL statement in the document with the new validated SQL Statement.
 boolean getDuplicatedRows()
          Returns true when identical rows in the database will be retrieved as often as they appear when a Query is executed.
 SamplingMode getSamplingMode()
          Gets database sampling method.
 int getSamplingSize()
          Returns number of row retrieved by database sampling.
 SQLContainer getSQLContainer()
          Returns the root SQLContainer for this SQLDataProvider.
 SQLContainer getSQLContainer(boolean resolvedSQL)
          This methods allows to retrieve an unresolved SQL.
 boolean isCustomSQL()
          Returns true if this SQLDataProvider contains SQL customized by the Web Intelligence user.
 void resetSQL()
          Changes the current SQL to the query generated SQL.
 void setDuplicatedRows(boolean allow)
          Set to true for identical rows to be retrieved as often as they appear in the database.
 void setSamplingMode(SamplingMode mode)
          Changes database supporting sampling mode to retrive rows SQLDataProvider.setSamplingSize(int) from database.
 void setSamplingSize(int size)
          Sets the number of rows retrieved by database sampling.
 boolean validateSQL()
          Validates the SQL and returns true if the new SQL statement is valid.
 
Methods inherited from interface com.businessobjects.rebean.wi.DataProvider
cancelQuery, clearContexts, copyCombinedQueries, executeQuery, generateQuery, getCombinedQueries, getDataSource, getDataSourceParameterValues, getDate, getDependents, getDuration, getFlowCount, getID, getName, getPromptOrder, getQuery, getQueryNode, getResult, getResultAsCSV, getResultAsXML, getResultAsXML, getResultExpressions, getRowCount, getSource, getSourceName, getSources, hasCombinedQueries, isIgnoredForRefresh, isPartialResult, isQuerySubmitted, isSampledData, isSupported, purge, purge, removeCombinedQueries, runQuery, setName
 

Method Detail

getSQLContainer

SQLContainer getSQLContainer()
Returns the root SQLContainer for this SQLDataProvider.

Returns:
The root SQLContainer.
Throws:
UnsupportedFeatureException - if DataProviderFeature.VIEW_SQL isn't granted.

getSQLContainer

SQLContainer getSQLContainer(boolean resolvedSQL)
This methods allows to retrieve an unresolved SQL. This is only useful so as to obtain Prompts definition.

Parameters:
resolvedSQL - if true, it behaves as SQLDataProvider.getSQLContainer(). If false, it retrieves the unresolved SQL.
Returns:
The root SQLContainer.
Throws:
UnsupportedFeatureException - if DataProviderFeature.VIEW_SQL isn't granted.

isCustomSQL

boolean isCustomSQL()
Returns true if this SQLDataProvider contains SQL customized by the Web Intelligence user.

Returns:
Returns false when the SQL contained in this instance has been generated by Web Intelligence, true when a user has customized the SQL and saved the document.

validateSQL

boolean validateSQL()
                    throws REException
Validates the SQL and returns true if the new SQL statement is valid.

This method returns false if the SQL contains at least one LOV prompt or nested prompt that is not filled. If this is the case, before calling validateSQL, DocumentInstance.getMustFillPrompts() must return false, that is to say, all prompts have been filled.

Example: The following example shows how to validate the SQL for a SQLDataProvider containing prompts.

 //dp is an instance of SQLDataProvider.
 boolean bValidate = dp.validateSQL();
 if (bValidate == false) {
     Prompts prompts = getDocument().getPrompts();
     for (int i = 0; i < prompts.getCount(); i++) {
         Prompt prompt = prompts.getItem(i);
         String val = ((prompt.getDefaultValues() != null && prompt
                 .getDefaultValues().length > 0) ? prompt.getDefaultValues()[0]
                 : "France");
         prompt.enterValues(new String[] { val });
     }
     getDocument().setPrompts();
     if (!getDocument().getMustFillPrompts()) {
         dp.changeSQL();
     }
 }
 

Note: Only FROM and WHERE clauses are modifiable if the user has sufficient rights. The SELECT clause is not customizable.

Returns:
Returns true when the customized SQL is valid.
Throws:
REException - If all prompts are filled and the SQL is invalid.
UnsupportedFeatureException - if DataProviderFeature#EDIT_SQL isn't granted.
See Also:
SQLSelectStatement.setSQL(String)

changeSQL

boolean changeSQL()
                  throws REException
Replaces the previous SQL statement in the document with the new validated SQL Statement.

Note: Business Objects recommends that customized SQL is validated using SQLDataProvider.validateSQL() before saving the new SQL statement by calling SQLDataProvider.changeSQL().

Returns:
Returns true if the SQL has been replaced.
Throws:
UnsupportedFeatureException - if DataProviderFeature#EDIT_SQL isn't granted.
REException - When an error occured.
See Also:
SQLDataProvider.validateSQL(), SQLSelectStatement.setSQL(String)

getDuplicatedRows

boolean getDuplicatedRows()
Returns true when identical rows in the database will be retrieved as often as they appear when a Query is executed.

Returns:
Returns true when identical rows will be retrieved as often as they appear in the database, or false when identical rows will be retrieved only once.

setDuplicatedRows

void setDuplicatedRows(boolean allow)
Set to true for identical rows to be retrieved as often as they appear in the database.

Parameters:
allow - Set to true for identical rows to be retrieved as often as they appear, false for identical rows to be retrieved once only.
Throws:
UnsupportedFeatureException - if DataProviderFeature.DUPLICATE_ROW isn't supported by server but value of allow is true.

resetSQL

void resetSQL()
Changes the current SQL to the query generated SQL. If the current SQL is not a customized SQL, nothing happens.

Throws:
ServerException - When an error occurred.
Since:
11.7

getSamplingMode

SamplingMode getSamplingMode()
Gets database sampling method.

Returns:
SamplingMode instance.
Since:
12.0

setSamplingMode

void setSamplingMode(SamplingMode mode)
Changes database supporting sampling mode to retrive rows SQLDataProvider.setSamplingSize(int) from database.

If mode is SamplingMode.FREE_RANDOM or SamplingMode.REPEATABLE_RANDOM, retrive rows will be managed by database sampling.

If fetchMode is SamplingMode.NONE, there is no database sampling and sampling size SQLDataProvider.getSamplingSize() will be 0.

The database sampling is allowed only if QueryContainer contains one simple Query.

Parameters:
mode - The value of SamplingMode instance.
Throws:
java.lang.NullPointerException - if mode is null.
QueryException - while set SamplingMode.FREE_RANDOM or SamplingMode.REPEATABLE_RANDOM but QueryContainer contains more than one query.
Since:
12.0
See Also:
SamplingMode

getSamplingSize

int getSamplingSize()
Returns number of row retrieved by database sampling.

If SQLDataProvider.getSamplingMode() returns SamplingMode.NONE, this call returns -1.

Returns:
number of row retrieved by database sampling.
Since:
12.0
See Also:
SamplingMode

setSamplingSize

void setSamplingSize(int size)
Sets the number of rows retrieved by database sampling.

Parameters:
size - the number of row should be retrieved by database sampling.
Since:
12.0
See Also:
SamplingMode