com.sap.aii.mapping.lookup

Class DataBaseAccessor

java.lang.Object
  extended by com.sap.aii.mapping.lookup.DataBaseAccessor

public final class DataBaseAccessor
extends Object

Accessor for data base lookups. Use this accessor to execute SQL queries on a data base. You get an instance with help of the service LookupService.

Since:
SAP NetWeaver '04 SPS 13

Method Summary
 void close()
          Closes this accessor and releases any resources associated with the accessor.
 DataBaseResult execute(String sqlStatement)
          Queries a data base by the given SQL statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

execute

public DataBaseResult execute(String sqlStatement)
                       throws LookupException
Queries a data base by the given SQL statement. An example is given in method close().

Note: The SQL statement is packed into an XML during the processing. Therefore the reserved XML markup characters '&', '"', '<', '>', and ''' are escaped to "&amp;", "&quot;", "&lt;", "&gt;", and "&apos;"; exception: If the given SQL statement does already contain the escaped character sequences "&amp;", "&quot;", "&lt;", "&gt;", or "&apos;" then the character '&' is not escaped in these character sequences. During the parsing of the XML a unescaping is executed. Therefore, for example, if you want to query for data-base table entries containing in the column A the character sequence "&amp;", then you have to use the following where condition in the SQL statement: where A ='&amp;amp;'.

The accessor does not support transactional behaviour. Therefore, the method should not be used to execute insert or update statements on the data base which can lead to inconsistencies. The accessor should only be used to read data from a data base table.

Parameters:
sqlStatement - SQL statement
Returns:
database result set
Throws:
LookupException - if an error occurs.
NullPointerException - if sqlStatement is null.

close

public void close()
           throws LookupException
Closes this accessor and releases any resources associated with the accessor. Especially the returned result set is closed. Invoking of the call method is not allowed after this method has been called.

The method must be called using the secure cleanup idiom:

Throws:
LookupException - if an error occurs.


Copyright 2007 SAP AG Complete Copyright Notice