| Rose::DB::Oracle(3pm) | User Contributed Perl Documentation | Rose::DB::Oracle(3pm) |
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->register_db
(
domain => 'production',
type => 'main',
driver => 'Oracle',
service => 'my_pdb',
host => 'db.example.com',
username => 'produser',
password => 'prodsecret',
);
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.
If you want to connect to a service rather than a database, use the "service" parameter instead of "database" when registering the data source, as shown in the SYNOPSIS above. This will allow you to connect to PDBs (Pluggable Databases).
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.
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.
$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
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.
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.
| 2023-03-04 | perl v5.36.0 |