Sun StorageTek 5800 System SDK Reference Manual

Query

Queries a 5800 system server for metadata records that match the query string passed on the command line.


Note –

Query requires the T..Z UTC format. For example, 1952-10-27T00:30:29.999Z.


Synopsis

     java Query <IP | HOST> <QUERY> [OPTIONS]

Description

Queries for metadata records. QUERY is of the form:

     <name1>=’<value1>’ AND <name2>=’<value2>’ OR ...

See the examples below for formatting of various types of values. The OID and any specified fields of metadata records that match the query are printed to stdout.

<name> should be specified in the format <namespace>.<attribute>.

Note that names that are keywords need to be enclosed in escaped double quotes (for example, with the bash shell, use "\"<name>\"=’<value>’"). Refer to the list of keywords in Chapter 4, Sun StorageTek 5800 System Query Language, in Sun StorageTek 5800 SystemClient API Reference Manual.

Options

     
-s <FIELD>

Specifies a field to be retrieved, much like an SQL select clause. To retrieve multiple fields, repeat this option. By default, the results are returned as a list of OIDs.

     
-n <number of results>

The maximum number of metadata records or OIDs that will be returned. The default is 1000.

     
-h

Print this message.

Examples

In the following examples, “first” is a keyword.

     java Query server "book.author=’King’"
     java Query server "\"first\"=’a’"
     java Query 10.152.0.12 "mp3.artist=’The Beatles’ AND mp3.album=’Abbey Road’"
     java Query 10.152.0.12 "mp3.artist=’The Beatles’" -s mp3.album -s mp3.title
     java Query 10.152.0.12 system.test.type_char="’do re mi’"
     java Query 10.152.0.12 system.test.type_string="’fa so la’"
     java Query 10.152.0.12 system.test.type_long=123
     java Query 10.152.0.12 system.test.type_double=1.23
     java Query 10.152.0.12 system.test.type_binary="x’0789abcdef’"
     java Query 10.152.0.12 system.test.type_date="’2010-10-20’"
     java Query 10.152.0.12 system.test.type_time="’23:30:29’"
     java Query 10.152.0.12 system.test.type_timestamp="{timestamp’2010-10-20T23:30:29.123Z’}"

Source Code

     java/examples/Query.java