JDBC and HADB Date and Time Operations

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 Canonical String Decode Operation

The inverse of the canonical string encoding is used in the following places:

It is always allowed to store a string value into any metadata field, no matter what the type of the field is. The actual data stored is the result of applying the canonical string decode operation to the incoming string value.

On a virtual view lookup operation, the canonical string decode operation is used on the supplied filename to derive the actual metadata values to look up, given their string representations in the filename.

The decode operation is allowed to accept incoming string values that would never be a legal output for an encode operation. Some examples of this include:

decodeBinary of an odd number of hex digits. The convention is to left-justify the supplied digits in the binary value. For example, the string "b0a" corresponds to the binary literal [b0a0].

decodeDate of a non-standard date format.

A double value encoded with a non-canonical number of digits. For example,

.00145E20 instead of 1.45E17.

EXAMPLE 4–1Virtual View Lookup Operation

If you take a value V and encode it into a string S, and then perform the canonical decode operation on S to get a new value V. Does V always equal V? The answer is yes in most cases, but not always.

What is actually guaranteed is the weaker statement that if encode(V) = S and if decode(S)=V, then encode(V) is also equal to S.

JDBC and HADB Date and Time Operations

Use the 5800 system literal format for all the Date and Time operations, for example, {date ’12-31-2007’}.

The JDBC standard escape sequences for date ({d YYYY-mm-dd}) and time ({t

hh:mm:ss}) literals are available. However, usage of JDBC format date and time literals may produce inconsistent results. In particular, when JDBC format is used, the literal format is interpreted as being relative to the local time zone, and the time zone usually differs between a 5800 system cluster and client machine.

120

Sun StorageTek 5800 System Client API Reference Manual • June 2008

Page 120
Image 120
Sun Microsystems 5800 manual Jdbc and Hadb Date and Time Operations, Canonical String Decode Operation