Sun StorageTek 5800 System SDK Developer's Guide

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

     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 ("\"<name>\"=’<value>’"). Refer to the list of keywords in Chapter 4, Sun StorageTek 5800 System Query Language, in Sun StorageTek 5800 System Client API Reference Guide. Also note that some shells such as csh may not accept the escaped quotes because they are embedded in other quotes.

Options

-s <FIELD>

Print out results as metadata name-value records. Use as many -s switches as needed to define all fields that will be printed to stdout.

-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.

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

Source Code

c/examples/Query.c