Manuel d'utilisation / d'entretien du produit Sun StorageTek 5800 du fabricant Sun Microsystems
Aller à la page of 136
Sun Stor age T ek 5800 S y stem Client API Refer ence Manual Sun Microsystems, Inc. 4150 N etwork Circle Santa Clara, CA 95054 U.S.A. Part N o: 820–4796 J une 2008.
Copyright 2008 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, CA 95054 U.S.A. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. I n particular, and without limitation, these intellectual property rights may include one or more U.
C ontents Preface ...................................................................................................................................................11 1 Sun Storage T ek 5800 Syst em Client API ........................................
3 Sun Storage T ek 5800 Syst em C Client API ....................................................................................... 39 Overview of the 5800 System C Client API ..........................................................................
hc_session_get_platform_result ......................................................................................... 58 hc_session_get_archive ........................................................................................................
Storing Data and Metadata ......................................................................................................... 87 hc_store_both_ez ...................................................................................................
Supported Data Types ....................................................................................................................... 116 Queries ..................................................................................................
8.
T ables T ABLE 4–1 Canonical String Representation of Data Types .................................................. 119 9.
10.
P refac e The Sun StorageTek 5800 System Client API Reference M anual is written for programmers and application developers who develop custom applications for the Sun StorageTek TM 5800 System.
Relat ed Thir d-Party W eb Site Refer ences Third-party URLs are referenced in this document and provide additional, related information. Note – Sun is not responsible for the availability of third-party web sites mentioned in this document.
T ABLE P–1 Typographic C onventions (Continued) T ypeface Meaning Example A aBbCc123 Book titles, new terms, and terms to be emphasized Read Chapter 6 in the User's Guide . A cache is a copy that is stored locally. Do not save the le. Note: Some emphasized items appear bold online.
14.
Sun Storage T ek 5800 System Client API The Sun TM StorageTek TM 5800 system client API provides programmatic access to a 5800 system server to store, retrieve, query, and delete object data and metadata. Synchronous versions are provided in C and J ava TM languages.
In 5800 system version 1.1, an attempt to store a value that is longer than the associated eld generates an immediate error. 5800 S yst em O v er view This section provides an overviews of the 5800 system, the 5800 system history, and a summaries of the key points of the 5800 system usage model.
This chapter provides a summary of key points of the 5800 system usage model that are useful for understanding either API. In the following sections, the terms from the J ava API are used as an aid to exposition. In all cases, a simple equivalent using the C API is available.
Read-M ultiple (WORM) archive. Each object corresponds to a single stream of data and a single set of metadata; there are no “grouped objects” or “compound objects” other than by application convention. Each object corresponds to a single stream of data and a single set of metadata.
The 5800 S y stem Metadata Model M etadata means “data about the data”; it describes the data and helps to determine how the data should be interpreted. In addition, metadata can be used to facilitate querying the 5800 system for objects that match a particular set of search criteria.
The metadata associated with an object is immutable. There is no operation to modify the metadata associated with an object after the object has been stored. Instead, the storeMetadata operation can be used to create a completely new object by associating new user metadata with the underlying data and system-metadata of an existing object.
Query expressions can use much of the power of Structured Query Language (SQL). Each query expression combines SQL functions and operators, eld names from the metadata schema, and literal values.
Note – The format of records as stored in the reliable and scalable object archive is not suitable for fast query. To enable searching, the queryable elds from the metadata are indexed in a query engine that can provide fast and exible query services.
match the original object metadata. There are no transactional guarantees regarding ordering of queries and delete operations that are occurring at the same time.
24.
Sun Storage T ek 5800 System Ja va Client API This chapter provides information on the 5800 system J ava client API. The following topics are discussed: ■ “Overview of the 5800 System Java Client .
The 5800 system J ava client library provides a platform-independent mechanism to upload data and metadata to a 5800 system, and to retrieve and query the data and metadata. The J ava client library works with any implementation of J2SE TM platform 4.
Updating Client Vie w of the Schema In the J ava client API, the schema is fetched when the NameValueObjectArchive class is instantiated. If the schema has changed, the client application needs to create a new NameValueArchive . A local copy of the schema is used for some metadata operations.
Basic C oncepts The root of the 5800 system J ava client API is the NameValueObjectArchive class, which represents a connection to a single 5800 system server. All operations are initiated by invoking methods on a NameValueObjectArchive instance after initializing it with the address of a cluster.
■ “ ObjectIdentifier ” on page 29 ■ “ QueryResultSet ” on page 30 ■ “ SystemRecord ” on page 30 ■ “ NameValueRecord ” on page 30 For more information on using these classes, see “Basic Concepts” on page 28 . NameValueObjectArchive The NameValueObjectArchive class is the main entry point into the 5800 system.
later for retrieving objects. External storage can be accomplished using an identier's string representation by invoking the toString method. An instance of ObjectIdentifier can be reconstituted using the constructor that takes String as an argument.
■ “ query (with PreparedStatement )” on page 35 ■ “ query (with PreparedStatement and selectKeys )” on page 35 ■ “ PreparedStatement ” on page 36 ■ “ QueryResultSet ” on page 3.
Synopsis public SystemRecord storeObject(java.nio.channels.ReadableByteChannel dataChannel) public SystemRecord storeObject(ReadableByteChannel dataChannel,NameValueRecord record) throws ArchiveExcept.
checkIndexed returns an int value that indicates if the metadata for this object has been inserted into the query engine. The value is -1 if the metadata was already inserted before this operation was called, 0 if the metadata has still not been inserted, or 1 if the metadata was just now inserted.
Synopsis public NameValueSchema getSchema() throws ArchiveException, java.io.IOException Description Returns the runtime conguration of the name-value object archive as a NameValueSchema instance. query Returns a ResultSet of SystemRecord instances containing MetadataRecord OIDs.
Description Takes a where clause and a select clause and returns a QueryResultSet of NameValueRecord instances containing the selected values. selectKeys identies the values to be returned, functioning as an SQL select clause. The query parameter is a where clause in the 5800 system query syntax, which is a subset of SQL.
Synopsis public QueryResultSet query(PreparedStatement query, java.lang.String[] selectKeys, int resultsPerFetch) Description Takes a where clause and a select clause and returns a QueryResultSet of NameValueRecord instances containing the selected values.
stmt.bindParameter(date_value,1); QueryResultSet qrs = archive.query(stmt); QueryResultSet The QueryResultSet class is used to page through OIDs and associated metadata returned by NameValueObjectArchive.query . See the javadoc for the getXXX methods for getting typed metadata.
getQueryIntegrityTime Returns the most recent time at which all store index exceptions are known to have been resolved. Synopsis long getQueryIntegrityTime() Description The query integrity time is a time such that all store index exceptions from before that time have been resolved.
Sun Storage T ek 5800 System C Client API This chapter provides detailed information on the 5800 system C client API. The following topics are discussed: ■ “Overview of the 5800 System C Client AP.
Architecture The 5800 system C API client supports two dierent access patterns: a synchronous “EZ” access very similar to the current J ava implementation, and a more exible, nonblocking access based on the POSIX model. Note – For this release, the nonblocking C API client is not implemented.
Memor y Usage The 5800 system C client library generally follows the model of populating externally allocated data structures such as handles, buers, and result arrays.
hcerr_t hc_init(allocator_t, deallocator_t, reallocator_t); This function must be called once per process to initialize the memory functions used in the 5800 system C API. I t also initializes global session properties. A global session is initialized once per process, regardless of how many threads in that process are using the C API.
■ oid — The objectid for this object, equivalent to the system.object_id eld. ■ digest_algo — Always set to " sha1 " for this release. Equivalent to the system.object_hash_alg eld. ■ data_digest — An array of bytes that represent the content digest of this object's data.
S ynchronous C API A multiplatform synchronous C API in which operations are accomplished in a few simple function calls is provided for the 5800 system. The API calls include operations for storing, retrieving, deleting, and querying of data and metadata records.
– “ hc_nvr_get_time ” on page 82 – “ hc_nvr_get_timestamp ” on page 83 – “ hc_pstmt_create ” on page 100 – “ hc_pstmt_free ” on page 101 – “ hc_pstmt_set_string ” on page.
S ynchronous C Data T ypes The following data types are dened for the C API: ■ “ hc_string_t ” on page 46 ■ “ hc_long_t ” on page 46 ■ “ hc_double_t ” on page 46 ■ “ hc_type_t.
Synopsis typedef double hc_double_t; Description Type for holding oating-point values. hc_type_t 5800 system name-value metadata type specier. Synopsis typedef enum hc_types_{ HC_UNKNOWN_TYPE = .
hc_bytearray_t hcv_bytearray; struct tm hcv_tm; struct timespec hcv_timespec; } hcv; } hc_value_t; Description This tagged union type can be used to hold a reference to any of the 5800 system data types. hc_schema_t 5800 system name-value metadata schema.
Description An opaque structure to represent the session from one thread to one 5800 system server. I t contains the schema used to interpret metadata store and retrieve operations to this 5800 system server. hc_pstmt_t Structure for holding a prepared statement.
Description Function pointers of read_from_data_source type are used to upload object data. The function pointer and opaque cookie reference are supplied as arguments to “ hc_store_both_ez ”o n page 87 and other functions that store object data.
Description Function pointers of write_to_data_destination type are used to download object data to a network or other destination from the 5800 system server using “ hc_retrieve_ez ” on page 91 .
HCERR_BAD_REQUEST, HCERR_NO_SUCH_OBJECT, HCERR_INTERNAL_SERVER_ERROR, HCERR_FAILED_GETTING_FDSET, HCERR_FAILED_CHECKING_FDSET, HCERR_MISSING_SELECT_CLAUSE, HCERR_URL_TOO_LONG, HCERR_COULD_NOT_OPEN_FIL.
Description This structure denes the 5800 system C client API error codes. S ynchronous C API F unc tions The 5800 system synchronous C API functions are dened to perform the following tasks: .
Description This function initializes the 5800 system API and must be called before calling any of the other functions in this API. I t downloads a copy of the schema for a particular host or port. The schema is used to validate the name-value-type tuples that are added to metadata records.
hc_session_free Releases the session object. Synopsis hcerr_t hc_session_free (hc_session_t *session); Description This function releases the session object and recovers handles and memory for one connection. Par ameters session IN: The session object to free.
response_codep OUT: Updated to be the HTTP response code. errstr IN: Updated to be the error returned in the response body if the response code is not 200 (OK).
Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSION hc_session_get_host Returns the host name and port number associated with the session. Synopsis hc_session_get_host(hc_session_t *session, char **hostp,int *portp); Description This function returns the host name and port number associated with the session.
hc_session_get_platform_result Returns low-level error codes associated with the current session. Synopsis hcerr_t hc_session_get_platform_result(hc_session_t *session, int32_t *connect_errnop, int32_t *platform_resultp); Description This function returns low-level error codes associated with the current session.
hc_session_get_archive Returns the current archive object associated with this session. Synopsis hcerr_t hc_session_get_archive(hc_session_t *session, hc_archive_t **archivep); Description This function returns the current archive object associated with this session.
■ “ hc_schema_get_type_at_index ” on page 62 hc_schema_get_type Looks up type in schema. Synopsis hcerr_t hc_schema_get_type(hc_schema_t *schema, char *name, hc_type_t *typep); Description This function looks up the type associated with a given name in the current metadata schema, or returns an error if the name is not known.
hc_schema_get_length Looks up length of char and string attribute elds. Synopsis hcerr_t hc_schema_get_length(hc_schema_t *schema, char *name, int *length); Description This function looks up the length of a char or string eld associated with a given attribute name in the current metadata schema, or returns an error if the name is not known.
Description This function returns the number of name-value pairs in the metadata schema. Par ameters hsp IN: The schema to interrogate. countp OUT: Updated with the number of name-value pairs in the schema.
IN: Should range from 0 up to the count-1 returned in “ hc_schema_get_count ” on page 61 . namep OUT: Updated to point to a string that is an attribute name of one attribute in the schema. typep OUT: Updated to be the type associated with that name in the schema.
▼ T o Use the API f or Storing Name - V alue Records Call hc_init once per pr ocess. Call “ hc_session_create_ez ” on page 53 t o initialize the session and download the schema. Create the metada ta record with “ hc_nvr_create ” on page 65 .
Crea ting and Fr eeing Name -V alue Records The following functions are dened to create and free name-value records: ■ “ hc_nvr_create ” on page 65 ■ “ hc_nvr_free ” on page 66 hc_nvr_create Creates a name-value record.
See Also “ hc_nvr_free ” on page 66 hc_nvr_free Frees a name-value record. Synopsis hcerr_t hc_nvr_free(hc_nvr_t *nvr); Description This function frees a name-value record that was created by “ hc_nvr_create ” on page 65 . Par ameter nvr IN: P oints to the name-value-record to be freed.
■ “ hc_nvr_add_timestamp ” on page 74 ■ “ hc_nvr_add_from_string ” on page 75 hc_nvr_add_value A dds a new metadata value. Synopsis hcerr_t hc_nvr_add_value(hc_nvr_t *nvr, char *name, hc_value_t value); Description This function adds a new metadata name-value-type tuple to a designated name-value record.
hc_nvr_add_long A dds a new metadata value of type hc_long_t . Synopsis hcerr_t hc_nvr_add_long(hc_nvr_t *nvr, char *name, hc_long_t value) Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is known to be hc_long_t (see “ hc_type_t ” on page 47 ).
hc_nvr_add_double A dds a new metadata value of type hc_double_t . Synopsis hcerr_t hc_nvr_add_double(hc_nvr_t *nvr, char *name, hc_double_t value); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is known to be hc_double_t (see “ hc_type_t ” on page 47 ).
hc_nvr_add_string A dds a new metadata value of type Unicode UTF-8 string. Synopsis hcerr_t hc_nvr_add_string(hc_nvr_t *nvr, char *name, hc_string_t value); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is a Unicode UTF-8 string.
hc_nvr_add_binary A dds new metadata value of type binary . Synopsis hcerr_t hc_nvr_add_binary(hc_nvr_t *nvr, hc_string_t name, int size, unsigned char *bytes); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is binary data.
hc_nvr_add_date A dds new metadata value of type date . Synopsis #include <time.h> hcerr_t hc_nvr_add_date(hc_nvr_t *nvr, hc_string_t name,struct tm *value); Description This function adds a new metadata name-value-type tuple to a designated name-value record.
hc_nvr_add_time A dds new metadata value of type time . Synopsis #include <time.h> hcerr_t hc_nvr_add_time(hc_nvr_t *nvr, hc_string_t name, time_t *value); Description This function adds a new metadata name-value-type tuple to a designated name-value record.
hc_nvr_add_timestamp A dds new metadata value of type timestamp . Synopsis #include <time.h> hcerr_t hc_nvr_add_timestamp(hc_nvr_t *nvr, hc_string_t name, struct timespec *value); Description This function adds a new metadata name-value-type tuple to a designated name-value record, where type is hc_timestamp_t .
hc_nvr_add_from_string A dds a new metadata value where the value always starts out as a string. Synopsis hcerr_t hc_nvr_add_from_string(hc_nvr_t *nvr, char *name, char *value); Description This is a convenient function for adding a new metadata name-value-type tuple to a designated name-value, where the value always starts out as a string.
Retrieving Name - V alue Records The following functions are dened to retrieve name-value records: ■ “ hc_nvr_get_count ” on page 76 ■ “ hc_nvr_get_value_at_index ” on page 77 ■ “ h.
hc_nvr_get_value_at_index I terates through the names and values in a name-value record. Synopsis hc_nvr_get_value_at_index(hc_nvr_t *nvr, hc_long_t index, char **namep, hc_value_t *valuep); Description This function iterates through the names and values in a name-value record.
hc_nvr_get_long Retrieves a value of type hc_long_t . Synopsis hcerr_t hc_nvr_get_long(hc_nvr_t *nvr, char *name, hc_long_t *retlong); Description This function retrieves the value of type hc_long_t (see “ hc_type_t ” on page 47 ) associated with an indicated attribute name in a name-value record.
hc_nvr_get_double Retrieves a value of type hc_double_t . Synopsis hcerr_t hc_nvr_get_double(hc_nvr_t *nvr, char *name, hc_double_t *retdouble); Description This function retrieves the value of type hc_double_ t (see “ hc_type_t ” on page 47 ) associated with an indicated attribute name in a name-value record.
hc_nvr_get_string Retrieves a value of a Unicode UTF-8 string. Synopsis hcerr_t hc_nvr_get_string(hc_nvr_t *nvr, char *name, hc_string_t *retstring); Description This function retrieves the value of a Unicode UTF-8 string associated with an indicated attribute name in a name-value record.
hc_nvr_get_binary Retrieves a metadata value of type binary . Synopsis hcerr_t hc_nvr_get_binary(hc_nvr_t *nvr, hc_string_t name, int *size, unsigned char **bytes); This function retrieves the value of type binary associated with an indicated attribute name in a name-value record.
hc_nvr_get_date Retrieves metadata value of type date . Synopsis #include <time.h> hcerr_t hc_nvr_get_date(hc_nvr_t *nvr, hc_string_t name, struct tm *value); Description This function retrieves the value of type struct tm associated with an indicated attribute name in a name-value record.
Synopsis #include <time.h> hcerr_t hc_nvr_get_time(hc_nvr_t *nvr, hc_string_t name, time_t *value); This function retrieves the value of type time_t (seconds since midnight) associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-value-record.
This function retrieves the value of type struct timespec associated with an indicated attribute name in a name-value record. Par ameters nvr P oints to a name-value-record. name IN: N ame for the tuple. value OUT: Updated with the struct timespec ( time.
char **names, char **values, hc_long_t nitems); Description This function creates a name-value-record from parallel tables of string names and string values. The correct metadata type for each name must be looked up from the schema associated with this session.
hc_nvr_convert_to_string_arrays Converts name-value-record to string names and string values. Synopsis hcerr_t hc_nvr_convert_to_string_arrays(hc_nvr_t *nvr, char ***namesp, char ***valuesp, int *nitemsp); Description This function converts a name-value-record into parallel tables of string names and string values.
HCERR_OOM HCERR_INVALID_NVR HCERR_ILLEGAL_ARGUMENT Storing Da ta and Metadata The following functions are dened to store data and metadata and to enforce indexing of metadata where necessary: ■ .
Par ameters session IN: The session for the host and port to talk to. data_source_reader IN: The source of data to be stored. See “ read_from_data_source ” on page 49 . cookie IN: An opaque data structure (cookie) to be provided to data_source_reader .
Description This function adds a metadata record for the specied OID and returns a system_record descriptor. Par ameters session IN: The session for the host and port to talk to. oid IN: An identier of object data to which the metadata record is attached.
Description checkIndexed is intended as way to resolve a store index exception under program control (see “The 5800 System Query Integrity M odel” on page 21 ).
Retrieving Da ta and Metadata The following functions are dened to retrieve data and metadata: ■ “ hc_retrieve_ez ” on page 91 ■ “ hc_retrieve_metadata_ez ” on page 92 ■ “ hc_range_retrieve_ez ” on page 93 hc_retrieve_ez Retrieves data for the specied OID .
HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_INVALID_OID hc_retrieve_metadata_ez Retrieves a metadata record for the specied OID . Synopsis hcerr_t hc_retrieve_metadata_ez (hc_session_t *session, hc_oid *oid, hv_nvr_t **nvrp); Description This function retrieves a metadata record for the specied OID .
hc_range_retrieve_ez Retrieves a specied range of data for a specied OID . Synopsis hc_range_retrieve_ez(hc_session_t *session, write_to_data_destination data_writer, void *cookie, hc_oid *oid, hc_long_t; firstbyte, hc_long_t lastbyte); Description This function retrieves a specied range of data for a specied OID .
HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_INVALID_OID HCERR_ILLEGAL_ARGUMENT Quer ying Metadata The following functions are dened for simple queries: ■ “ hc_query_ez ” on page 94 ■ “.
int results_per_fetch, hc_query_result_set_t **rsetp); Description This function retrieves OIDs and optionally name-value records matching a query. I f the selects list is NULL , only OIDs are retrieved. I f selects is not NULL , name-value records are also retrieved and should each be freed using “ hc_nvr_free ” on page 66 .
Return Codes HCERR_OK HCERR_OOM HCERR_BAD_REQUEST HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_ILLEGAL_ARGUMENT See Also “ hc_qrs_free ” on page 99 hc_qrs_next_ez Fetches the next O ID and optionally name-value record from the QueryResultSet .
finishedp OUT: P oints to an int that is updated to 0 if query data has been returned and to 1 if the result set is empty. Return Codes HCERR_OK HCERR_OOM HCERR_BAD_REQUEST HCERR_INVALID_RESULT_SET HC.
Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_INVALID_RESULT_SET hc_qrs_get_query_integrity_time Returns a time that helps get more detail on which store index exceptions might still be unresolved.
HCERR_OOM HCERR_INVALID_RESULT_SET hc_qrs_free Releases the resources associated with this QueryResultSet . Synopsis hcerr_t hc_qrs_free (**rsetp); Description This function releases the resources associated with this QueryResultSet .
hc_pstmt_create Creates an “ hc_pstmt_t ” on page 49 for use with the “ hc_pstmt_query_ez ” on page 109 function. Synopsis hcerr_t hc_pstmt_create(hc_session_t *session, hc_string_t query, hc_pstmt_t **ptr); Description This function creates a prepared statement for use with the “ hc_pstmt_query_ez ” on page 109 function.
hc_pstmt_free Frees a “ hc_pstmt_t ” on page 49 with all its bindings. Synopsis hcerr_t hc_pstmt_free(hc_pstmt_t *pstmt); Description This function frees a prepared statement.
Par ameters pstmt Prepared statement to add the binding to. which IN: Variable (” ? ’) in the prepared statement, numbered from 1 . value IN: String to bind. Return Codes HCERR_OK HCERR_OOM See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_char A dds a char binding to a “ hc_pstmt_t ” on page 49 .
IN: Variable (” ? ’) in the prepared statement, numbered from 1 . value IN: char * string to bind. Return Codes HCERR_OK HCERR_OOM See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_double A dds a double precision binding to a “ hc_pstmt_t ” on page 49 .
Return Codes HCERR_OK HCERR_OOM See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_long A dds a “ hc_long_t ” on page 46 binding to a “ hc_pstmt_t ” on page 49 .
See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_date A dds a date binding to a “ hc_pstmt_t ” on page 49 . Synopsis #include <time.h> hcerr_t hc_pstmt_set_date(hc_pstmt_t *pstmt, int which, struct tm *value); Description This function binds a date in the form of the POSIX struct to one of the variables in a prepared statement.
See Also “ hc_pstmt_create ” on page 100 hc_pstmt_set_time A dds a time-of-day binding to a “ hc_pstmt_t ” on page 49 . Synopsis #include <time.h> hcerr_t hc_pstmt_set_time(hc_pstmt_t *pstmt, int which, time_t *value); Description This function binds a time of day in seconds to one of the variables in a prepared statement.
hc_pstmt_set_timestamp A dds a timestamp binding to a “ hc_pstmt_t ” on page 49 . Synopsis #include <time.h> hcerr_t hc_pstmt_set_timestamp(hc_pstmt_t *pstmt, int which, struct timespec *value); Description This function binds a timestamp in the form of the POSIX struct timespec to one of the variables in a prepared statement.
hc_pstmt_set_binary A dds a binary binding to a “ hc_pstmt_t ” on page 49 . Synopsis hcerr_t hc_pstmt_set_binary(hc_pstmt_t *pstmt, int which, unsigned char *data,int size); Description This function binds a binary array to one of the variables in a prepared statement.
hc_pstmt_query_ez Retrieves OIDs and optionally name-value records matching a prepared statement. Synopsis hcerr_t hc_pstmt_query_ez(*pstmt,hc_string_t selects[], int n_selects, int results_per_fetch, hc_query_result_set_t **rsetp); Description This function retrieves OIDs and optionally name-value records matching a prepared statement.
Return Codes HCERR_OK HCERR_OOM HCERR_BAD_REQUEST HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_ILLEGAL_ARGUMENT See Also “ hc_pstmt_create ” on page 100 Quer ying W ith a Pr epared Stat ement The following code is an example of querying with a prepared statement.
// list all OIDs from yesterday with test_status t = 86400; // 86400 sec/day date = gmtime(&t); res = hc_pstmt_set_date(pstmt, 1, date); res = hc_pstmt_query_ez(pstmt, selects, 1, 2000, &rset).
Par ameters session IN: P ointer to the session. oid IN: The specied OID . Return Codes HCERR_OK HCERR_BAD_REQUEST HCERR_OOM HCERR_NULL_SESSION HCERR_INVALID_SESSION HCERR_INVALID_OID T ranslating .
hc_decode_hc_type Translates a type code into a string. Synopsis char *hc_decode_hc_type(hc_type_t type); Description Translates a type code into a string.
114.
Sun Storage T ek 5800 Syst em Quer y Language This chapter provides information on the 5800 system query language. Note – For details of the metadata system and how it is congured, see Chapter 8, “Conguring M etadata and Virtual File System Views” in Sun StorageTek 5800 Storage System A dministration Guide .
Opera tion The query format is similar to the where clause of an SQL query. The two main dierences are that 5800 system queries do not contain embedded subqueries, and that the only “columns” that are available are the attributes dened in the 5800 system schema.
Queries A query in the 5800 system query language is translated into an equivalent query for the underlying database that implements the query engine. The database used in a live 5800 system is Sun's High A vailability Database (H ADB). The database used by the 5800 system emulator is A pache TM Derby.
SQL Syntax in 5800 S ystem Queries General Unicode characters outside of the ASCII range in queries are allowed in only two places to the 5800 system. Specically, both attribute names and literal values may contain general Unicode characters.
Liter als for 5800 S yst em Data T ypes For each 5800 system data type, there is a syntax to include literals of that type in a query string. The syntax is {type_name ’ stringliteral ’ } .
■ When converting a typed value to a string as the result of the getAsString operation on a NameValueRecord or a QueryResultSet operation ■ When parsing a literal value as described in “Literals for 5800 System Data Types” on page 119 to create a typed query value from a string representation of that value.
■ The following JDBC function escapes supported: TIMESTAMPDIFF, TIMESTAMPADD, CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE, HOUR, MINUTE, SECOND . Reser ved W ords Some SQL reserved words (such as BETWEEN or LIKE ) are allowed in queries and are expected to occur.
■ expr [NOT] IN (valueslist) . Note – The 5800 system emulator supports (but the cluster database does not) a JDBC “escape” clause that allows you to treat either % or _ as constant characters. There is currently no way to accomplish this in a LIKE clause in a query on a live cluster.
Examples of Suppor ted Quer y Expressions ■ {fn LCASE(mp3.artist)} LIKE ’ %floyd% ’ AND system.object_size > 2000000 ■ (object_size < 200) OR " Collation " = ’ en-US ’ ■ {fn TIMESTAMPDIFF(SQL_TSI_YEAR, system.test.type_timestamp, ’ 2007-04-02 01:50:50.
■ SIN(float) ■ SQRT(float) ■ TAN(float) SQL W ords T hat Ar e Allow ed in Queries Some SQL reserved words (such as BETWEEN or LIKE ) are allowed in queries and are expected to occur. An SQL reserved word cannot be used as an attribute name unless it is enclosed in double quotes (for example, " FIRST " ) .
DEALLOCATE, DECLARE, DEFAULT, DEFERRABLE, DEFERRED, DELETE, DESC, DESCRIBE, DESCRIPTOR, DETERMINISTIC, DIAGNOSTICS, DIRECTORY, DISCONNECT, DISTINCT, DO, DOMAIN, DOUBLEATTRIBUTE, DROP, EACH, EXCEPT, EX.
126.
P rogramming C onsiderations and Best P rac tices This chapter provides considerations and practices that can help you create ecient 5800 system applications.
eld consumes the same number of bytes as the length of the value. A string value consumes twice as many bytes as the length of the value. These sizes are similar to what is described in the Sun StorageTek 5800 System A dministration Guide , Table 7-6, N umber of Bytes Used by E ach Element Type in a Schema Table.
Index Numbers and Symbols 5800 system H oneycomb project, 17 summary, 16-17 B best practices max results per fetch, 128 retries and timeouts, 127 schema query size, 128 C C client API application depl.
data type, synchronous C API (Continued) hc_string_t ,4 6 hc_value_t , 47-48 hcerr_t , 51-53 read_from_data_source , 49-50 write_to_data_destination , 50-51 deleting, objects, overview, 22-23 E error .
metadata (Continued) retrieving, 91 storing, 87 hc_store_both_ez , 87-88 metadata model, overview, 19-20 models data, 17-19 deleting objects, 22-23 metadata, 19-20 query, 20-21 query integrity, 21-22 .
OID (Continued) retrieve metadata for hc_retrieve_metadata_ez ,9 2 retrieve range of data for hc_range_retrieve_ez , 93-94 operations retrying, 26, 40 overview, 16-23 5800 system, 16-17 data model, 17.
R retries, 127 retrieveMetadata method, 33 retrieveObject method, 33 retrying operations, 26, 40 S schema managing, 59-60 hc_schema_get_count , 61-62 hc_schema_get_length ,6 1 hc_schema_get_type ,6 0 .
synchronous C API (Continued) error codes translating into a string, 112 fetch next OID hc_qrs_next_ez , 96-97 free prepared statement hc_pstmt_free , 101 functions, 53-110 hc_nvr_get_count ,7 6 hc_ps.
T timeouts, 127 Index 135.
136.
Un point important après l'achat de l'appareil (ou même avant l'achat) est de lire le manuel d'utilisation. Nous devons le faire pour quelques raisons simples:
Si vous n'avez pas encore acheté Sun Microsystems Sun StorageTek 5800 c'est un bon moment pour vous familiariser avec les données de base sur le produit. Consulter d'abord les pages initiales du manuel d'utilisation, que vous trouverez ci-dessus. Vous devriez y trouver les données techniques les plus importants du Sun Microsystems Sun StorageTek 5800 - de cette manière, vous pouvez vérifier si l'équipement répond à vos besoins. Explorant les pages suivantes du manuel d'utilisation Sun Microsystems Sun StorageTek 5800, vous apprendrez toutes les caractéristiques du produit et des informations sur son fonctionnement. Les informations sur le Sun Microsystems Sun StorageTek 5800 va certainement vous aider à prendre une décision concernant l'achat.
Dans une situation où vous avez déjà le Sun Microsystems Sun StorageTek 5800, mais vous avez pas encore lu le manuel d'utilisation, vous devez le faire pour les raisons décrites ci-dessus,. Vous saurez alors si vous avez correctement utilisé les fonctions disponibles, et si vous avez commis des erreurs qui peuvent réduire la durée de vie du Sun Microsystems Sun StorageTek 5800.
Cependant, l'un des rôles les plus importants pour l'utilisateur joués par les manuels d'utilisateur est d'aider à résoudre les problèmes concernant le Sun Microsystems Sun StorageTek 5800. Presque toujours, vous y trouverez Troubleshooting, soit les pannes et les défaillances les plus fréquentes de l'apparei Sun Microsystems Sun StorageTek 5800 ainsi que les instructions sur la façon de les résoudre. Même si vous ne parvenez pas à résoudre le problème, le manuel d‘utilisation va vous montrer le chemin d'une nouvelle procédure – le contact avec le centre de service à la clientèle ou le service le plus proche.