class OCI8::BindType::Time
OCI8::BindType.default_timezone = :utc
# or
OCI8::BindType.default_timezone = :local
The time zone can be changed as follows:
time zone, but by the OCI8::BindType.default_timezone
The retrieved value’s time zone is determined not by the session
when using Oracle 8.x client.
Oracle 9i. This class is available only to fetch or bind DATE
Timestamp data types and session time zone are new features in
=== Note for Oracle 8.x client
ALTER SESSION SET TIME_ZONE=‘-05:00’
It is changed by the following SQL.
The session time zone is same with local machine’s by default.
WITH LOCAL TIME ZONE</tt>.
if its data type is DATE
, TIMESTAMP
or TIMESTAMP<br>The retrieved value's time zone is determined by the session time zone<br><br>=== Note for default time zone<br><br>OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP_LTZ] = OCI8::BindType::DateTime<br>OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP_TZ] = OCI8::BindType::DateTime<br>OCI8::BindType::Mapping[OCI8::SQLT_TIMESTAMP] = OCI8::BindType::DateTime<br>- Otherwise, change the defalt mapping to use \DateTime as follows.<br>- Upgrade to ruby 1.9.2, whose \Time precision is nanosecond.<br>To avoid this fractional second truncation:<br><br>is the precision of standard \Time class.<br>than 6, the fractional second is truncated to microsecond, which<br>If the retrieved value has the precision of fractional second more<br><br>- The time is out of the time_t[http://en.wikipedia.org/wiki/Time_t].<br>- The timezone part is neither local nor utc.<br>and one of the following conditions are met.<br>a \DateTime. The fallback is done only when the ruby is before 1.9.2<br>If the retrieved value cannot be represented by \Time, it become<br><br>=== Note for ruby prior to 1.9.2<br><br>cursor.exec()<br>cursor.define(1, nil, Time)<br>cursor = conn.parse("SELECT hiredate FROM emp")<br><br>as a \Time by explicitly calling OCI8::Cursor#define as follows:<br>by default. If the default behaviour is changed, you can select it<br>and <tt>TIMESTAMP WITH LOCAL TIME ZONE
are selected as a TimeDATE
, TIMESTAMP
, TIMESTAMP WITH TIME ZONE
=== How to select Time values.
is a Time.
and TIMESTAMP WITH LOCAL TIME ZONE
. The retrieved valueDATE
, TIMESTAMP
, TIMESTAMP WITH TIME ZONE
This is a helper class to select or bind Oracle data types such as
++
OCI8::BindType::Time
–
def get() # :nodoc:
def get() # :nodoc: array_to_time(super(), nil) end
def set(val) # :nodoc:
def set(val) # :nodoc: super(datetime_to_array(val, :timestamp_tz)) end