org.sqlproc.engine
Interface SqlFeature


public interface SqlFeature

The optional features are used to alter the behavior of the SQL Processor. They can be activated in the process of SQL Processor initialization.

The features can be incorporated into the meta statements file in the form of name(OPT)=...;.

For example the SQL Processor supports the special searching feature based on text fragments. Lets have a table PERSON with two columns - ID and NAME.
In the meta statements file statements.qry there's the next definition:

 LIKE_STRING(OPT)=like;
 WILDCARD_CHARACTER(OPT)=%;
 SURROUND_QUERY_LIKE(BOPT)=true;
 SURROUND_QUERY_MIN_LEN(IOPT)=2;
 
 LIKE_PEOPLE(QRY)=
   select p.ID @id, p.NAME @name
   from PERSON p
   {= where
    {& id=:id}
    {& UPPER(name) like :+name}
   }
   {#1 order by ID}
   {#2 order by NAME}
 ;
 

The special searching capability is activated with the key SURROUND_QUERY_LIKE(BOPT)=true. In this case every query with the like keyword (defined with the key LIKE_STRING) is identified and any dynamic input value, which belongs to this query condition, is handled in a special way. The value for this input value is surrounded with wild-card character %. This character is defined with the key WILDCARD_CHARACTER. In the runtime to activate this feature, the input value has to have the minimal length = 2. This minimal length is defined with the key SURROUND_QUERY_MIN_LEN. In the case of SQL Processor initialization

 JdbcEngineFactory sqlFactory = new JdbcEngineFactory();
 sqlFactory.setMetaFilesNames("statements.qry"); // the meta statements file
 SqlEngine sqlEngine = sqlFactory.getSqlEngine("LIKE_PEOPLE");
 
 // for the case it runs on the top of the JDBC stack
 Connection connection = DriverManager.getConnection("jdbc:hsqldb:mem:sqlproc", "sa", "");
 SqlSession session = new JdbcSimpleSession(connection);
 
there's created an instance of SqlEngine with the name LIKE_PEOPLE.

Next there's an instance person of the class Person with the value an for the attribute name. The invocation

 List<Person> list = sqlEngine.query(session, Person.class, person, SqlOrder.getDescOrder(2));
 
produces the next SQL execution
 select p.ID id, p.NAME name from PERSON p where UPPER(name) like ? order by NAME DESC
 
In the result list there are all table rows with name, which contains the text fragment an.

For more info please see the Tutorials.

Author:
Vladimir Hudec

Field Summary
static String DEFAULT_LIKE_STRING
          This is the default value related to the key SET_LIKE_STRING.
static String[] DEFAULT_METHODS_ENUM_IN
          This is the default value related to the key SET_METHODS_ENUM_IN.
static String[] DEFAULT_METHODS_ENUM_OUT
          This is the default value related to the key SET_METHODS_ENUM_OUT.
static String DEFAULT_SEQ_NAME
          DEFAULT_SEQ_NAME is the default sequence name.
static Integer DEFAULT_SURROUND_QUERY_MIN_LEN
          This is the default value related to the key SET_SURROUND_QUERY_MIN_LEN.
static String DEFAULT_WILDCARD_CHARACTER
          This is the default value related to the key SET_WILDCARD_CHARACTER .
static String HSQLDB
          The filter for HSQLDB devoted optional features.
static String HSQLDB_DEFAULT_IDSEL
          HSQLDB_DEFAULT_IDSEL is the default value related to the key SET_IDSEL in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.
static String HSQLDB_DEFAULT_LIMIT_FROM_TO
          HSQLDB_DEFAULT_LIMIT_FROM_TO is the default value related to the key SET_LIMIT_FROM_TO in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.
static String HSQLDB_DEFAULT_LIMIT_TO
          HSQLDB_DEFAULT_LIMIT_TO is the default value related to the key SET_LIMIT_TO in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.
static String HSQLDB_DEFAULT_SEQ
          HSQLDB_DEFAULT_SEQ is the default value related to the key SET_SEQ in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.
static String ID
          SET_ID is the key for the identity columns.
static String IDSEL
          SET_IDSEL is the key for the SQL query pattern used to obtain the value of identities after the INSERT command.
static String IGNORE_INPROPER_IN
          SET_IGNORE_INPROPER_IN is the key for special handling of input/output values.
static String IGNORE_INPROPER_OUT
          SET_IGNORE_INPROPER_OUT is the key for special handling of input/output values.
static String JDBC
          SET_JDBC is the key for the raw JDBC stack usage.
static String LIKE_STRING
          SET_LIKE_STRING is the key for the SQL command like.
static String LIMIT_FROM_TO
          SET_LIMIT_FROM_TO is the key for the SQL query pattern used to limit the query results.
static String LIMIT_TO
          SET_LIMIT_TO is the key for the SQL query pattern used to limit the query results.
static String METHODS_ENUM_IN
          SET_METHODS_ENUM_IN lists the methods used in the translation from a Java type to a JDBC datatype for enumerations based input values.
static String METHODS_ENUM_OUT
          SET_METHODS_ENUM_OUT lists the methods used in the translation from a JDBC datatype to a Java type for enumerations based output values.
static String MYSQL
          The filter for MySQL devoted optional features.
static String MYSQL_DEFAULT_IDSEL
          MYSQL_DEFAULT_IDSEL is the default value related to the key SET_IDSEL in the case the filter value MYSQL is used for the SqlEngineLoader instance creation.
static String MYSQL_DEFAULT_LIMIT_FROM_TO
          MYSQL_DEFAULT_LIMIT_FROM_TO is the default value related to the key SET_LIMIT_FROM_TO in the case the filter value MYSQL is used for the SqlEngineLoader instance creation.
static String MYSQL_DEFAULT_LIMIT_TO
          MYSQL_DEFAULT_LIMIT_TO is the default value related to the key SET_LIMIT_TO in the case the filter value MYSQL is used for the SqlEngineLoader instance creation.
static String ORACLE
          The filter for Oracle devoted optional features.
static String ORACLE_DEFAULT_LIMIT_FROM_TO
          ORACLE_DEFAULT_LIMIT_FROM_TO is the default value related to the key SET_LIMIT_FROM_TO in the case the filter value ORACLE is used for the SqlEngineLoader instance creation.
static String ORACLE_DEFAULT_LIMIT_TO
          ORACLE_DEFAULT_LIMIT_TO is the default value related to the key SET_LIMIT_TO in the case the filter value ORACLE is used for the SqlEngineLoader instance creation.
static String ORACLE_DEFAULT_SEQ
          ORACLE_DEFAULT_SEQ is the default value related to the key SET_SEQ in the case the filter value ORACLE is used for the SqlEngineLoader instance creation.
static String SEQ
          SET_SEQ is the key for the SQL query pattern used for the sequences.
static String SURROUND_QUERY_LIKE
          SET_SURROUND_QUERY_LIKE is the key for the special SQL Processor behavior.
static String SURROUND_QUERY_MIN_LEN
          SET_SURROUND_QUERY_MIN_LEN is the minimal length of the string input values for the SQL like command to switch on the SQL Processor special behavior described above in the runtime.
static String WILDCARD_CHARACTER
          SET_WILDCARD_CHARACTER is the key for the wildcard character for the SQL like command.
 

Field Detail

ORACLE

static final String ORACLE
The filter for Oracle devoted optional features. It can be used for the construction of SqlEngineLoader.

See Also:
Constant Field Values

HSQLDB

static final String HSQLDB
The filter for HSQLDB devoted optional features. It can be used for the construction of SqlEngineLoader.

See Also:
Constant Field Values

MYSQL

static final String MYSQL
The filter for MySQL devoted optional features. It can be used for the construction of SqlEngineLoader.

See Also:
Constant Field Values

WILDCARD_CHARACTER

static final String WILDCARD_CHARACTER
SET_WILDCARD_CHARACTER is the key for the wildcard character for the SQL like command.

See Also:
Constant Field Values

DEFAULT_WILDCARD_CHARACTER

static final String DEFAULT_WILDCARD_CHARACTER
This is the default value related to the key SET_WILDCARD_CHARACTER .

See Also:
Constant Field Values

SURROUND_QUERY_LIKE

static final String SURROUND_QUERY_LIKE
SET_SURROUND_QUERY_LIKE is the key for the special SQL Processor behavior. In the case the value of this property is true, the SQL Processor sets the wildcard character as a prefix and postfix for all string values related to the SQL command like. These string values should have to have the minimal length greater or equal to SET_SURROUND_QUERY_MIN_LEN. The default value related to this key is false.

See Also:
Constant Field Values

SURROUND_QUERY_MIN_LEN

static final String SURROUND_QUERY_MIN_LEN
SET_SURROUND_QUERY_MIN_LEN is the minimal length of the string input values for the SQL like command to switch on the SQL Processor special behavior described above in the runtime.

See Also:
Constant Field Values

DEFAULT_SURROUND_QUERY_MIN_LEN

static final Integer DEFAULT_SURROUND_QUERY_MIN_LEN
This is the default value related to the key SET_SURROUND_QUERY_MIN_LEN.


LIKE_STRING

static final String LIKE_STRING
SET_LIKE_STRING is the key for the SQL command like. For example for the Informix database it can be matches.

See Also:
Constant Field Values

DEFAULT_LIKE_STRING

static final String DEFAULT_LIKE_STRING
This is the default value related to the key SET_LIKE_STRING.

See Also:
Constant Field Values

METHODS_ENUM_IN

static final String METHODS_ENUM_IN
SET_METHODS_ENUM_IN lists the methods used in the translation from a Java type to a JDBC datatype for enumerations based input values.

See Also:
Constant Field Values

DEFAULT_METHODS_ENUM_IN

static final String[] DEFAULT_METHODS_ENUM_IN
This is the default value related to the key SET_METHODS_ENUM_IN. It is list of the next methods:


METHODS_ENUM_OUT

static final String METHODS_ENUM_OUT
SET_METHODS_ENUM_OUT lists the methods used in the translation from a JDBC datatype to a Java type for enumerations based output values.

See Also:
Constant Field Values

DEFAULT_METHODS_ENUM_OUT

static final String[] DEFAULT_METHODS_ENUM_OUT
This is the default value related to the key SET_METHODS_ENUM_OUT. It is list of the next methods:


ID

static final String ID
SET_ID is the key for the identity columns. In the case it's values is defined, all columns with this name are implicitly treated as an identifier.

See Also:
Constant Field Values

IGNORE_INPROPER_IN

static final String IGNORE_INPROPER_IN
SET_IGNORE_INPROPER_IN is the key for special handling of input/output values. In the case it's value is defined as true, in the case of any problems with input values the SqlRuntimeException is not thrown, only the related error is logged.

See Also:
Constant Field Values

IGNORE_INPROPER_OUT

static final String IGNORE_INPROPER_OUT
SET_IGNORE_INPROPER_OUT is the key for special handling of input/output values. In the case it's value is defined as true, in the case of any problems with output values the SqlRuntimeException is not thrown, only the related error is logged.

See Also:
Constant Field Values

JDBC

static final String JDBC
SET_JDBC is the key for the raw JDBC stack usage. In this SQL Processor version the next stacks can be used: The default value related to this key is false.

See Also:
Constant Field Values

LIMIT_FROM_TO

static final String LIMIT_FROM_TO
SET_LIMIT_FROM_TO is the key for the SQL query pattern used to limit the query results. This pattern has to be combined with the original SQL query, the limit and the offset in the next way:

See Also:
Constant Field Values

LIMIT_TO

static final String LIMIT_TO
SET_LIMIT_TO is the key for the SQL query pattern used to limit the query results. This pattern has to be combined with the original SQL query and the limit in the next way:

See Also:
Constant Field Values

HSQLDB_DEFAULT_LIMIT_FROM_TO

static final String HSQLDB_DEFAULT_LIMIT_FROM_TO
HSQLDB_DEFAULT_LIMIT_FROM_TO is the default value related to the key SET_LIMIT_FROM_TO in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

HSQLDB_DEFAULT_LIMIT_TO

static final String HSQLDB_DEFAULT_LIMIT_TO
HSQLDB_DEFAULT_LIMIT_TO is the default value related to the key SET_LIMIT_TO in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

ORACLE_DEFAULT_LIMIT_FROM_TO

static final String ORACLE_DEFAULT_LIMIT_FROM_TO
ORACLE_DEFAULT_LIMIT_FROM_TO is the default value related to the key SET_LIMIT_FROM_TO in the case the filter value ORACLE is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

ORACLE_DEFAULT_LIMIT_TO

static final String ORACLE_DEFAULT_LIMIT_TO
ORACLE_DEFAULT_LIMIT_TO is the default value related to the key SET_LIMIT_TO in the case the filter value ORACLE is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

MYSQL_DEFAULT_LIMIT_FROM_TO

static final String MYSQL_DEFAULT_LIMIT_FROM_TO
MYSQL_DEFAULT_LIMIT_FROM_TO is the default value related to the key SET_LIMIT_FROM_TO in the case the filter value MYSQL is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

MYSQL_DEFAULT_LIMIT_TO

static final String MYSQL_DEFAULT_LIMIT_TO
MYSQL_DEFAULT_LIMIT_TO is the default value related to the key SET_LIMIT_TO in the case the filter value MYSQL is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

SEQ

static final String SEQ
SET_SEQ is the key for the SQL query pattern used for the sequences. This pattern can be combined with the sequence name used in the META SQL query in the next way:

See Also:
Constant Field Values

HSQLDB_DEFAULT_SEQ

static final String HSQLDB_DEFAULT_SEQ
HSQLDB_DEFAULT_SEQ is the default value related to the key SET_SEQ in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

ORACLE_DEFAULT_SEQ

static final String ORACLE_DEFAULT_SEQ
ORACLE_DEFAULT_SEQ is the default value related to the key SET_SEQ in the case the filter value ORACLE is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

DEFAULT_SEQ_NAME

static final String DEFAULT_SEQ_NAME
DEFAULT_SEQ_NAME is the default sequence name.

See Also:
Constant Field Values

IDSEL

static final String IDSEL
SET_IDSEL is the key for the SQL query pattern used to obtain the value of identities after the INSERT command.

See Also:
Constant Field Values

HSQLDB_DEFAULT_IDSEL

static final String HSQLDB_DEFAULT_IDSEL
HSQLDB_DEFAULT_IDSEL is the default value related to the key SET_IDSEL in the case the filter value HSQLDB is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values

MYSQL_DEFAULT_IDSEL

static final String MYSQL_DEFAULT_IDSEL
MYSQL_DEFAULT_IDSEL is the default value related to the key SET_IDSEL in the case the filter value MYSQL is used for the SqlEngineLoader instance creation.

See Also:
Constant Field Values


Copyright © 2011. All Rights Reserved.