SQL Syntaxin 5800 System Queries

GeneralUnicode characters outside of the ASCII range in queries are allowed in only two places
tothe 5800 system. Specically, both attribute names and literal values may contain general
Unicodecharacters. All text that is not either an attribute name nor a literal value is passed
unchangedto the underlying query engine, and must consist of ASCII characters only. An
attemptto pass non-ASCII characters in a query will result in an error.
LiteralsIn Q ueries
Thissection details the kinds of literals that can occur in 5800 system queries.

Dynamic Parameters

5800system queries allow dynamic parameters. A dynamic parameter is indicated by the
presenceof 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
questionmarks.
Forthe 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);
Forfurther information, see query (with PreparedStatement)” on page 35,query (with
PreparedStatementand selectKeys)” on page 35 and PreparedStatement” on page 36.

String Literals

Stringliterals are surrounded by single quotes (for example, 'The Lighter Side’). You can embed
singlequote characters in a query by doubling them (for example, Susan’’s House). Any
UTF-8string can be included in a string literal (except the null character, which is treated as a
stringterminator by the C API).

Numeric Literals

OnlyASCII digits are recognized as numeric literals. For example, 45,-1, 3.14,5.2E10. Digits
fromother parts of the Unicode code space will cause a parse error.
LiteralsIn Queries
SunStorageTek5800 System Client API Reference Manual • June 2008118