News in 2.0
- New Features
- Object Type Support
- Array DML
- Timstamp and interval data type
- Tainted Strings and Safe Level
- Ruby 1.9 encoding support
- Checking available Oracle client features at run-time
- Improved features
- Incompatible Changes between 1.0 and 2.0
NOTICE: This page is under construction.
New Features
Object Type Support
Ruby-OCI8 2.0 New Feature: Oracle Object Type support http://limlian.blogspot.com/2008/04/oracle-object-type-support-in-ruby-oci8.html
Collection data types are also supported. Look at the following link. http://rubyforge.org/forum/message.php?msg_id=60632
I'll rewrite the internal structure but the user interface won't be changed.
Array DML
Ruby-OCI8 2.0 New Feature: Array DML Support http://limlian.blogspot.com/2008/05/ruby-oci8-v20-new-feature-array-dml.html
This feature is contributed by Oracle.
Timstamp and interval data type
The following data types are supported in 2.0.
- timestamp
- timestamp with time zone
- timestamp with local time zone
- interval year to month
- interval day to second
Timestamp data types including 'with time zone' and 'with local time zone' are fetched as Time objects if the time zone part is same with the local time zone or utc. If not, they are fetched as DateTime objects. The time zone of timestamp and timestamp with local time zone is the Oracle session time zone. It is same with the local time zone by default. You can change it by the following SQL statement.
ALTER SESSION SET TIME_ZONE='-05:00'
Unlike ruby-oci8 1.0, the fractional seconds are set with a limitation that the fractional part of a millisecond is truncated when it is fetched as a Time on ruby 1.8. As for ruby 1.9 there are no limitation of the fractional seconds because the 1.9 Time class's resolution is nanosecond.
Interval year to month values are fetched as integer values which indicate number of months between two timestamps.
Interval day to second values are fetched as rational number values which indicate number of seconds between two timestamps.
Tainted Strings and Safe Level
String values retrieved from databases are tainted as well as values read from files are.
If $SAFE >= 1, a SecurityError exception is raised when the following values are tainted.
- SQL statement
- connect string (username, password and database)
- OCI8::LOB dir_aliases and filename
Tainted values can be passed to bind variables and OCI8::LOB#write even though $SAFE >= 1, as well as File#write do.
Ruby 1.9 encoding support
OCI8.encoding is available when using ruby 1.9. The default value is determined from NLS_LANG.
String values retrieved from databases are tagged by the encoding. String values passed to databases are converted to the encoding from the string encodings.
The mapping table from Oracle character set name to ruby encoding name is listed in lib/oci8/encoding.yml. If it is not fit to your purpose or you want to save time to parse the yaml file, set the top-level constant DEFAULT_OCI8_ENCODING prior to 'require "oci8"'.
Keyword(s):
References:[SideMenu]