
Literals In Queries
SQL Syntax in 5800 System Queries
General Unicode characters outside of the ASCII range in queries are allowed in only two places to the 5800 system. Specifically, both attribute names and literal values may contain general Unicode characters. All text that is not either an attribute name nor a literal value is passed unchanged to the underlying query engine, and must consist of ASCII characters only. An attempt to pass
Literals In Queries
This section details the kinds of literals that can occur in 5800 system queries.
Dynamic Parameters
5800 system queries allow dynamic parameters. A dynamic parameter is indicated by the presence of a question mark in the query string (for example, the query name=? AND address=?). The bindParameter call is used in Java to bind typed values for use in place of the question marks.
For the Java API, the syntax is:
import com.sun.honeycomb.client.PreparedStatement; import com.sun.honeycomb.client.QueryResultSet; Date date_value= new Date(); PreparedStatement stmt = new PreparedStatement( "system.test.type_date=?"); stmt.bindParameter(date_value,1); QueryResultSet qrs = query(stmt);
For further information, see “query (with PreparedStatement)” on page 35, “query (with PreparedStatement and selectKeys)” on page 35 and “PreparedStatement” on page 36.
String Literals
String literals are surrounded by single quotes (for example, 'The Lighter Side’). You can embed single quote characters in a query by doubling them (for example, ’Susan’’s House’). Any
Numeric Literals
Only ASCII digits are recognized as numeric literals. For example, 45,
118 | Sun StorageTek 5800 System Client API Reference Manual • June 2008 |