Rose::DB::Oracle - Oracle driver class for Rose::DB.
use Rose::DB;
Rose::DB->register_db
(
domain => 'development',
type => 'main',
driver => 'Oracle',
database => 'dev_db',
host => 'localhost',
username => 'devuser',
password => 'mysecret',
);
Rose::DB->default_domain('development');
Rose::DB->default_type('main');
...
$db = Rose::DB->new; # $db is really a Rose::DB::Oracle-derived object
...
Rose::DB blesses objects into a class derived from Rose::DB::Oracle when the
driver is "oracle". This mapping of driver names to class names is
configurable. See the documentation for Rose::DB's new() and
driver_class() methods for more information.
This class cannot be used directly. You must use Rose::DB and let
its new() method return an object blessed into the appropriate class
for you, according to its driver_class() mappings.
Only the methods that are new or have different behaviors than
those in Rose::DB are documented here. See the Rose::DB documentation for
the full list of methods.
Oracle 9 or later is required.
Note: This class is a work in progress. Support for Oracle
databases is not yet complete. If you would like to help, please contact
John Siracusa at siracusa@gmail.com or post to the mailing list.
- default_post_connect_sql [STATEMENTS]
- Get or set the default list of SQL statements that will be run immediately
after connecting to the database. STATEMENTS should be a list or reference
to an array of SQL statements. Returns a reference to the array of SQL
statements in scalar context, or a list of SQL statements in list context.
The default_post_connect_sql statements will be run before any
statements set using the post_connect_sql method. The default list
contains the following:
ALTER SESSION SET NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF'
ALTER SESSION SET NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF TZHTZM'
If one or more
"NLS_*_FORMAT" environment variables
are set, the format strings above are replaced by the values that these
environment variables have at the time this module is loaded.
- post_connect_sql [STATEMENTS]
- Get or set the SQL statements that will be run immediately after
connecting to the database. STATEMENTS should be a list or reference to an
array of SQL statements. Returns a reference to an array (in scalar) or a
list of the default_post_connect_sql statements and the post_connect_sql
statements. Example:
$db->post_connect_sql('UPDATE mytable SET num = num + 1');
print join("\n", $db->post_connect_sql);
ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
ALTER SESSION SET NLS_TIMESTAMP_FORMAT='YYYY-MM-DD HH24:MI:SSxFF'
UPDATE mytable SET num = num + 1
- schema [SCHEMA]
- Get or set the database schema name. In Oracle, every user has a
corresponding schema. The schema is comprised of all objects that user
owns, and has the same name as that user. Therefore, this attribute
defaults to the username if it is not set explicitly.
- validate_date_keyword STRING
- Returns true if STRING is a valid keyword for the PostgreSQL
"date" data type. Valid (case-insensitive) date keywords are:
current_date
current_timestamp
localtimestamp
months_between
sysdate
systimestamp
The keywords are case sensitive. Any string that looks like a
function call (matches
"/^\w+\(.*\)$/") is also considered a
valid date keyword if keyword_function_calls is true.
- validate_timestamp_keyword STRING
- Returns true if STRING is a valid keyword for the Oracle
"timestamp" data type, false otherwise. Valid timestamp keywords
are:
current_date
current_timestamp
localtimestamp
months_between
sysdate
systimestamp
The keywords are case sensitive. Any string that looks like a
function call (matches
"/^\w+\(.*\)$/") is also considered a
valid timestamp keyword if keyword_function_calls is true.
John C. Siracusa (siracusa@gmail.com), Ron Savage (ron@savage.net.au)
Copyright (c) 2008 by John Siracusa and Ron Savage. All rights reserved. This
program is free software; you can redistribute it and/or modify it under the
same terms as Perl itself.