Rose::DB::Oracle(3pm)

NAME
Rose::DB::Oracle - Oracle driver class for Rose::DB.

SYNOPSIS
  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
  ...

DESCRIPTION
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.

CLASS METHODS

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.

booleans_are_numeric [BOOL]
    Get or set a boolean value that indicates whether or not boolean columns are numeric. Oracle does not have a dedicated boolean column type. Two common stand-in column types are CHAR(1) and NUMBER(1). If "booleans_are_numeric" is true, then boolean columns are treated as NUMBER(1) columns containing either 1 or 0. If false, they are treated as CHAR(1) columns containing either 't' or 'f'. The default is false.

OBJECT METHODS

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.

  Value Parsing and Formatting

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.

AUTHORS
John C. Siracusa (siracusa@gmail.com), Ron Savage (ron@savage.net.au)

LICENSE
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.