executeQuery
and executeInsertOrUpdate
methods in the ConnectionPoolFactory
. The parser is initialized with information on column name and type for data to be retieved from the ResultSet
, or, if excluded, it will try to build the element info itself from ResultSet
metadata. If necessary, one must also provide definitions for populating the PreparedStatement
. The object can then be used to retrieve results by column name as String
, int
, Date
, or boolean
types.QueryParser
can optionally accept a Connection
object that will be used by the {@link edu.uga.galileo.voci.db.ConnectionPool} instead of using the pool'sdefault connection handling. This is useful for instances where manipulation of the connection is required prior to making database calls. For example, to allow rollback during failure at any point in a series of database calls, a connection could be retrieved, have its autoCommit
set to false
, and the query parser could be re-used for repeated calls until the transaction's complete. At that point, getting the connection from the parser and committing is possible, and the connection could then be returned by calling code to the pool.
@author Mark Durant
@version 1.0
+
) or a minus (-
) sign, indicating that the clause is required or prohibited respectively; or +
/-
prefix to require any of a set of terms. Query ::= ( Clause ) Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )
Examples of appropriately formatted queries can be found in the query syntax documentation.
In {@link TermRangeQuery}s, QueryParser tries to detect date values, e.g. date:[6/1/2005 TO 6/4/2005] produces a range query that searches for "date" fields between 2005-06-01 and 2005-06-04. Note that the format of the accepted input depends on {@link #setLocale(Locale) the locale}. By default a date is converted into a search term using the deprecated {@link DateField} for compatibility reasons.To use the new {@link DateTools} to convert dates, a{@link org.apache.lucene.document.DateTools.Resolution} has to be set.
The date resolution that shall be used for RangeQueries can be set using {@link #setDateResolution(DateTools.Resolution)}or {@link #setDateResolution(String,DateTools.Resolution)}. The former sets the default date resolution for all fields, whereas the latter can be used to set field specific date resolutions. Field specific date resolutions take, if set, precedence over the default date resolution.
If you use neither {@link DateField} nor {@link DateTools} in yourindex, you can create your own query parser that inherits QueryParser and overwrites {@link #getRangeQuery(String,String,String,boolean)} touse a different method for date conversion.
Note that QueryParser is not thread-safe.
NOTE: there is a new QueryParser in contrib, which matches the same syntax as this class, but is more modular, enabling substantial customization to how a query is created.
NOTE: You must specify the required {@link Version}compatibility when creating QueryParser:
+
) or a minus (-
) sign, indicating that the clause is required or prohibited respectively; or +
/-
prefix to require any of a set of terms. Query ::= ( Clause ) Clause ::= ["+", "-"] [<TERM> ":"] ( <TERM> | "(" Query ")" )
Examples of appropriately formatted queries can be found in the query syntax documentation.
In {@link TermRangeQuery}s, QueryParser tries to detect date values, e.g. date:[6/1/2005 TO 6/4/2005] produces a range query that searches for "date" fields between 2005-06-01 and 2005-06-04. Note that the format of the accepted input depends on {@link #setLocale(Locale) the locale}. A {@link org.apache.lucene.document.DateTools.Resolution} has to be set,if you want to use {@link DateTools} for date conversion.
The date resolution that shall be used for RangeQueries can be set using {@link #setDateResolution(DateTools.Resolution)}or {@link #setDateResolution(String,DateTools.Resolution)}. The former sets the default date resolution for all fields, whereas the latter can be used to set field specific date resolutions. Field specific date resolutions take, if set, precedence over the default date resolution.
If you don't use {@link DateTools} in your index, you can create your ownquery parser that inherits QueryParser and overwrites {@link #getRangeQuery(String,String,String,boolean,boolean)} touse a different method for date conversion.
Note that QueryParser is not thread-safe.
NOTE: there is a new QueryParser in contrib, which matches the same syntax as this class, but is more modular, enabling substantial customization to how a query is created.
NOTE: You must specify the required {@link Version}compatibility when creating QueryParser:
ParameterParser
is used to parse data encoded in the application/x-www-form-urlencoded
MIME type. It is also used to parse a query string from a HTTP URL, see RFC 2616. The parsed parameters are available through the various methods of the org.simpleframework.http.net.Query
interface. The syntax of the parsed parameters is described below in BNF. params = *(pair [ "&" params]) pair = name "=" value name = *(text | escaped) value = *(text | escaped) escaped = % HEX HEXThis will consume all data found as a name or value, if the data is a "+" character then it is replaced with a space character. This regards only "=", "&", and "%" as having special values. The "=" character delimits the name from the value and the "&" delimits the name value pair. The "%" character represents the start of an escaped sequence, which consists of two hex digits. All escaped sequences are converted to its character value. @author Niall Gallagher
Converts a SQL-string to an object version of a query. This QueryParser can be reused but is NOT thread-safe as the parser uses an input stream. Putting multiple queries into the same stream will result in unpredictable and most likely incorrect behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|